aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-10-03 21:07:32 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:51:45 -0400
commitb9f2c0440d806e01968c3ed4def930a43be248ad (patch)
treeb8e4668b0a4eab842fc33402e92b15f6c63cbc18
parent753f492093da7a40141bfe083073400f518f4c68 (diff)
[netdrvr] Stop using legacy hooks ->self_test_count, ->get_stats_count
These have been superceded by the new ->get_sset_count() hook. Signed-off-by: Jeff Garzik <jeff@garzik.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/3c59x.c11
-rw-r--r--drivers/net/8139cp.c11
-rw-r--r--drivers/net/8139too.c11
-rw-r--r--drivers/net/atl1/atl1_ethtool.c11
-rw-r--r--drivers/net/b44.c11
-rw-r--r--drivers/net/bnx2.c20
-rw-r--r--drivers/net/cassini.c11
-rw-r--r--drivers/net/chelsio/cxgb2.c11
-rw-r--r--drivers/net/cxgb3/cxgb3_main.c11
-rw-r--r--drivers/net/e100.c19
-rw-r--r--drivers/net/e1000/e1000_ethtool.c22
-rw-r--r--drivers/net/e1000e/ethtool.c21
-rw-r--r--drivers/net/ehea/ehea_ethtool.c13
-rw-r--r--drivers/net/forcedeth.c45
-rw-r--r--drivers/net/gianfar_ethtool.c20
-rw-r--r--drivers/net/ibm_emac/ibm_emac_core.c12
-rw-r--r--drivers/net/ibmveth.c11
-rw-r--r--drivers/net/ixgb/ixgb_ethtool.c11
-rw-r--r--drivers/net/ixgbe/ixgbe_ethtool.c11
-rw-r--r--drivers/net/mv643xx_eth.c10
-rw-r--r--drivers/net/myri10ge/myri10ge.c11
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c21
-rw-r--r--drivers/net/pcnet32.c11
-rwxr-xr-xdrivers/net/qla3xxx.c2
-rw-r--r--drivers/net/r8169.c11
-rw-r--r--drivers/net/s2io.c47
-rw-r--r--drivers/net/sc92031.c11
-rw-r--r--drivers/net/skge.c11
-rw-r--r--drivers/net/sky2.c11
-rw-r--r--drivers/net/spider_net_ethtool.c11
-rw-r--r--drivers/net/tc35815.c12
-rw-r--r--drivers/net/tg3.c19
-rw-r--r--drivers/net/ucc_geth_ethtool.c26
-rw-r--r--drivers/net/veth.c11
-rw-r--r--drivers/net/wireless/libertas/ethtool.c72
35 files changed, 345 insertions, 245 deletions
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 58311199e321..93eb78425d6d 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -2833,9 +2833,14 @@ static void vortex_set_msglevel(struct net_device *dev, u32 dbg)
2833 vortex_debug = dbg; 2833 vortex_debug = dbg;
2834} 2834}
2835 2835
2836static int vortex_get_stats_count(struct net_device *dev) 2836static int vortex_get_sset_count(struct net_device *dev, int sset)
2837{ 2837{
2838 return VORTEX_NUM_STATS; 2838 switch (sset) {
2839 case ETH_SS_STATS:
2840 return VORTEX_NUM_STATS;
2841 default:
2842 return -EOPNOTSUPP;
2843 }
2839} 2844}
2840 2845
2841static void vortex_get_ethtool_stats(struct net_device *dev, 2846static void vortex_get_ethtool_stats(struct net_device *dev,
@@ -2892,7 +2897,7 @@ static const struct ethtool_ops vortex_ethtool_ops = {
2892 .get_msglevel = vortex_get_msglevel, 2897 .get_msglevel = vortex_get_msglevel,
2893 .set_msglevel = vortex_set_msglevel, 2898 .set_msglevel = vortex_set_msglevel,
2894 .get_ethtool_stats = vortex_get_ethtool_stats, 2899 .get_ethtool_stats = vortex_get_ethtool_stats,
2895 .get_stats_count = vortex_get_stats_count, 2900 .get_sset_count = vortex_get_sset_count,
2896 .get_settings = vortex_get_settings, 2901 .get_settings = vortex_get_settings,
2897 .set_settings = vortex_set_settings, 2902 .set_settings = vortex_set_settings,
2898 .get_link = ethtool_op_get_link, 2903 .get_link = ethtool_op_get_link,
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index 7edd50cf7776..d437823c2c5e 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -1383,9 +1383,14 @@ static int cp_get_regs_len(struct net_device *dev)
1383 return CP_REGS_SIZE; 1383 return CP_REGS_SIZE;
1384} 1384}
1385 1385
1386static int cp_get_stats_count (struct net_device *dev) 1386static int cp_get_sset_count (struct net_device *dev, int sset)
1387{ 1387{
1388 return CP_NUM_STATS; 1388 switch (sset) {
1389 case ETH_SS_STATS:
1390 return CP_NUM_STATS;
1391 default:
1392 return -EOPNOTSUPP;
1393 }
1389} 1394}
1390 1395
1391static int cp_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 1396static int cp_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
@@ -1563,7 +1568,7 @@ static void cp_get_ethtool_stats (struct net_device *dev,
1563static const struct ethtool_ops cp_ethtool_ops = { 1568static const struct ethtool_ops cp_ethtool_ops = {
1564 .get_drvinfo = cp_get_drvinfo, 1569 .get_drvinfo = cp_get_drvinfo,
1565 .get_regs_len = cp_get_regs_len, 1570 .get_regs_len = cp_get_regs_len,
1566 .get_stats_count = cp_get_stats_count, 1571 .get_sset_count = cp_get_sset_count,
1567 .get_settings = cp_get_settings, 1572 .get_settings = cp_get_settings,
1568 .set_settings = cp_set_settings, 1573 .set_settings = cp_set_settings,
1569 .nway_reset = cp_nway_reset, 1574 .nway_reset = cp_nway_reset,
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index d3088a786e26..973b684c11e3 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -2406,9 +2406,14 @@ static void rtl8139_get_regs(struct net_device *dev, struct ethtool_regs *regs,
2406} 2406}
2407#endif /* CONFIG_8139TOO_MMIO */ 2407#endif /* CONFIG_8139TOO_MMIO */
2408 2408
2409static int rtl8139_get_stats_count(struct net_device *dev) 2409static int rtl8139_get_sset_count(struct net_device *dev, int sset)
2410{ 2410{
2411 return RTL_NUM_STATS; 2411 switch (sset) {
2412 case ETH_SS_STATS:
2413 return RTL_NUM_STATS;
2414 default:
2415 return -EOPNOTSUPP;
2416 }
2412} 2417}
2413 2418
2414static void rtl8139_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, u64 *data) 2419static void rtl8139_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, u64 *data)
@@ -2439,7 +2444,7 @@ static const struct ethtool_ops rtl8139_ethtool_ops = {
2439 .get_wol = rtl8139_get_wol, 2444 .get_wol = rtl8139_get_wol,
2440 .set_wol = rtl8139_set_wol, 2445 .set_wol = rtl8139_set_wol,
2441 .get_strings = rtl8139_get_strings, 2446 .get_strings = rtl8139_get_strings,
2442 .get_stats_count = rtl8139_get_stats_count, 2447 .get_sset_count = rtl8139_get_sset_count,
2443 .get_ethtool_stats = rtl8139_get_ethtool_stats, 2448 .get_ethtool_stats = rtl8139_get_ethtool_stats,
2444}; 2449};
2445 2450
diff --git a/drivers/net/atl1/atl1_ethtool.c b/drivers/net/atl1/atl1_ethtool.c
index 53353b60a9c8..68a83be843ab 100644
--- a/drivers/net/atl1/atl1_ethtool.c
+++ b/drivers/net/atl1/atl1_ethtool.c
@@ -88,9 +88,14 @@ static void atl1_get_ethtool_stats(struct net_device *netdev,
88 88
89} 89}
90 90
91static int atl1_get_stats_count(struct net_device *netdev) 91static int atl1_get_sset_count(struct net_device *netdev, int sset)
92{ 92{
93 return ARRAY_SIZE(atl1_gstrings_stats); 93 switch (sset) {
94 case ETH_SS_STATS:
95 return ARRAY_SIZE(atl1_gstrings_stats);
96 default:
97 return -EOPNOTSUPP;
98 }
94} 99}
95 100
96static int atl1_get_settings(struct net_device *netdev, 101static int atl1_get_settings(struct net_device *netdev,
@@ -495,6 +500,6 @@ const struct ethtool_ops atl1_ethtool_ops = {
495 .get_strings = atl1_get_strings, 500 .get_strings = atl1_get_strings,
496 .nway_reset = atl1_nway_reset, 501 .nway_reset = atl1_nway_reset,
497 .get_ethtool_stats = atl1_get_ethtool_stats, 502 .get_ethtool_stats = atl1_get_ethtool_stats,
498 .get_stats_count = atl1_get_stats_count, 503 .get_sset_count = atl1_get_sset_count,
499 .set_tso = ethtool_op_set_tso, 504 .set_tso = ethtool_op_set_tso,
500}; 505};
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index e90ba217d244..3d247f3f4a3c 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1962,9 +1962,14 @@ static void b44_get_strings(struct net_device *dev, u32 stringset, u8 *data)
1962 } 1962 }
1963} 1963}
1964 1964
1965static int b44_get_stats_count(struct net_device *dev) 1965static int b44_get_sset_count(struct net_device *dev, int sset)
1966{ 1966{
1967 return ARRAY_SIZE(b44_gstrings); 1967 switch (sset) {
1968 case ETH_SS_STATS:
1969 return ARRAY_SIZE(b44_gstrings);
1970 default:
1971 return -EOPNOTSUPP;
1972 }
1968} 1973}
1969 1974
1970static void b44_get_ethtool_stats(struct net_device *dev, 1975static void b44_get_ethtool_stats(struct net_device *dev,
@@ -2025,7 +2030,7 @@ static const struct ethtool_ops b44_ethtool_ops = {
2025 .get_msglevel = b44_get_msglevel, 2030 .get_msglevel = b44_get_msglevel,
2026 .set_msglevel = b44_set_msglevel, 2031 .set_msglevel = b44_set_msglevel,
2027 .get_strings = b44_get_strings, 2032 .get_strings = b44_get_strings,
2028 .get_stats_count = b44_get_stats_count, 2033 .get_sset_count = b44_get_sset_count,
2029 .get_ethtool_stats = b44_get_ethtool_stats, 2034 .get_ethtool_stats = b44_get_ethtool_stats,
2030}; 2035};
2031 2036
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index ee9aed3aa489..57f7d994c9c1 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -6068,9 +6068,16 @@ static struct {
6068}; 6068};
6069 6069
6070static int 6070static int
6071bnx2_self_test_count(struct net_device *dev) 6071bnx2_get_sset_count(struct net_device *dev, int sset)
6072{ 6072{
6073 return BNX2_NUM_TESTS; 6073 switch (sset) {
6074 case ETH_SS_TEST:
6075 return BNX2_NUM_TESTS;
6076 case ETH_SS_STATS:
6077 return BNX2_NUM_STATS;
6078 default:
6079 return -EOPNOTSUPP;
6080 }
6074} 6081}
6075 6082
6076static void 6083static void
@@ -6144,12 +6151,6 @@ bnx2_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
6144 } 6151 }
6145} 6152}
6146 6153
6147static int
6148bnx2_get_stats_count(struct net_device *dev)
6149{
6150 return BNX2_NUM_STATS;
6151}
6152
6153static void 6154static void
6154bnx2_get_ethtool_stats(struct net_device *dev, 6155bnx2_get_ethtool_stats(struct net_device *dev,
6155 struct ethtool_stats *stats, u64 *buf) 6156 struct ethtool_stats *stats, u64 *buf)
@@ -6260,12 +6261,11 @@ static const struct ethtool_ops bnx2_ethtool_ops = {
6260 .set_tx_csum = bnx2_set_tx_csum, 6261 .set_tx_csum = bnx2_set_tx_csum,
6261 .set_sg = ethtool_op_set_sg, 6262 .set_sg = ethtool_op_set_sg,
6262 .set_tso = bnx2_set_tso, 6263 .set_tso = bnx2_set_tso,
6263 .self_test_count = bnx2_self_test_count,
6264 .self_test = bnx2_self_test, 6264 .self_test = bnx2_self_test,
6265 .get_strings = bnx2_get_strings, 6265 .get_strings = bnx2_get_strings,
6266 .phys_id = bnx2_phys_id, 6266 .phys_id = bnx2_phys_id,
6267 .get_stats_count = bnx2_get_stats_count,
6268 .get_ethtool_stats = bnx2_get_ethtool_stats, 6267 .get_ethtool_stats = bnx2_get_ethtool_stats,
6268 .get_sset_count = bnx2_get_sset_count,
6269}; 6269};
6270 6270
6271/* Called with rtnl_lock */ 6271/* Called with rtnl_lock */
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index adc2e4d5a69e..563bf5f6fa2a 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -4772,9 +4772,14 @@ static void cas_get_regs(struct net_device *dev, struct ethtool_regs *regs,
4772 cas_read_regs(cp, p, regs->len / sizeof(u32)); 4772 cas_read_regs(cp, p, regs->len / sizeof(u32));
4773} 4773}
4774 4774
4775static int cas_get_stats_count(struct net_device *dev) 4775static int cas_get_sset_count(struct net_device *dev, int sset)
4776{ 4776{
4777 return CAS_NUM_STAT_KEYS; 4777 switch (sset) {
4778 case ETH_SS_STATS:
4779 return CAS_NUM_STAT_KEYS;
4780 default:
4781 return -EOPNOTSUPP;
4782 }
4778} 4783}
4779 4784
4780static void cas_get_strings(struct net_device *dev, u32 stringset, u8 *data) 4785static void cas_get_strings(struct net_device *dev, u32 stringset, u8 *data)
@@ -4818,7 +4823,7 @@ static const struct ethtool_ops cas_ethtool_ops = {
4818 .set_msglevel = cas_set_msglevel, 4823 .set_msglevel = cas_set_msglevel,
4819 .get_regs_len = cas_get_regs_len, 4824 .get_regs_len = cas_get_regs_len,
4820 .get_regs = cas_get_regs, 4825 .get_regs = cas_get_regs,
4821 .get_stats_count = cas_get_stats_count, 4826 .get_sset_count = cas_get_sset_count,
4822 .get_strings = cas_get_strings, 4827 .get_strings = cas_get_strings,
4823 .get_ethtool_stats = cas_get_ethtool_stats, 4828 .get_ethtool_stats = cas_get_ethtool_stats,
4824}; 4829};
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c
index 7029f13d008d..2dbf8dc116c6 100644
--- a/drivers/net/chelsio/cxgb2.c
+++ b/drivers/net/chelsio/cxgb2.c
@@ -439,9 +439,14 @@ static void get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
439 strcpy(info->bus_info, pci_name(adapter->pdev)); 439 strcpy(info->bus_info, pci_name(adapter->pdev));
440} 440}
441 441
442static int get_stats_count(struct net_device *dev) 442static int get_sset_count(struct net_device *dev, int sset)
443{ 443{
444 return ARRAY_SIZE(stats_strings); 444 switch (sset) {
445 case ETH_SS_STATS:
446 return ARRAY_SIZE(stats_strings);
447 default:
448 return -EOPNOTSUPP;
449 }
445} 450}
446 451
447static void get_strings(struct net_device *dev, u32 stringset, u8 *data) 452static void get_strings(struct net_device *dev, u32 stringset, u8 *data)
@@ -798,7 +803,7 @@ static const struct ethtool_ops t1_ethtool_ops = {
798 .set_sg = ethtool_op_set_sg, 803 .set_sg = ethtool_op_set_sg,
799 .get_link = ethtool_op_get_link, 804 .get_link = ethtool_op_get_link,
800 .get_strings = get_strings, 805 .get_strings = get_strings,
801 .get_stats_count = get_stats_count, 806 .get_sset_count = get_sset_count,
802 .get_ethtool_stats = get_stats, 807 .get_ethtool_stats = get_stats,
803 .get_regs_len = get_regs_len, 808 .get_regs_len = get_regs_len,
804 .get_regs = get_regs, 809 .get_regs = get_regs,
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 04633ea55202..e22d06531051 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -1131,9 +1131,14 @@ static char stats_strings[][ETH_GSTRING_LEN] = {
1131 1131
1132}; 1132};
1133 1133
1134static int get_stats_count(struct net_device *dev) 1134static int get_sset_count(struct net_device *dev, int sset)
1135{ 1135{
1136 return ARRAY_SIZE(stats_strings); 1136 switch (sset) {
1137 case ETH_SS_STATS:
1138 return ARRAY_SIZE(stats_strings);
1139 default:
1140 return -EOPNOTSUPP;
1141 }
1137} 1142}
1138 1143
1139#define T3_REGMAP_SIZE (3 * 1024) 1144#define T3_REGMAP_SIZE (3 * 1024)
@@ -1640,7 +1645,7 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
1640 .get_strings = get_strings, 1645 .get_strings = get_strings,
1641 .phys_id = cxgb3_phys_id, 1646 .phys_id = cxgb3_phys_id,
1642 .nway_reset = restart_autoneg, 1647 .nway_reset = restart_autoneg,
1643 .get_stats_count = get_stats_count, 1648 .get_sset_count = get_sset_count,
1644 .get_ethtool_stats = get_stats, 1649 .get_ethtool_stats = get_stats,
1645 .get_regs_len = get_regs_len, 1650 .get_regs_len = get_regs_len,
1646 .get_regs = get_regs, 1651 .get_regs = get_regs,
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 720994b1e13a..7bd960402687 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -2374,11 +2374,6 @@ static const char e100_gstrings_test[][ETH_GSTRING_LEN] = {
2374}; 2374};
2375#define E100_TEST_LEN sizeof(e100_gstrings_test) / ETH_GSTRING_LEN 2375#define E100_TEST_LEN sizeof(e100_gstrings_test) / ETH_GSTRING_LEN
2376 2376
2377static int e100_diag_test_count(struct net_device *netdev)
2378{
2379 return E100_TEST_LEN;
2380}
2381
2382static void e100_diag_test(struct net_device *netdev, 2377static void e100_diag_test(struct net_device *netdev,
2383 struct ethtool_test *test, u64 *data) 2378 struct ethtool_test *test, u64 *data)
2384{ 2379{
@@ -2441,9 +2436,16 @@ static const char e100_gstrings_stats[][ETH_GSTRING_LEN] = {
2441#define E100_NET_STATS_LEN 21 2436#define E100_NET_STATS_LEN 21
2442#define E100_STATS_LEN sizeof(e100_gstrings_stats) / ETH_GSTRING_LEN 2437#define E100_STATS_LEN sizeof(e100_gstrings_stats) / ETH_GSTRING_LEN
2443 2438
2444static int e100_get_stats_count(struct net_device *netdev) 2439static int e100_get_sset_count(struct net_device *netdev, int sset)
2445{ 2440{
2446 return E100_STATS_LEN; 2441 switch (sset) {
2442 case ETH_SS_TEST:
2443 return E100_TEST_LEN;
2444 case ETH_SS_STATS:
2445 return E100_STATS_LEN;
2446 default:
2447 return -EOPNOTSUPP;
2448 }
2447} 2449}
2448 2450
2449static void e100_get_ethtool_stats(struct net_device *netdev, 2451static void e100_get_ethtool_stats(struct net_device *netdev,
@@ -2494,12 +2496,11 @@ static const struct ethtool_ops e100_ethtool_ops = {
2494 .set_eeprom = e100_set_eeprom, 2496 .set_eeprom = e100_set_eeprom,
2495 .get_ringparam = e100_get_ringparam, 2497 .get_ringparam = e100_get_ringparam,
2496 .set_ringparam = e100_set_ringparam, 2498 .set_ringparam = e100_set_ringparam,
2497 .self_test_count = e100_diag_test_count,
2498 .self_test = e100_diag_test, 2499 .self_test = e100_diag_test,
2499 .get_strings = e100_get_strings, 2500 .get_strings = e100_get_strings,
2500 .phys_id = e100_phys_id, 2501 .phys_id = e100_phys_id,
2501 .get_stats_count = e100_get_stats_count,
2502 .get_ethtool_stats = e100_get_ethtool_stats, 2502 .get_ethtool_stats = e100_get_ethtool_stats,
2503 .get_sset_count = e100_get_sset_count,
2503}; 2504};
2504 2505
2505static int e100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) 2506static int e100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index e6c4a3bb9e4c..6c9a643426f5 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -618,8 +618,6 @@ e1000_get_drvinfo(struct net_device *netdev,
618 618
619 strncpy(drvinfo->fw_version, firmware_version, 32); 619 strncpy(drvinfo->fw_version, firmware_version, 32);
620 strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); 620 strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32);
621 drvinfo->n_stats = E1000_STATS_LEN;
622 drvinfo->testinfo_len = E1000_TEST_LEN;
623 drvinfo->regdump_len = e1000_get_regs_len(netdev); 621 drvinfo->regdump_len = e1000_get_regs_len(netdev);
624 drvinfo->eedump_len = e1000_get_eeprom_len(netdev); 622 drvinfo->eedump_len = e1000_get_eeprom_len(netdev);
625} 623}
@@ -1611,9 +1609,16 @@ e1000_link_test(struct e1000_adapter *adapter, uint64_t *data)
1611} 1609}
1612 1610
1613static int 1611static int
1614e1000_diag_test_count(struct net_device *netdev) 1612e1000_get_sset_count(struct net_device *netdev, int sset)
1615{ 1613{
1616 return E1000_TEST_LEN; 1614 switch (sset) {
1615 case ETH_SS_TEST:
1616 return E1000_TEST_LEN;
1617 case ETH_SS_STATS:
1618 return E1000_STATS_LEN;
1619 default:
1620 return -EOPNOTSUPP;
1621 }
1617} 1622}
1618 1623
1619extern void e1000_power_up_phy(struct e1000_adapter *); 1624extern void e1000_power_up_phy(struct e1000_adapter *);
@@ -1898,12 +1903,6 @@ e1000_nway_reset(struct net_device *netdev)
1898 return 0; 1903 return 0;
1899} 1904}
1900 1905
1901static int
1902e1000_get_stats_count(struct net_device *netdev)
1903{
1904 return E1000_STATS_LEN;
1905}
1906
1907static void 1906static void
1908e1000_get_ethtool_stats(struct net_device *netdev, 1907e1000_get_ethtool_stats(struct net_device *netdev,
1909 struct ethtool_stats *stats, uint64_t *data) 1908 struct ethtool_stats *stats, uint64_t *data)
@@ -1967,12 +1966,11 @@ static const struct ethtool_ops e1000_ethtool_ops = {
1967 .set_tx_csum = e1000_set_tx_csum, 1966 .set_tx_csum = e1000_set_tx_csum,
1968 .set_sg = ethtool_op_set_sg, 1967 .set_sg = ethtool_op_set_sg,
1969 .set_tso = e1000_set_tso, 1968 .set_tso = e1000_set_tso,
1970 .self_test_count = e1000_diag_test_count,
1971 .self_test = e1000_diag_test, 1969 .self_test = e1000_diag_test,
1972 .get_strings = e1000_get_strings, 1970 .get_strings = e1000_get_strings,
1973 .phys_id = e1000_phys_id, 1971 .phys_id = e1000_phys_id,
1974 .get_stats_count = e1000_get_stats_count,
1975 .get_ethtool_stats = e1000_get_ethtool_stats, 1972 .get_ethtool_stats = e1000_get_ethtool_stats,
1973 .get_sset_count = e1000_get_sset_count,
1976}; 1974};
1977 1975
1978void e1000_set_ethtool_ops(struct net_device *netdev) 1976void e1000_set_ethtool_ops(struct net_device *netdev)
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 0e80406bfbd7..3423f33769b7 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -577,8 +577,6 @@ static void e1000_get_drvinfo(struct net_device *netdev,
577 577
578 strncpy(drvinfo->fw_version, firmware_version, 32); 578 strncpy(drvinfo->fw_version, firmware_version, 32);
579 strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); 579 strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32);
580 drvinfo->n_stats = E1000_STATS_LEN;
581 drvinfo->testinfo_len = E1000_TEST_LEN;
582 drvinfo->regdump_len = e1000_get_regs_len(netdev); 580 drvinfo->regdump_len = e1000_get_regs_len(netdev);
583 drvinfo->eedump_len = e1000_get_eeprom_len(netdev); 581 drvinfo->eedump_len = e1000_get_eeprom_len(netdev);
584} 582}
@@ -1493,9 +1491,16 @@ static int e1000_link_test(struct e1000_adapter *adapter, u64 *data)
1493 return *data; 1491 return *data;
1494} 1492}
1495 1493
1496static int e1000_diag_test_count(struct net_device *netdev) 1494static int e1000e_get_sset_count(struct net_device *netdev, int sset)
1497{ 1495{
1498 return E1000_TEST_LEN; 1496 switch (sset) {
1497 case ETH_SS_TEST:
1498 return E1000_TEST_LEN;
1499 case ETH_SS_STATS:
1500 return E1000_STATS_LEN;
1501 default:
1502 return -EOPNOTSUPP;
1503 }
1499} 1504}
1500 1505
1501static void e1000_diag_test(struct net_device *netdev, 1506static void e1000_diag_test(struct net_device *netdev,
@@ -1692,11 +1697,6 @@ static int e1000_nway_reset(struct net_device *netdev)
1692 return 0; 1697 return 0;
1693} 1698}
1694 1699
1695static int e1000_get_stats_count(struct net_device *netdev)
1696{
1697 return E1000_STATS_LEN;
1698}
1699
1700static void e1000_get_ethtool_stats(struct net_device *netdev, 1700static void e1000_get_ethtool_stats(struct net_device *netdev,
1701 struct ethtool_stats *stats, 1701 struct ethtool_stats *stats,
1702 u64 *data) 1702 u64 *data)
@@ -1760,12 +1760,11 @@ static const struct ethtool_ops e1000_ethtool_ops = {
1760 .set_sg = ethtool_op_set_sg, 1760 .set_sg = ethtool_op_set_sg,
1761 .get_tso = ethtool_op_get_tso, 1761 .get_tso = ethtool_op_get_tso,
1762 .set_tso = e1000_set_tso, 1762 .set_tso = e1000_set_tso,
1763 .self_test_count = e1000_diag_test_count,
1764 .self_test = e1000_diag_test, 1763 .self_test = e1000_diag_test,
1765 .get_strings = e1000_get_strings, 1764 .get_strings = e1000_get_strings,
1766 .phys_id = e1000_phys_id, 1765 .phys_id = e1000_phys_id,
1767 .get_stats_count = e1000_get_stats_count,
1768 .get_ethtool_stats = e1000_get_ethtool_stats, 1766 .get_ethtool_stats = e1000_get_ethtool_stats,
1767 .get_sset_count = e1000e_get_sset_count,
1769}; 1768};
1770 1769
1771void e1000e_set_ethtool_ops(struct net_device *netdev) 1770void e1000e_set_ethtool_ops(struct net_device *netdev)
diff --git a/drivers/net/ehea/ehea_ethtool.c b/drivers/net/ehea/ehea_ethtool.c
index 6498455bf97c..679f40ee9572 100644
--- a/drivers/net/ehea/ehea_ethtool.c
+++ b/drivers/net/ehea/ehea_ethtool.c
@@ -196,9 +196,14 @@ static void ehea_get_strings(struct net_device *dev, u32 stringset, u8 *data)
196 } 196 }
197} 197}
198 198
199static int ehea_get_stats_count(struct net_device *dev) 199static int ehea_get_sset_count(struct net_device *dev, int sset)
200{ 200{
201 return ARRAY_SIZE(ehea_ethtool_stats_keys); 201 switch (sset) {
202 case ETH_SS_STATS:
203 return ARRAY_SIZE(ehea_ethtool_stats_keys);
204 default:
205 return -EOPNOTSUPP;
206 }
202} 207}
203 208
204static void ehea_get_ethtool_stats(struct net_device *dev, 209static void ehea_get_ethtool_stats(struct net_device *dev,
@@ -207,7 +212,7 @@ static void ehea_get_ethtool_stats(struct net_device *dev,
207 int i, k, tmp; 212 int i, k, tmp;
208 struct ehea_port *port = netdev_priv(dev); 213 struct ehea_port *port = netdev_priv(dev);
209 214
210 for (i = 0; i < ehea_get_stats_count(dev); i++) 215 for (i = 0; i < ehea_get_sset_count(dev, ETH_SS_STATS); i++)
211 data[i] = 0; 216 data[i] = 0;
212 i = 0; 217 i = 0;
213 218
@@ -264,7 +269,7 @@ const struct ethtool_ops ehea_ethtool_ops = {
264 .get_link = ethtool_op_get_link, 269 .get_link = ethtool_op_get_link,
265 .set_tso = ethtool_op_set_tso, 270 .set_tso = ethtool_op_set_tso,
266 .get_strings = ehea_get_strings, 271 .get_strings = ehea_get_strings,
267 .get_stats_count = ehea_get_stats_count, 272 .get_sset_count = ehea_get_sset_count,
268 .get_ethtool_stats = ehea_get_ethtool_stats, 273 .get_ethtool_stats = ehea_get_ethtool_stats,
269 .get_rx_csum = ehea_get_rx_csum, 274 .get_rx_csum = ehea_get_rx_csum,
270 .set_settings = ehea_set_settings, 275 .set_settings = ehea_set_settings,
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index f7354bc9b009..666de42e5a76 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -4333,16 +4333,26 @@ static int nv_set_sg(struct net_device *dev, u32 data)
4333 return -EOPNOTSUPP; 4333 return -EOPNOTSUPP;
4334} 4334}
4335 4335
4336static int nv_get_stats_count(struct net_device *dev) 4336static int nv_get_sset_count(struct net_device *dev, int sset)
4337{ 4337{
4338 struct fe_priv *np = netdev_priv(dev); 4338 struct fe_priv *np = netdev_priv(dev);
4339 4339
4340 if (np->driver_data & DEV_HAS_STATISTICS_V1) 4340 switch (sset) {
4341 return NV_DEV_STATISTICS_V1_COUNT; 4341 case ETH_SS_TEST:
4342 else if (np->driver_data & DEV_HAS_STATISTICS_V2) 4342 if (np->driver_data & DEV_HAS_TEST_EXTENDED)
4343 return NV_DEV_STATISTICS_V2_COUNT; 4343 return NV_TEST_COUNT_EXTENDED;
4344 else 4344 else
4345 return 0; 4345 return NV_TEST_COUNT_BASE;
4346 case ETH_SS_STATS:
4347 if (np->driver_data & DEV_HAS_STATISTICS_V1)
4348 return NV_DEV_STATISTICS_V1_COUNT;
4349 else if (np->driver_data & DEV_HAS_STATISTICS_V2)
4350 return NV_DEV_STATISTICS_V2_COUNT;
4351 else
4352 return 0;
4353 default:
4354 return -EOPNOTSUPP;
4355 }
4346} 4356}
4347 4357
4348static void nv_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *estats, u64 *buffer) 4358static void nv_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *estats, u64 *buffer)
@@ -4352,17 +4362,7 @@ static void nv_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *e
4352 /* update stats */ 4362 /* update stats */
4353 nv_do_stats_poll((unsigned long)dev); 4363 nv_do_stats_poll((unsigned long)dev);
4354 4364
4355 memcpy(buffer, &np->estats, nv_get_stats_count(dev)*sizeof(u64)); 4365 memcpy(buffer, &np->estats, nv_get_sset_count(dev, ETH_SS_STATS)*sizeof(u64));
4356}
4357
4358static int nv_self_test_count(struct net_device *dev)
4359{
4360 struct fe_priv *np = netdev_priv(dev);
4361
4362 if (np->driver_data & DEV_HAS_TEST_EXTENDED)
4363 return NV_TEST_COUNT_EXTENDED;
4364 else
4365 return NV_TEST_COUNT_BASE;
4366} 4366}
4367 4367
4368static int nv_link_test(struct net_device *dev) 4368static int nv_link_test(struct net_device *dev)
@@ -4609,7 +4609,7 @@ static void nv_self_test(struct net_device *dev, struct ethtool_test *test, u64
4609 struct fe_priv *np = netdev_priv(dev); 4609 struct fe_priv *np = netdev_priv(dev);
4610 u8 __iomem *base = get_hwbase(dev); 4610 u8 __iomem *base = get_hwbase(dev);
4611 int result; 4611 int result;
4612 memset(buffer, 0, nv_self_test_count(dev)*sizeof(u64)); 4612 memset(buffer, 0, nv_get_sset_count(dev, ETH_SS_TEST)*sizeof(u64));
4613 4613
4614 if (!nv_link_test(dev)) { 4614 if (!nv_link_test(dev)) {
4615 test->flags |= ETH_TEST_FL_FAILED; 4615 test->flags |= ETH_TEST_FL_FAILED;
@@ -4692,10 +4692,10 @@ static void nv_get_strings(struct net_device *dev, u32 stringset, u8 *buffer)
4692{ 4692{
4693 switch (stringset) { 4693 switch (stringset) {
4694 case ETH_SS_STATS: 4694 case ETH_SS_STATS:
4695 memcpy(buffer, &nv_estats_str, nv_get_stats_count(dev)*sizeof(struct nv_ethtool_str)); 4695 memcpy(buffer, &nv_estats_str, nv_get_sset_count(dev, ETH_SS_STATS)*sizeof(struct nv_ethtool_str));
4696 break; 4696 break;
4697 case ETH_SS_TEST: 4697 case ETH_SS_TEST:
4698 memcpy(buffer, &nv_etests_str, nv_self_test_count(dev)*sizeof(struct nv_ethtool_str)); 4698 memcpy(buffer, &nv_etests_str, nv_get_sset_count(dev, ETH_SS_TEST)*sizeof(struct nv_ethtool_str));
4699 break; 4699 break;
4700 } 4700 }
4701} 4701}
@@ -4720,9 +4720,8 @@ static const struct ethtool_ops ops = {
4720 .set_tx_csum = nv_set_tx_csum, 4720 .set_tx_csum = nv_set_tx_csum,
4721 .set_sg = nv_set_sg, 4721 .set_sg = nv_set_sg,
4722 .get_strings = nv_get_strings, 4722 .get_strings = nv_get_strings,
4723 .get_stats_count = nv_get_stats_count,
4724 .get_ethtool_stats = nv_get_ethtool_stats, 4723 .get_ethtool_stats = nv_get_ethtool_stats,
4725 .self_test_count = nv_self_test_count, 4724 .get_sset_count = nv_get_sset_count,
4726 .self_test = nv_self_test, 4725 .self_test = nv_self_test,
4727}; 4726};
4728 4727
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index 2470903fbc74..6007147cc1e9 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -152,15 +152,19 @@ static void gfar_fill_stats(struct net_device *dev, struct ethtool_stats *dummy,
152 buf[i] = extra[i]; 152 buf[i] = extra[i];
153} 153}
154 154
155/* Returns the number of stats (and their corresponding strings) */ 155static int gfar_sset_count(struct net_device *dev, int sset)
156static int gfar_stats_count(struct net_device *dev)
157{ 156{
158 struct gfar_private *priv = netdev_priv(dev); 157 struct gfar_private *priv = netdev_priv(dev);
159 158
160 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON) 159 switch (sset) {
161 return GFAR_STATS_LEN; 160 case ETH_SS_STATS:
162 else 161 if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_RMON)
163 return GFAR_EXTRA_STATS_LEN; 162 return GFAR_STATS_LEN;
163 else
164 return GFAR_EXTRA_STATS_LEN;
165 default:
166 return -EOPNOTSUPP;
167 }
164} 168}
165 169
166/* Fills in the drvinfo structure with some basic info */ 170/* Fills in the drvinfo structure with some basic info */
@@ -171,8 +175,6 @@ static void gfar_gdrvinfo(struct net_device *dev, struct
171 strncpy(drvinfo->version, gfar_driver_version, GFAR_INFOSTR_LEN); 175 strncpy(drvinfo->version, gfar_driver_version, GFAR_INFOSTR_LEN);
172 strncpy(drvinfo->fw_version, "N/A", GFAR_INFOSTR_LEN); 176 strncpy(drvinfo->fw_version, "N/A", GFAR_INFOSTR_LEN);
173 strncpy(drvinfo->bus_info, "N/A", GFAR_INFOSTR_LEN); 177 strncpy(drvinfo->bus_info, "N/A", GFAR_INFOSTR_LEN);
174 drvinfo->n_stats = GFAR_STATS_LEN;
175 drvinfo->testinfo_len = 0;
176 drvinfo->regdump_len = 0; 178 drvinfo->regdump_len = 0;
177 drvinfo->eedump_len = 0; 179 drvinfo->eedump_len = 0;
178} 180}
@@ -575,7 +577,7 @@ const struct ethtool_ops gfar_ethtool_ops = {
575 .get_ringparam = gfar_gringparam, 577 .get_ringparam = gfar_gringparam,
576 .set_ringparam = gfar_sringparam, 578 .set_ringparam = gfar_sringparam,
577 .get_strings = gfar_gstrings, 579 .get_strings = gfar_gstrings,
578 .get_stats_count = gfar_stats_count, 580 .get_sset_count = gfar_sset_count,
579 .get_ethtool_stats = gfar_fill_stats, 581 .get_ethtool_stats = gfar_fill_stats,
580 .get_rx_csum = gfar_get_rx_csum, 582 .get_rx_csum = gfar_get_rx_csum,
581 .get_tx_csum = gfar_get_tx_csum, 583 .get_tx_csum = gfar_get_tx_csum,
diff --git a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c
index 7d4fa7644e4b..73664f226f32 100644
--- a/drivers/net/ibm_emac/ibm_emac_core.c
+++ b/drivers/net/ibm_emac/ibm_emac_core.c
@@ -1842,9 +1842,14 @@ static int emac_ethtool_nway_reset(struct net_device *ndev)
1842 return res; 1842 return res;
1843} 1843}
1844 1844
1845static int emac_ethtool_get_stats_count(struct net_device *ndev) 1845static int emac_get_sset_count(struct net_device *ndev, int sset)
1846{ 1846{
1847 return EMAC_ETHTOOL_STATS_COUNT; 1847 switch (sset) {
1848 case ETH_SS_STATS:
1849 return EMAC_ETHTOOL_STATS_COUNT;
1850 default:
1851 return -EOPNOTSUPP;
1852 }
1848} 1853}
1849 1854
1850static void emac_ethtool_get_strings(struct net_device *ndev, u32 stringset, 1855static void emac_ethtool_get_strings(struct net_device *ndev, u32 stringset,
@@ -1875,7 +1880,6 @@ static void emac_ethtool_get_drvinfo(struct net_device *ndev,
1875 strcpy(info->version, DRV_VERSION); 1880 strcpy(info->version, DRV_VERSION);
1876 info->fw_version[0] = '\0'; 1881 info->fw_version[0] = '\0';
1877 sprintf(info->bus_info, "PPC 4xx EMAC %d", dev->def->index); 1882 sprintf(info->bus_info, "PPC 4xx EMAC %d", dev->def->index);
1878 info->n_stats = emac_ethtool_get_stats_count(ndev);
1879 info->regdump_len = emac_ethtool_get_regs_len(ndev); 1883 info->regdump_len = emac_ethtool_get_regs_len(ndev);
1880} 1884}
1881 1885
@@ -1895,7 +1899,7 @@ static const struct ethtool_ops emac_ethtool_ops = {
1895 .get_rx_csum = emac_ethtool_get_rx_csum, 1899 .get_rx_csum = emac_ethtool_get_rx_csum,
1896 1900
1897 .get_strings = emac_ethtool_get_strings, 1901 .get_strings = emac_ethtool_get_strings,
1898 .get_stats_count = emac_ethtool_get_stats_count, 1902 .get_sset_count = emac_get_sset_count,
1899 .get_ethtool_stats = emac_ethtool_get_ethtool_stats, 1903 .get_ethtool_stats = emac_ethtool_get_ethtool_stats,
1900 1904
1901 .get_link = ethtool_op_get_link, 1905 .get_link = ethtool_op_get_link,
diff --git a/drivers/net/ibmveth.c b/drivers/net/ibmveth.c
index 228973484ed8..4ac161e1ca12 100644
--- a/drivers/net/ibmveth.c
+++ b/drivers/net/ibmveth.c
@@ -802,9 +802,14 @@ static void ibmveth_get_strings(struct net_device *dev, u32 stringset, u8 *data)
802 memcpy(data, ibmveth_stats[i].name, ETH_GSTRING_LEN); 802 memcpy(data, ibmveth_stats[i].name, ETH_GSTRING_LEN);
803} 803}
804 804
805static int ibmveth_get_stats_count(struct net_device *dev) 805static int ibmveth_get_sset_count(struct net_device *dev, int sset)
806{ 806{
807 return ARRAY_SIZE(ibmveth_stats); 807 switch (sset) {
808 case ETH_SS_STATS:
809 return ARRAY_SIZE(ibmveth_stats);
810 default:
811 return -EOPNOTSUPP;
812 }
808} 813}
809 814
810static void ibmveth_get_ethtool_stats(struct net_device *dev, 815static void ibmveth_get_ethtool_stats(struct net_device *dev,
@@ -825,7 +830,7 @@ static const struct ethtool_ops netdev_ethtool_ops = {
825 .get_rx_csum = ibmveth_get_rx_csum, 830 .get_rx_csum = ibmveth_get_rx_csum,
826 .set_rx_csum = ibmveth_set_rx_csum, 831 .set_rx_csum = ibmveth_set_rx_csum,
827 .get_strings = ibmveth_get_strings, 832 .get_strings = ibmveth_get_strings,
828 .get_stats_count = ibmveth_get_stats_count, 833 .get_sset_count = ibmveth_get_sset_count,
829 .get_ethtool_stats = ibmveth_get_ethtool_stats, 834 .get_ethtool_stats = ibmveth_get_ethtool_stats,
830}; 835};
831 836
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index 181b59dc1ac3..ddad26bb5c58 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -659,9 +659,14 @@ ixgb_phys_id(struct net_device *netdev, uint32_t data)
659} 659}
660 660
661static int 661static int
662ixgb_get_stats_count(struct net_device *netdev) 662ixgb_get_sset_count(struct net_device *netdev, int sset)
663{ 663{
664 return IXGB_STATS_LEN; 664 switch (sset) {
665 case ETH_SS_STATS:
666 return IXGB_STATS_LEN;
667 default:
668 return -EOPNOTSUPP;
669 }
665} 670}
666 671
667static void 672static void
@@ -719,7 +724,7 @@ static const struct ethtool_ops ixgb_ethtool_ops = {
719 .set_tso = ixgb_set_tso, 724 .set_tso = ixgb_set_tso,
720 .get_strings = ixgb_get_strings, 725 .get_strings = ixgb_get_strings,
721 .phys_id = ixgb_phys_id, 726 .phys_id = ixgb_phys_id,
722 .get_stats_count = ixgb_get_stats_count, 727 .get_sset_count = ixgb_get_sset_count,
723 .get_ethtool_stats = ixgb_get_ethtool_stats, 728 .get_ethtool_stats = ixgb_get_ethtool_stats,
724}; 729};
725 730
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index 43a2a46e2874..a4e576a0c543 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -737,9 +737,14 @@ err_setup:
737 return err; 737 return err;
738} 738}
739 739
740static int ixgbe_get_stats_count(struct net_device *netdev) 740static int ixgbe_get_sset_count(struct net_device *netdev, int sset)
741{ 741{
742 return IXGBE_STATS_LEN; 742 switch (sset) {
743 case ETH_SS_STATS:
744 return IXGBE_STATS_LEN;
745 default:
746 return -EOPNOTSUPP;
747 }
743} 748}
744 749
745static void ixgbe_get_ethtool_stats(struct net_device *netdev, 750static void ixgbe_get_ethtool_stats(struct net_device *netdev,
@@ -931,7 +936,7 @@ static struct ethtool_ops ixgbe_ethtool_ops = {
931 .set_tso = ixgbe_set_tso, 936 .set_tso = ixgbe_set_tso,
932 .get_strings = ixgbe_get_strings, 937 .get_strings = ixgbe_get_strings,
933 .phys_id = ixgbe_phys_id, 938 .phys_id = ixgbe_phys_id,
934 .get_stats_count = ixgbe_get_stats_count, 939 .get_sset_count = ixgbe_get_sset_count,
935 .get_ethtool_stats = ixgbe_get_ethtool_stats, 940 .get_ethtool_stats = ixgbe_get_ethtool_stats,
936 .get_coalesce = ixgbe_get_coalesce, 941 .get_coalesce = ixgbe_get_coalesce,
937 .set_coalesce = ixgbe_set_coalesce, 942 .set_coalesce = ixgbe_set_coalesce,
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index e379165d8375..b33d21f4efff 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -2674,9 +2674,14 @@ static void mv643xx_get_drvinfo(struct net_device *netdev,
2674 drvinfo->n_stats = MV643XX_STATS_LEN; 2674 drvinfo->n_stats = MV643XX_STATS_LEN;
2675} 2675}
2676 2676
2677static int mv643xx_get_stats_count(struct net_device *netdev) 2677static int mv643xx_get_sset_count(struct net_device *netdev, int sset)
2678{ 2678{
2679 return MV643XX_STATS_LEN; 2679 switch (sset) {
2680 case ETH_SS_STATS:
2681 return MV643XX_STATS_LEN;
2682 default:
2683 return -EOPNOTSUPP;
2684 }
2680} 2685}
2681 2686
2682static void mv643xx_get_ethtool_stats(struct net_device *netdev, 2687static void mv643xx_get_ethtool_stats(struct net_device *netdev,
@@ -2737,7 +2742,6 @@ static const struct ethtool_ops mv643xx_ethtool_ops = {
2737 .get_drvinfo = mv643xx_get_drvinfo, 2742 .get_drvinfo = mv643xx_get_drvinfo,
2738 .get_link = mv643xx_eth_get_link, 2743 .get_link = mv643xx_eth_get_link,
2739 .set_sg = ethtool_op_set_sg, 2744 .set_sg = ethtool_op_set_sg,
2740 .get_stats_count = mv643xx_get_stats_count,
2741 .get_ethtool_stats = mv643xx_get_ethtool_stats, 2745 .get_ethtool_stats = mv643xx_get_ethtool_stats,
2742 .get_strings = mv643xx_get_strings, 2746 .get_strings = mv643xx_get_strings,
2743 .nway_reset = mv643xx_eth_nway_restart, 2747 .nway_reset = mv643xx_eth_nway_restart,
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 38b03f538e95..e8afa101433e 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -1418,9 +1418,14 @@ myri10ge_get_strings(struct net_device *netdev, u32 stringset, u8 * data)
1418 } 1418 }
1419} 1419}
1420 1420
1421static int myri10ge_get_stats_count(struct net_device *netdev) 1421static int myri10ge_get_sset_count(struct net_device *netdev, int sset)
1422{ 1422{
1423 return MYRI10GE_STATS_LEN; 1423 switch (sset) {
1424 case ETH_SS_STATS:
1425 return MYRI10GE_STATS_LEN;
1426 default:
1427 return -EOPNOTSUPP;
1428 }
1424} 1429}
1425 1430
1426static void 1431static void
@@ -1504,7 +1509,7 @@ static const struct ethtool_ops myri10ge_ethtool_ops = {
1504 .set_tso = ethtool_op_set_tso, 1509 .set_tso = ethtool_op_set_tso,
1505 .get_link = ethtool_op_get_link, 1510 .get_link = ethtool_op_get_link,
1506 .get_strings = myri10ge_get_strings, 1511 .get_strings = myri10ge_get_strings,
1507 .get_stats_count = myri10ge_get_stats_count, 1512 .get_sset_count = myri10ge_get_sset_count,
1508 .get_ethtool_stats = myri10ge_get_ethtool_stats, 1513 .get_ethtool_stats = myri10ge_get_ethtool_stats,
1509 .set_msglevel = myri10ge_set_msglevel, 1514 .set_msglevel = myri10ge_set_msglevel,
1510 .get_msglevel = myri10ge_get_msglevel 1515 .get_msglevel = myri10ge_get_msglevel
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index 08c76b343663..78e42316e70f 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -115,8 +115,6 @@ netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo)
115 sprintf(drvinfo->fw_version, "%d.%d.%d", fw_major, fw_minor, fw_build); 115 sprintf(drvinfo->fw_version, "%d.%d.%d", fw_major, fw_minor, fw_build);
116 116
117 strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); 117 strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32);
118 drvinfo->n_stats = NETXEN_NIC_STATS_LEN;
119 drvinfo->testinfo_len = NETXEN_NIC_TEST_LEN;
120 drvinfo->regdump_len = NETXEN_NIC_REGS_LEN; 118 drvinfo->regdump_len = NETXEN_NIC_REGS_LEN;
121 drvinfo->eedump_len = netxen_nic_get_eeprom_len(dev); 119 drvinfo->eedump_len = netxen_nic_get_eeprom_len(dev);
122} 120}
@@ -672,9 +670,16 @@ static int netxen_nic_reg_test(struct net_device *dev)
672 return 0; 670 return 0;
673} 671}
674 672
675static int netxen_nic_diag_test_count(struct net_device *dev) 673static int netxen_get_sset_count(struct net_device *dev, int sset)
676{ 674{
677 return NETXEN_NIC_TEST_LEN; 675 switch (sset) {
676 case ETH_SS_TEST:
677 return NETXEN_NIC_TEST_LEN;
678 case ETH_SS_STATS:
679 return NETXEN_NIC_STATS_LEN;
680 default:
681 return -EOPNOTSUPP;
682 }
678} 683}
679 684
680static void 685static void
@@ -709,11 +714,6 @@ netxen_nic_get_strings(struct net_device *dev, u32 stringset, u8 * data)
709 } 714 }
710} 715}
711 716
712static int netxen_nic_get_stats_count(struct net_device *dev)
713{
714 return NETXEN_NIC_STATS_LEN;
715}
716
717static void 717static void
718netxen_nic_get_ethtool_stats(struct net_device *dev, 718netxen_nic_get_ethtool_stats(struct net_device *dev,
719 struct ethtool_stats *stats, u64 * data) 719 struct ethtool_stats *stats, u64 * data)
@@ -747,9 +747,8 @@ struct ethtool_ops netxen_nic_ethtool_ops = {
747 .set_tx_csum = ethtool_op_set_tx_csum, 747 .set_tx_csum = ethtool_op_set_tx_csum,
748 .set_sg = ethtool_op_set_sg, 748 .set_sg = ethtool_op_set_sg,
749 .set_tso = ethtool_op_set_tso, 749 .set_tso = ethtool_op_set_tso,
750 .self_test_count = netxen_nic_diag_test_count,
751 .self_test = netxen_nic_diag_test, 750 .self_test = netxen_nic_diag_test,
752 .get_strings = netxen_nic_get_strings, 751 .get_strings = netxen_nic_get_strings,
753 .get_stats_count = netxen_nic_get_stats_count,
754 .get_ethtool_stats = netxen_nic_get_ethtool_stats, 752 .get_ethtool_stats = netxen_nic_get_ethtool_stats,
753 .get_sset_count = netxen_get_sset_count,
755}; 754};
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index 4840ddea71ac..36f92dd55508 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -847,9 +847,14 @@ static void pcnet32_get_strings(struct net_device *dev, u32 stringset,
847 memcpy(data, pcnet32_gstrings_test, sizeof(pcnet32_gstrings_test)); 847 memcpy(data, pcnet32_gstrings_test, sizeof(pcnet32_gstrings_test));
848} 848}
849 849
850static int pcnet32_self_test_count(struct net_device *dev) 850static int pcnet32_get_sset_count(struct net_device *dev, int sset)
851{ 851{
852 return PCNET32_TEST_LEN; 852 switch (sset) {
853 case ETH_SS_TEST:
854 return PCNET32_TEST_LEN;
855 default:
856 return -EOPNOTSUPP;
857 }
853} 858}
854 859
855static void pcnet32_ethtool_test(struct net_device *dev, 860static void pcnet32_ethtool_test(struct net_device *dev,
@@ -1510,11 +1515,11 @@ static const struct ethtool_ops pcnet32_ethtool_ops = {
1510 .get_ringparam = pcnet32_get_ringparam, 1515 .get_ringparam = pcnet32_get_ringparam,
1511 .set_ringparam = pcnet32_set_ringparam, 1516 .set_ringparam = pcnet32_set_ringparam,
1512 .get_strings = pcnet32_get_strings, 1517 .get_strings = pcnet32_get_strings,
1513 .self_test_count = pcnet32_self_test_count,
1514 .self_test = pcnet32_ethtool_test, 1518 .self_test = pcnet32_ethtool_test,
1515 .phys_id = pcnet32_phys_id, 1519 .phys_id = pcnet32_phys_id,
1516 .get_regs_len = pcnet32_get_regs_len, 1520 .get_regs_len = pcnet32_get_regs_len,
1517 .get_regs = pcnet32_get_regs, 1521 .get_regs = pcnet32_get_regs,
1522 .get_sset_count = pcnet32_get_sset_count,
1518}; 1523};
1519 1524
1520/* only probes for non-PCI devices, the rest are handled by 1525/* only probes for non-PCI devices, the rest are handled by
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index ed79aa820df2..48069ece4e51 100755
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -1865,8 +1865,6 @@ static void ql_get_drvinfo(struct net_device *ndev,
1865 strncpy(drvinfo->version, ql3xxx_driver_version, 32); 1865 strncpy(drvinfo->version, ql3xxx_driver_version, 32);
1866 strncpy(drvinfo->fw_version, "N/A", 32); 1866 strncpy(drvinfo->fw_version, "N/A", 32);
1867 strncpy(drvinfo->bus_info, pci_name(qdev->pdev), 32); 1867 strncpy(drvinfo->bus_info, pci_name(qdev->pdev), 32);
1868 drvinfo->n_stats = 0;
1869 drvinfo->testinfo_len = 0;
1870 drvinfo->regdump_len = 0; 1868 drvinfo->regdump_len = 0;
1871 drvinfo->eedump_len = 0; 1869 drvinfo->eedump_len = 0;
1872} 1870}
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 06a1a6f2d17b..eecd811feead 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -992,9 +992,14 @@ struct rtl8169_counters {
992 u16 tx_underun; 992 u16 tx_underun;
993}; 993};
994 994
995static int rtl8169_get_stats_count(struct net_device *dev) 995static int rtl8169_get_sset_count(struct net_device *dev, int sset)
996{ 996{
997 return ARRAY_SIZE(rtl8169_gstrings); 997 switch (sset) {
998 case ETH_SS_STATS:
999 return ARRAY_SIZE(rtl8169_gstrings);
1000 default:
1001 return -EOPNOTSUPP;
1002 }
998} 1003}
999 1004
1000static void rtl8169_get_ethtool_stats(struct net_device *dev, 1005static void rtl8169_get_ethtool_stats(struct net_device *dev,
@@ -1068,7 +1073,7 @@ static const struct ethtool_ops rtl8169_ethtool_ops = {
1068 .get_wol = rtl8169_get_wol, 1073 .get_wol = rtl8169_get_wol,
1069 .set_wol = rtl8169_set_wol, 1074 .set_wol = rtl8169_set_wol,
1070 .get_strings = rtl8169_get_strings, 1075 .get_strings = rtl8169_get_strings,
1071 .get_stats_count = rtl8169_get_stats_count, 1076 .get_sset_count = rtl8169_get_sset_count,
1072 .get_ethtool_stats = rtl8169_get_ethtool_stats, 1077 .get_ethtool_stats = rtl8169_get_ethtool_stats,
1073}; 1078};
1074 1079
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 26895de3e264..7f6b0e611e3b 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -5040,12 +5040,6 @@ static void s2io_ethtool_gdrvinfo(struct net_device *dev,
5040 strncpy(info->bus_info, pci_name(sp->pdev), sizeof(info->bus_info)); 5040 strncpy(info->bus_info, pci_name(sp->pdev), sizeof(info->bus_info));
5041 info->regdump_len = XENA_REG_SPACE; 5041 info->regdump_len = XENA_REG_SPACE;
5042 info->eedump_len = XENA_EEPROM_SPACE; 5042 info->eedump_len = XENA_EEPROM_SPACE;
5043 info->testinfo_len = S2IO_TEST_LEN;
5044
5045 if (sp->device_type == XFRAME_I_DEVICE)
5046 info->n_stats = XFRAME_I_STAT_LEN;
5047 else
5048 info->n_stats = XFRAME_II_STAT_LEN;
5049} 5043}
5050 5044
5051/** 5045/**
@@ -6241,9 +6235,25 @@ static int s2io_get_eeprom_len(struct net_device *dev)
6241 return (XENA_EEPROM_SPACE); 6235 return (XENA_EEPROM_SPACE);
6242} 6236}
6243 6237
6244static int s2io_ethtool_self_test_count(struct net_device *dev) 6238static int s2io_get_sset_count(struct net_device *dev, int sset)
6245{ 6239{
6246 return (S2IO_TEST_LEN); 6240 struct s2io_nic *sp = dev->priv;
6241
6242 switch (sset) {
6243 case ETH_SS_TEST:
6244 return S2IO_TEST_LEN;
6245 case ETH_SS_STATS:
6246 switch(sp->device_type) {
6247 case XFRAME_I_DEVICE:
6248 return XFRAME_I_STAT_LEN;
6249 case XFRAME_II_DEVICE:
6250 return XFRAME_II_STAT_LEN;
6251 default:
6252 return 0;
6253 }
6254 default:
6255 return -EOPNOTSUPP;
6256 }
6247} 6257}
6248 6258
6249static void s2io_ethtool_get_strings(struct net_device *dev, 6259static void s2io_ethtool_get_strings(struct net_device *dev,
@@ -6270,22 +6280,6 @@ static void s2io_ethtool_get_strings(struct net_device *dev,
6270 sizeof(ethtool_driver_stats_keys)); 6280 sizeof(ethtool_driver_stats_keys));
6271 } 6281 }
6272} 6282}
6273static int s2io_ethtool_get_stats_count(struct net_device *dev)
6274{
6275 struct s2io_nic *sp = dev->priv;
6276 int stat_count = 0;
6277 switch(sp->device_type) {
6278 case XFRAME_I_DEVICE:
6279 stat_count = XFRAME_I_STAT_LEN;
6280 break;
6281
6282 case XFRAME_II_DEVICE:
6283 stat_count = XFRAME_II_STAT_LEN;
6284 break;
6285 }
6286
6287 return stat_count;
6288}
6289 6283
6290static int s2io_ethtool_op_set_tx_csum(struct net_device *dev, u32 data) 6284static int s2io_ethtool_op_set_tx_csum(struct net_device *dev, u32 data)
6291{ 6285{
@@ -6331,12 +6325,11 @@ static const struct ethtool_ops netdev_ethtool_ops = {
6331 .get_tso = s2io_ethtool_op_get_tso, 6325 .get_tso = s2io_ethtool_op_get_tso,
6332 .set_tso = s2io_ethtool_op_set_tso, 6326 .set_tso = s2io_ethtool_op_set_tso,
6333 .set_ufo = ethtool_op_set_ufo, 6327 .set_ufo = ethtool_op_set_ufo,
6334 .self_test_count = s2io_ethtool_self_test_count,
6335 .self_test = s2io_ethtool_test, 6328 .self_test = s2io_ethtool_test,
6336 .get_strings = s2io_ethtool_get_strings, 6329 .get_strings = s2io_ethtool_get_strings,
6337 .phys_id = s2io_ethtool_idnic, 6330 .phys_id = s2io_ethtool_idnic,
6338 .get_stats_count = s2io_ethtool_get_stats_count, 6331 .get_ethtool_stats = s2io_get_ethtool_stats,
6339 .get_ethtool_stats = s2io_get_ethtool_stats 6332 .get_sset_count = s2io_get_sset_count,
6340}; 6333};
6341 6334
6342/** 6335/**
diff --git a/drivers/net/sc92031.c b/drivers/net/sc92031.c
index 02c472ecbe55..37b42394560d 100644
--- a/drivers/net/sc92031.c
+++ b/drivers/net/sc92031.c
@@ -1372,9 +1372,14 @@ static void sc92031_ethtool_get_strings(struct net_device *dev,
1372 SILAN_STATS_NUM * ETH_GSTRING_LEN); 1372 SILAN_STATS_NUM * ETH_GSTRING_LEN);
1373} 1373}
1374 1374
1375static int sc92031_ethtool_get_stats_count(struct net_device *dev) 1375static int sc92031_ethtool_get_sset_count(struct net_device *dev, int sset)
1376{ 1376{
1377 return SILAN_STATS_NUM; 1377 switch (sset) {
1378 case ETH_SS_STATS:
1379 return SILAN_STATS_NUM;
1380 default:
1381 return -EOPNOTSUPP;
1382 }
1378} 1383}
1379 1384
1380static void sc92031_ethtool_get_ethtool_stats(struct net_device *dev, 1385static void sc92031_ethtool_get_ethtool_stats(struct net_device *dev,
@@ -1397,7 +1402,7 @@ static struct ethtool_ops sc92031_ethtool_ops = {
1397 .nway_reset = sc92031_ethtool_nway_reset, 1402 .nway_reset = sc92031_ethtool_nway_reset,
1398 .get_link = ethtool_op_get_link, 1403 .get_link = ethtool_op_get_link,
1399 .get_strings = sc92031_ethtool_get_strings, 1404 .get_strings = sc92031_ethtool_get_strings,
1400 .get_stats_count = sc92031_ethtool_get_stats_count, 1405 .get_sset_count = sc92031_ethtool_get_sset_count,
1401 .get_ethtool_stats = sc92031_ethtool_get_ethtool_stats, 1406 .get_ethtool_stats = sc92031_ethtool_get_ethtool_stats,
1402}; 1407};
1403 1408
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index ec1acfddf350..2aae9fe38c5a 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -410,9 +410,14 @@ static const struct skge_stat {
410 { "rx_fcs_error", XM_RXF_FCS_ERR, GM_RXF_FCS_ERR }, 410 { "rx_fcs_error", XM_RXF_FCS_ERR, GM_RXF_FCS_ERR },
411}; 411};
412 412
413static int skge_get_stats_count(struct net_device *dev) 413static int skge_get_sset_count(struct net_device *dev, int sset)
414{ 414{
415 return ARRAY_SIZE(skge_stats); 415 switch (sset) {
416 case ETH_SS_STATS:
417 return ARRAY_SIZE(skge_stats);
418 default:
419 return -EOPNOTSUPP;
420 }
416} 421}
417 422
418static void skge_get_ethtool_stats(struct net_device *dev, 423static void skge_get_ethtool_stats(struct net_device *dev,
@@ -817,7 +822,7 @@ static const struct ethtool_ops skge_ethtool_ops = {
817 .set_rx_csum = skge_set_rx_csum, 822 .set_rx_csum = skge_set_rx_csum,
818 .get_strings = skge_get_strings, 823 .get_strings = skge_get_strings,
819 .phys_id = skge_phys_id, 824 .phys_id = skge_phys_id,
820 .get_stats_count = skge_get_stats_count, 825 .get_sset_count = skge_get_sset_count,
821 .get_ethtool_stats = skge_get_ethtool_stats, 826 .get_ethtool_stats = skge_get_ethtool_stats,
822}; 827};
823 828
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index a70bcbcf8a16..fe0e7560d236 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -3190,9 +3190,14 @@ static void sky2_set_msglevel(struct net_device *netdev, u32 value)
3190 sky2->msg_enable = value; 3190 sky2->msg_enable = value;
3191} 3191}
3192 3192
3193static int sky2_get_stats_count(struct net_device *dev) 3193static int sky2_get_sset_count(struct net_device *dev, int sset)
3194{ 3194{
3195 return ARRAY_SIZE(sky2_stats); 3195 switch (sset) {
3196 case ETH_SS_STATS:
3197 return ARRAY_SIZE(sky2_stats);
3198 default:
3199 return -EOPNOTSUPP;
3200 }
3196} 3201}
3197 3202
3198static void sky2_get_ethtool_stats(struct net_device *dev, 3203static void sky2_get_ethtool_stats(struct net_device *dev,
@@ -3723,7 +3728,7 @@ static const struct ethtool_ops sky2_ethtool_ops = {
3723 .get_pauseparam = sky2_get_pauseparam, 3728 .get_pauseparam = sky2_get_pauseparam,
3724 .set_pauseparam = sky2_set_pauseparam, 3729 .set_pauseparam = sky2_set_pauseparam,
3725 .phys_id = sky2_phys_id, 3730 .phys_id = sky2_phys_id,
3726 .get_stats_count = sky2_get_stats_count, 3731 .get_sset_count = sky2_get_sset_count,
3727 .get_ethtool_stats = sky2_get_ethtool_stats, 3732 .get_ethtool_stats = sky2_get_ethtool_stats,
3728}; 3733};
3729 3734
diff --git a/drivers/net/spider_net_ethtool.c b/drivers/net/spider_net_ethtool.c
index 1460d5006d1c..94273037102f 100644
--- a/drivers/net/spider_net_ethtool.c
+++ b/drivers/net/spider_net_ethtool.c
@@ -147,9 +147,14 @@ spider_net_ethtool_get_ringparam(struct net_device *netdev,
147 ering->rx_pending = card->rx_chain.num_desc; 147 ering->rx_pending = card->rx_chain.num_desc;
148} 148}
149 149
150static int spider_net_get_stats_count(struct net_device *netdev) 150static int spider_net_get_sset_count(struct net_device *netdev, int sset)
151{ 151{
152 return SPIDER_NET_NUM_STATS; 152 switch (sset) {
153 case ETH_SS_STATS:
154 return SPIDER_NET_NUM_STATS;
155 default:
156 return -EOPNOTSUPP;
157 }
153} 158}
154 159
155static void spider_net_get_ethtool_stats(struct net_device *netdev, 160static void spider_net_get_ethtool_stats(struct net_device *netdev,
@@ -191,7 +196,7 @@ const struct ethtool_ops spider_net_ethtool_ops = {
191 .set_tx_csum = ethtool_op_set_tx_csum, 196 .set_tx_csum = ethtool_op_set_tx_csum,
192 .get_ringparam = spider_net_ethtool_get_ringparam, 197 .get_ringparam = spider_net_ethtool_get_ringparam,
193 .get_strings = spider_net_get_strings, 198 .get_strings = spider_net_get_strings,
194 .get_stats_count = spider_net_get_stats_count, 199 .get_sset_count = spider_net_get_sset_count,
195 .get_ethtool_stats = spider_net_get_ethtool_stats, 200 .get_ethtool_stats = spider_net_get_ethtool_stats,
196}; 201};
197 202
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index df8237360f58..a679f4310ce1 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -2162,10 +2162,16 @@ static void tc35815_set_msglevel(struct net_device *dev, u32 datum)
2162 lp->msg_enable = datum; 2162 lp->msg_enable = datum;
2163} 2163}
2164 2164
2165static int tc35815_get_stats_count(struct net_device *dev) 2165static int tc35815_get_sset_count(struct net_device *dev, int sset)
2166{ 2166{
2167 struct tc35815_local *lp = dev->priv; 2167 struct tc35815_local *lp = dev->priv;
2168 return sizeof(lp->lstats) / sizeof(int); 2168
2169 switch (sset) {
2170 case ETH_SS_STATS:
2171 return sizeof(lp->lstats) / sizeof(int);
2172 default:
2173 return -EOPNOTSUPP;
2174 }
2169} 2175}
2170 2176
2171static void tc35815_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, u64 *data) 2177static void tc35815_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, u64 *data)
@@ -2200,7 +2206,7 @@ static const struct ethtool_ops tc35815_ethtool_ops = {
2200 .get_msglevel = tc35815_get_msglevel, 2206 .get_msglevel = tc35815_get_msglevel,
2201 .set_msglevel = tc35815_set_msglevel, 2207 .set_msglevel = tc35815_set_msglevel,
2202 .get_strings = tc35815_get_strings, 2208 .get_strings = tc35815_get_strings,
2203 .get_stats_count = tc35815_get_stats_count, 2209 .get_sset_count = tc35815_get_sset_count,
2204 .get_ethtool_stats = tc35815_get_ethtool_stats, 2210 .get_ethtool_stats = tc35815_get_ethtool_stats,
2205}; 2211};
2206 2212
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 1b860e0817f6..d4ac6e9ef6db 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -8347,14 +8347,16 @@ static int tg3_set_tx_csum(struct net_device *dev, u32 data)
8347 return 0; 8347 return 0;
8348} 8348}
8349 8349
8350static int tg3_get_stats_count (struct net_device *dev) 8350static int tg3_get_sset_count (struct net_device *dev, int sset)
8351{ 8351{
8352 return TG3_NUM_STATS; 8352 switch (sset) {
8353} 8353 case ETH_SS_TEST:
8354 8354 return TG3_NUM_TEST;
8355static int tg3_get_test_count (struct net_device *dev) 8355 case ETH_SS_STATS:
8356{ 8356 return TG3_NUM_STATS;
8357 return TG3_NUM_TEST; 8357 default:
8358 return -EOPNOTSUPP;
8359 }
8358} 8360}
8359 8361
8360static void tg3_get_strings (struct net_device *dev, u32 stringset, u8 *buf) 8362static void tg3_get_strings (struct net_device *dev, u32 stringset, u8 *buf)
@@ -9281,14 +9283,13 @@ static const struct ethtool_ops tg3_ethtool_ops = {
9281 .set_tx_csum = tg3_set_tx_csum, 9283 .set_tx_csum = tg3_set_tx_csum,
9282 .set_sg = ethtool_op_set_sg, 9284 .set_sg = ethtool_op_set_sg,
9283 .set_tso = tg3_set_tso, 9285 .set_tso = tg3_set_tso,
9284 .self_test_count = tg3_get_test_count,
9285 .self_test = tg3_self_test, 9286 .self_test = tg3_self_test,
9286 .get_strings = tg3_get_strings, 9287 .get_strings = tg3_get_strings,
9287 .phys_id = tg3_phys_id, 9288 .phys_id = tg3_phys_id,
9288 .get_stats_count = tg3_get_stats_count,
9289 .get_ethtool_stats = tg3_get_ethtool_stats, 9289 .get_ethtool_stats = tg3_get_ethtool_stats,
9290 .get_coalesce = tg3_get_coalesce, 9290 .get_coalesce = tg3_get_coalesce,
9291 .set_coalesce = tg3_set_coalesce, 9291 .set_coalesce = tg3_set_coalesce,
9292 .get_sset_count = tg3_get_sset_count,
9292}; 9293};
9293 9294
9294static void __devinit tg3_get_eeprom_size(struct tg3 *tp) 9295static void __devinit tg3_get_eeprom_size(struct tg3 *tp)
diff --git a/drivers/net/ucc_geth_ethtool.c b/drivers/net/ucc_geth_ethtool.c
index 73aa677a4a3e..9a9622c13e2b 100644
--- a/drivers/net/ucc_geth_ethtool.c
+++ b/drivers/net/ucc_geth_ethtool.c
@@ -276,20 +276,26 @@ uec_set_ringparam(struct net_device *netdev,
276 return ret; 276 return ret;
277} 277}
278 278
279static int uec_get_stats_count(struct net_device *netdev) 279static int uec_get_sset_count(struct net_device *netdev, int sset)
280{ 280{
281 struct ucc_geth_private *ugeth = netdev_priv(netdev); 281 struct ucc_geth_private *ugeth = netdev_priv(netdev);
282 u32 stats_mode = ugeth->ug_info->statisticsMode; 282 u32 stats_mode = ugeth->ug_info->statisticsMode;
283 int len = 0; 283 int len = 0;
284 284
285 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE) 285 switch (sset) {
286 len += UEC_HW_STATS_LEN; 286 case ETH_SS_STATS:
287 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX) 287 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_HARDWARE)
288 len += UEC_TX_FW_STATS_LEN; 288 len += UEC_HW_STATS_LEN;
289 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX) 289 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_TX)
290 len += UEC_RX_FW_STATS_LEN; 290 len += UEC_TX_FW_STATS_LEN;
291 if (stats_mode & UCC_GETH_STATISTICS_GATHERING_MODE_FIRMWARE_RX)
292 len += UEC_RX_FW_STATS_LEN;
293
294 return len;
291 295
292 return len; 296 default:
297 return -EOPNOTSUPP;
298 }
293} 299}
294 300
295static void uec_get_strings(struct net_device *netdev, u32 stringset, u8 *buf) 301static void uec_get_strings(struct net_device *netdev, u32 stringset, u8 *buf)
@@ -353,8 +359,6 @@ uec_get_drvinfo(struct net_device *netdev,
353 strncpy(drvinfo->version, DRV_VERSION, 32); 359 strncpy(drvinfo->version, DRV_VERSION, 32);
354 strncpy(drvinfo->fw_version, "N/A", 32); 360 strncpy(drvinfo->fw_version, "N/A", 32);
355 strncpy(drvinfo->bus_info, "QUICC ENGINE", 32); 361 strncpy(drvinfo->bus_info, "QUICC ENGINE", 32);
356 drvinfo->n_stats = uec_get_stats_count(netdev);
357 drvinfo->testinfo_len = 0;
358 drvinfo->eedump_len = 0; 362 drvinfo->eedump_len = 0;
359 drvinfo->regdump_len = uec_get_regs_len(netdev); 363 drvinfo->regdump_len = uec_get_regs_len(netdev);
360} 364}
@@ -374,7 +378,7 @@ static const struct ethtool_ops uec_ethtool_ops = {
374 .get_pauseparam = uec_get_pauseparam, 378 .get_pauseparam = uec_get_pauseparam,
375 .set_pauseparam = uec_set_pauseparam, 379 .set_pauseparam = uec_set_pauseparam,
376 .set_sg = ethtool_op_set_sg, 380 .set_sg = ethtool_op_set_sg,
377 .get_stats_count = uec_get_stats_count, 381 .get_sset_count = uec_get_sset_count,
378 .get_strings = uec_get_strings, 382 .get_strings = uec_get_strings,
379 .get_ethtool_stats = uec_get_ethtool_stats, 383 .get_ethtool_stats = uec_get_ethtool_stats,
380}; 384};
diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 2c86a4459d8a..fdd1e034569d 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -79,9 +79,14 @@ static void veth_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
79 } 79 }
80} 80}
81 81
82static int veth_get_stats_count(struct net_device *dev) 82static int veth_get_sset_count(struct net_device *dev, int sset)
83{ 83{
84 return ARRAY_SIZE(ethtool_stats_keys); 84 switch (sset) {
85 case ETH_SS_STATS:
86 return ARRAY_SIZE(ethtool_stats_keys);
87 default:
88 return -EOPNOTSUPP;
89 }
85} 90}
86 91
87static void veth_get_ethtool_stats(struct net_device *dev, 92static void veth_get_ethtool_stats(struct net_device *dev,
@@ -135,7 +140,7 @@ static struct ethtool_ops veth_ethtool_ops = {
135 .get_sg = ethtool_op_get_sg, 140 .get_sg = ethtool_op_get_sg,
136 .set_sg = ethtool_op_set_sg, 141 .set_sg = ethtool_op_set_sg,
137 .get_strings = veth_get_strings, 142 .get_strings = veth_get_strings,
138 .get_stats_count = veth_get_stats_count, 143 .get_sset_count = veth_get_sset_count,
139 .get_ethtool_stats = veth_get_ethtool_stats, 144 .get_ethtool_stats = veth_get_ethtool_stats,
140}; 145};
141 146
diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c
index d793d843f7d5..3dae15211b6a 100644
--- a/drivers/net/wireless/libertas/ethtool.c
+++ b/drivers/net/wireless/libertas/ethtool.c
@@ -109,29 +109,8 @@ static void libertas_ethtool_get_stats(struct net_device * dev,
109 struct ethtool_stats * stats, u64 * data) 109 struct ethtool_stats * stats, u64 * data)
110{ 110{
111 wlan_private *priv = dev->priv; 111 wlan_private *priv = dev->priv;
112
113 lbs_deb_enter(LBS_DEB_ETHTOOL);
114
115 stats->cmd = ETHTOOL_GSTATS;
116 BUG_ON(stats->n_stats != MESH_STATS_NUM);
117
118 data[0] = priv->mstats.fwd_drop_rbt;
119 data[1] = priv->mstats.fwd_drop_ttl;
120 data[2] = priv->mstats.fwd_drop_noroute;
121 data[3] = priv->mstats.fwd_drop_nobuf;
122 data[4] = priv->mstats.fwd_unicast_cnt;
123 data[5] = priv->mstats.fwd_bcast_cnt;
124 data[6] = priv->mstats.drop_blind;
125 data[7] = priv->mstats.tx_failed_cnt;
126
127 lbs_deb_enter(LBS_DEB_ETHTOOL);
128}
129
130static int libertas_ethtool_get_stats_count(struct net_device * dev)
131{
132 int ret;
133 wlan_private *priv = dev->priv;
134 struct cmd_ds_mesh_access mesh_access; 112 struct cmd_ds_mesh_access mesh_access;
113 int ret;
135 114
136 lbs_deb_enter(LBS_DEB_ETHTOOL); 115 lbs_deb_enter(LBS_DEB_ETHTOOL);
137 116
@@ -140,25 +119,38 @@ static int libertas_ethtool_get_stats_count(struct net_device * dev)
140 CMD_MESH_ACCESS, CMD_ACT_MESH_GET_STATS, 119 CMD_MESH_ACCESS, CMD_ACT_MESH_GET_STATS,
141 CMD_OPTION_WAITFORRSP, 0, &mesh_access); 120 CMD_OPTION_WAITFORRSP, 0, &mesh_access);
142 121
143 if (ret) { 122 if (ret)
144 ret = 0; 123 return;
145 goto done; 124
146 } 125 priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]);
147 126 priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]);
148 priv->mstats.fwd_drop_rbt = le32_to_cpu(mesh_access.data[0]); 127 priv->mstats.fwd_drop_noroute = le32_to_cpu(mesh_access.data[2]);
149 priv->mstats.fwd_drop_ttl = le32_to_cpu(mesh_access.data[1]); 128 priv->mstats.fwd_drop_nobuf = le32_to_cpu(mesh_access.data[3]);
150 priv->mstats.fwd_drop_noroute = le32_to_cpu(mesh_access.data[2]); 129 priv->mstats.fwd_unicast_cnt = le32_to_cpu(mesh_access.data[4]);
151 priv->mstats.fwd_drop_nobuf = le32_to_cpu(mesh_access.data[3]); 130 priv->mstats.fwd_bcast_cnt = le32_to_cpu(mesh_access.data[5]);
152 priv->mstats.fwd_unicast_cnt = le32_to_cpu(mesh_access.data[4]); 131 priv->mstats.drop_blind = le32_to_cpu(mesh_access.data[6]);
153 priv->mstats.fwd_bcast_cnt = le32_to_cpu(mesh_access.data[5]); 132 priv->mstats.tx_failed_cnt = le32_to_cpu(mesh_access.data[7]);
154 priv->mstats.drop_blind = le32_to_cpu(mesh_access.data[6]); 133
155 priv->mstats.tx_failed_cnt = le32_to_cpu(mesh_access.data[7]); 134 data[0] = priv->mstats.fwd_drop_rbt;
135 data[1] = priv->mstats.fwd_drop_ttl;
136 data[2] = priv->mstats.fwd_drop_noroute;
137 data[3] = priv->mstats.fwd_drop_nobuf;
138 data[4] = priv->mstats.fwd_unicast_cnt;
139 data[5] = priv->mstats.fwd_bcast_cnt;
140 data[6] = priv->mstats.drop_blind;
141 data[7] = priv->mstats.tx_failed_cnt;
156 142
157 ret = MESH_STATS_NUM; 143 lbs_deb_enter(LBS_DEB_ETHTOOL);
144}
158 145
159done: 146static int libertas_ethtool_get_sset_count(struct net_device * dev, int sset)
160 lbs_deb_enter_args(LBS_DEB_ETHTOOL, "ret %d", ret); 147{
161 return ret; 148 switch (sset) {
149 case ETH_SS_STATS:
150 return MESH_STATS_NUM;
151 default:
152 return -EOPNOTSUPP;
153 }
162} 154}
163 155
164static void libertas_ethtool_get_strings (struct net_device * dev, 156static void libertas_ethtool_get_strings (struct net_device * dev,
@@ -185,7 +177,7 @@ struct ethtool_ops libertas_ethtool_ops = {
185 .get_drvinfo = libertas_ethtool_get_drvinfo, 177 .get_drvinfo = libertas_ethtool_get_drvinfo,
186 .get_eeprom = libertas_ethtool_get_eeprom, 178 .get_eeprom = libertas_ethtool_get_eeprom,
187 .get_eeprom_len = libertas_ethtool_get_eeprom_len, 179 .get_eeprom_len = libertas_ethtool_get_eeprom_len,
188 .get_stats_count = libertas_ethtool_get_stats_count, 180 .get_sset_count = libertas_ethtool_get_sset_count,
189 .get_ethtool_stats = libertas_ethtool_get_stats, 181 .get_ethtool_stats = libertas_ethtool_get_stats,
190 .get_strings = libertas_ethtool_get_strings, 182 .get_strings = libertas_ethtool_get_strings,
191}; 183};