Skip to content

Commit

Permalink
ucc_geth: add ethtool support
Browse files Browse the repository at this point in the history
The patch enables statistics in ucc_geth and adds ethtool support to
ucc_geth driver.

Signed-off-by: Li Yang <[email protected]>
Signed-off-by: Jeff Garzik <[email protected]>
  • Loading branch information
Li Yang authored and Jeff Garzik committed Jul 24, 2007
1 parent f695baf commit ac42185
Show file tree
Hide file tree
Showing 5 changed files with 407 additions and 14 deletions.
2 changes: 1 addition & 1 deletion drivers/net/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ gianfar_driver-objs := gianfar.o \
gianfar_sysfs.o

obj-$(CONFIG_UCC_GETH) += ucc_geth_driver.o
ucc_geth_driver-objs := ucc_geth.o ucc_geth_mii.o
ucc_geth_driver-objs := ucc_geth.o ucc_geth_mii.o ucc_geth_ethtool.o

#
# link order important here
Expand Down
19 changes: 9 additions & 10 deletions drivers/net/ucc_geth.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@

#undef DEBUG

#define DRV_DESC "QE UCC Gigabit Ethernet Controller"
#define DRV_NAME "ucc_geth"
#define DRV_VERSION "1.1"

#define ugeth_printk(level, format, arg...) \
printk(level format "\n", ## arg)

Expand All @@ -65,6 +61,8 @@
#define ugeth_vdbg(fmt, args...) do { } while (0)
#endif /* UGETH_VERBOSE_DEBUG */

void uec_set_ethtool_ops(struct net_device *netdev);

static DEFINE_SPINLOCK(ugeth_lock);

static struct ucc_geth_info ugeth_primary_info = {
Expand Down Expand Up @@ -104,6 +102,7 @@ static struct ucc_geth_info ugeth_primary_info = {
.maxRetransmission = 0xf,
.collisionWindow = 0x37,
.receiveFlowControl = 1,
.transmitFlowControl = 1,
.maxGroupAddrInHash = 4,
.maxIndAddrInHash = 4,
.prel = 7,
Expand Down Expand Up @@ -139,7 +138,9 @@ static struct ucc_geth_info ugeth_primary_info = {
.numStationAddresses = UCC_GETH_NUM_OF_STATION_ADDRESSES_1,
.largestexternallookupkeysize =
QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_NONE,
.statisticsMode = UCC_GETH_STATISTICS_GATHERING_MODE_NONE,
.statisticsMode = UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE |
UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX |
UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX,
.vlanOperationTagged = UCC_GETH_VLAN_OPERATION_TAGGED_NOP,
.vlanOperationNonTagged = UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP,
.rxQoSMode = UCC_GETH_QOS_MODE_DEFAULT,
Expand Down Expand Up @@ -1200,7 +1201,7 @@ static int init_inter_frame_gap_params(u8 non_btb_cs_ipg,
return 0;
}

static int init_flow_control_params(u32 automatic_flow_control_mode,
int init_flow_control_params(u32 automatic_flow_control_mode,
int rx_flow_control_enable,
int tx_flow_control_enable,
u16 pause_period,
Expand Down Expand Up @@ -2507,7 +2508,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
/* For more details see the hardware spec. */
init_flow_control_params(ug_info->aufc,
ug_info->receiveFlowControl,
1,
ug_info->transmitFlowControl,
ug_info->pausePeriod,
ug_info->extensionField,
&uf_regs->upsmr,
Expand Down Expand Up @@ -3732,8 +3733,6 @@ static int ucc_geth_close(struct net_device *dev)
return 0;
}

const struct ethtool_ops ucc_geth_ethtool_ops = { };

static phy_interface_t to_phy_interface(const char *phy_connection_type)
{
if (strcasecmp(phy_connection_type, "mii") == 0)
Expand Down Expand Up @@ -3896,6 +3895,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
SET_NETDEV_DEV(dev, device);

/* Fill in the dev structure */
uec_set_ethtool_ops(dev);
dev->open = ucc_geth_open;
dev->hard_start_xmit = ucc_geth_start_xmit;
dev->tx_timeout = ucc_geth_timeout;
Expand All @@ -3909,7 +3909,6 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
// dev->change_mtu = ucc_geth_change_mtu;
dev->mtu = 1500;
dev->set_multicast_list = ucc_geth_set_multi;
dev->ethtool_ops = &ucc_geth_ethtool_ops;

ugeth->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1;
ugeth->phy_interface = phy_interface;
Expand Down
6 changes: 6 additions & 0 deletions drivers/net/ucc_geth.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@

#include "ucc_geth_mii.h"

#define DRV_DESC "QE UCC Gigabit Ethernet Controller"
#define DRV_NAME "ucc_geth"
#define DRV_VERSION "1.1"

#define NUM_TX_QUEUES 8
#define NUM_RX_QUEUES 8
#define NUM_BDS_IN_PREFETCHED_BDS 4
Expand Down Expand Up @@ -896,6 +900,7 @@ struct ucc_geth_hardware_statistics {
#define UCC_GETH_TX_VTAG_TABLE_ENTRY_MAX 8
#define UCC_GETH_RX_BD_RING_SIZE_MIN 8
#define UCC_GETH_TX_BD_RING_SIZE_MIN 2
#define UCC_GETH_BD_RING_SIZE_MAX 0xffff

#define UCC_GETH_SIZE_OF_BD QE_SIZEOF_BD

Expand Down Expand Up @@ -1135,6 +1140,7 @@ struct ucc_geth_info {
int bro;
int ecm;
int receiveFlowControl;
int transmitFlowControl;
u8 maxGroupAddrInHash;
u8 maxIndAddrInHash;
u8 prel;
Expand Down
Loading

0 comments on commit ac42185

Please sign in to comment.