Skip to content

Commit ac42185

Browse files
Li YangJeff Garzik
Li Yang
authored and
Jeff Garzik
committed
ucc_geth: add ethtool support
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]>
1 parent f695baf commit ac42185

File tree

5 files changed

+407
-14
lines changed

5 files changed

+407
-14
lines changed

drivers/net/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ gianfar_driver-objs := gianfar.o \
1818
gianfar_sysfs.o
1919

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

2323
#
2424
# link order important here

drivers/net/ucc_geth.c

+9-10
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@
4343

4444
#undef DEBUG
4545

46-
#define DRV_DESC "QE UCC Gigabit Ethernet Controller"
47-
#define DRV_NAME "ucc_geth"
48-
#define DRV_VERSION "1.1"
49-
5046
#define ugeth_printk(level, format, arg...) \
5147
printk(level format "\n", ## arg)
5248

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

64+
void uec_set_ethtool_ops(struct net_device *netdev);
65+
6866
static DEFINE_SPINLOCK(ugeth_lock);
6967

7068
static struct ucc_geth_info ugeth_primary_info = {
@@ -104,6 +102,7 @@ static struct ucc_geth_info ugeth_primary_info = {
104102
.maxRetransmission = 0xf,
105103
.collisionWindow = 0x37,
106104
.receiveFlowControl = 1,
105+
.transmitFlowControl = 1,
107106
.maxGroupAddrInHash = 4,
108107
.maxIndAddrInHash = 4,
109108
.prel = 7,
@@ -139,7 +138,9 @@ static struct ucc_geth_info ugeth_primary_info = {
139138
.numStationAddresses = UCC_GETH_NUM_OF_STATION_ADDRESSES_1,
140139
.largestexternallookupkeysize =
141140
QE_FLTR_LARGEST_EXTERNAL_TABLE_LOOKUP_KEY_SIZE_NONE,
142-
.statisticsMode = UCC_GETH_STATISTICS_GATHERING_MODE_NONE,
141+
.statisticsMode = UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE |
142+
UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX |
143+
UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX,
143144
.vlanOperationTagged = UCC_GETH_VLAN_OPERATION_TAGGED_NOP,
144145
.vlanOperationNonTagged = UCC_GETH_VLAN_OPERATION_NON_TAGGED_NOP,
145146
.rxQoSMode = UCC_GETH_QOS_MODE_DEFAULT,
@@ -1200,7 +1201,7 @@ static int init_inter_frame_gap_params(u8 non_btb_cs_ipg,
12001201
return 0;
12011202
}
12021203

1203-
static int init_flow_control_params(u32 automatic_flow_control_mode,
1204+
int init_flow_control_params(u32 automatic_flow_control_mode,
12041205
int rx_flow_control_enable,
12051206
int tx_flow_control_enable,
12061207
u16 pause_period,
@@ -2507,7 +2508,7 @@ static int ucc_geth_startup(struct ucc_geth_private *ugeth)
25072508
/* For more details see the hardware spec. */
25082509
init_flow_control_params(ug_info->aufc,
25092510
ug_info->receiveFlowControl,
2510-
1,
2511+
ug_info->transmitFlowControl,
25112512
ug_info->pausePeriod,
25122513
ug_info->extensionField,
25132514
&uf_regs->upsmr,
@@ -3732,8 +3733,6 @@ static int ucc_geth_close(struct net_device *dev)
37323733
return 0;
37333734
}
37343735

3735-
const struct ethtool_ops ucc_geth_ethtool_ops = { };
3736-
37373736
static phy_interface_t to_phy_interface(const char *phy_connection_type)
37383737
{
37393738
if (strcasecmp(phy_connection_type, "mii") == 0)
@@ -3896,6 +3895,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
38963895
SET_NETDEV_DEV(dev, device);
38973896

38983897
/* Fill in the dev structure */
3898+
uec_set_ethtool_ops(dev);
38993899
dev->open = ucc_geth_open;
39003900
dev->hard_start_xmit = ucc_geth_start_xmit;
39013901
dev->tx_timeout = ucc_geth_timeout;
@@ -3909,7 +3909,6 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
39093909
// dev->change_mtu = ucc_geth_change_mtu;
39103910
dev->mtu = 1500;
39113911
dev->set_multicast_list = ucc_geth_set_multi;
3912-
dev->ethtool_ops = &ucc_geth_ethtool_ops;
39133912

39143913
ugeth->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1;
39153914
ugeth->phy_interface = phy_interface;

drivers/net/ucc_geth.h

+6
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030

3131
#include "ucc_geth_mii.h"
3232

33+
#define DRV_DESC "QE UCC Gigabit Ethernet Controller"
34+
#define DRV_NAME "ucc_geth"
35+
#define DRV_VERSION "1.1"
36+
3337
#define NUM_TX_QUEUES 8
3438
#define NUM_RX_QUEUES 8
3539
#define NUM_BDS_IN_PREFETCHED_BDS 4
@@ -896,6 +900,7 @@ struct ucc_geth_hardware_statistics {
896900
#define UCC_GETH_TX_VTAG_TABLE_ENTRY_MAX 8
897901
#define UCC_GETH_RX_BD_RING_SIZE_MIN 8
898902
#define UCC_GETH_TX_BD_RING_SIZE_MIN 2
903+
#define UCC_GETH_BD_RING_SIZE_MAX 0xffff
899904

900905
#define UCC_GETH_SIZE_OF_BD QE_SIZEOF_BD
901906

@@ -1135,6 +1140,7 @@ struct ucc_geth_info {
11351140
int bro;
11361141
int ecm;
11371142
int receiveFlowControl;
1143+
int transmitFlowControl;
11381144
u8 maxGroupAddrInHash;
11391145
u8 maxIndAddrInHash;
11401146
u8 prel;

0 commit comments

Comments
 (0)