diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2009-10-01 07:58:24 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-05 03:10:10 -0400 |
commit | 15f0a394c6573f4cb65a13095288ab9b9f8135f9 (patch) | |
tree | 211fe96826513a68a107feb9850817b9c4b2c8d1 | |
parent | 1ddee09ff0420090d5b03ef3f9eba0e4db647035 (diff) |
net: Convert ethtool {get_stats, self_test}_count() ops to get_sset_count()
These string query operations were supposed to be replaced by the
generic get_sset_count() starting in 2007. Convert the remaining
implementations.
Also remove calls to these operations to initialise drvinfo->n_stats.
The ethtool core code already does that.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Acked-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/infiniband/hw/nes/nes_nic.c | 12 | ||||
-rw-r--r-- | drivers/net/benet/be_ethtool.c | 11 | ||||
-rw-r--r-- | drivers/net/bnx2x_main.c | 60 | ||||
-rw-r--r-- | drivers/net/ibm_newemac/core.c | 10 | ||||
-rw-r--r-- | drivers/net/igbvf/ethtool.c | 25 | ||||
-rw-r--r-- | drivers/net/niu.c | 7 |
6 files changed, 70 insertions, 55 deletions
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c index e593af3354b8..de18fdfdadf2 100644 --- a/drivers/infiniband/hw/nes/nes_nic.c +++ b/drivers/infiniband/hw/nes/nes_nic.c | |||
@@ -1080,11 +1080,14 @@ static int nes_netdev_set_rx_csum(struct net_device *netdev, u32 enable) | |||
1080 | 1080 | ||
1081 | 1081 | ||
1082 | /** | 1082 | /** |
1083 | * nes_netdev_get_stats_count | 1083 | * nes_netdev_get_sset_count |
1084 | */ | 1084 | */ |
1085 | static int nes_netdev_get_stats_count(struct net_device *netdev) | 1085 | static int nes_netdev_get_sset_count(struct net_device *netdev, int stringset) |
1086 | { | 1086 | { |
1087 | return NES_ETHTOOL_STAT_COUNT; | 1087 | if (stringset == ETH_SS_STATS) |
1088 | return NES_ETHTOOL_STAT_COUNT; | ||
1089 | else | ||
1090 | return -EINVAL; | ||
1088 | } | 1091 | } |
1089 | 1092 | ||
1090 | 1093 | ||
@@ -1264,7 +1267,6 @@ static void nes_netdev_get_drvinfo(struct net_device *netdev, | |||
1264 | sprintf(drvinfo->fw_version, "%u.%u", nesadapter->firmware_version>>16, | 1267 | sprintf(drvinfo->fw_version, "%u.%u", nesadapter->firmware_version>>16, |
1265 | nesadapter->firmware_version & 0x000000ff); | 1268 | nesadapter->firmware_version & 0x000000ff); |
1266 | strcpy(drvinfo->version, DRV_VERSION); | 1269 | strcpy(drvinfo->version, DRV_VERSION); |
1267 | drvinfo->n_stats = nes_netdev_get_stats_count(netdev); | ||
1268 | drvinfo->testinfo_len = 0; | 1270 | drvinfo->testinfo_len = 0; |
1269 | drvinfo->eedump_len = 0; | 1271 | drvinfo->eedump_len = 0; |
1270 | drvinfo->regdump_len = 0; | 1272 | drvinfo->regdump_len = 0; |
@@ -1516,7 +1518,7 @@ static const struct ethtool_ops nes_ethtool_ops = { | |||
1516 | .get_rx_csum = nes_netdev_get_rx_csum, | 1518 | .get_rx_csum = nes_netdev_get_rx_csum, |
1517 | .get_sg = ethtool_op_get_sg, | 1519 | .get_sg = ethtool_op_get_sg, |
1518 | .get_strings = nes_netdev_get_strings, | 1520 | .get_strings = nes_netdev_get_strings, |
1519 | .get_stats_count = nes_netdev_get_stats_count, | 1521 | .get_sset_count = nes_netdev_get_sset_count, |
1520 | .get_ethtool_stats = nes_netdev_get_ethtool_stats, | 1522 | .get_ethtool_stats = nes_netdev_get_ethtool_stats, |
1521 | .get_drvinfo = nes_netdev_get_drvinfo, | 1523 | .get_drvinfo = nes_netdev_get_drvinfo, |
1522 | .get_coalesce = nes_netdev_get_coalesce, | 1524 | .get_coalesce = nes_netdev_get_coalesce, |
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c index 11445df3dbc0..851543a040cb 100644 --- a/drivers/net/benet/be_ethtool.c +++ b/drivers/net/benet/be_ethtool.c | |||
@@ -281,9 +281,14 @@ be_get_stat_strings(struct net_device *netdev, uint32_t stringset, | |||
281 | } | 281 | } |
282 | } | 282 | } |
283 | 283 | ||
284 | static int be_get_stats_count(struct net_device *netdev) | 284 | static int be_get_sset_count(struct net_device *netdev, int stringset) |
285 | { | 285 | { |
286 | return ETHTOOL_STATS_NUM; | 286 | switch (stringset) { |
287 | case ETH_SS_STATS: | ||
288 | return ETHTOOL_STATS_NUM; | ||
289 | default: | ||
290 | return -EINVAL; | ||
291 | } | ||
287 | } | 292 | } |
288 | 293 | ||
289 | static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | 294 | static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) |
@@ -364,7 +369,7 @@ const struct ethtool_ops be_ethtool_ops = { | |||
364 | .get_tso = ethtool_op_get_tso, | 369 | .get_tso = ethtool_op_get_tso, |
365 | .set_tso = ethtool_op_set_tso, | 370 | .set_tso = ethtool_op_set_tso, |
366 | .get_strings = be_get_stat_strings, | 371 | .get_strings = be_get_stat_strings, |
367 | .get_stats_count = be_get_stats_count, | 372 | .get_sset_count = be_get_sset_count, |
368 | .get_ethtool_stats = be_get_ethtool_stats, | 373 | .get_ethtool_stats = be_get_ethtool_stats, |
369 | .flash_device = be_do_flash, | 374 | .flash_device = be_do_flash, |
370 | }; | 375 | }; |
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index 20f0ed956df2..c0abfc4fb34b 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c | |||
@@ -9818,11 +9818,6 @@ static const struct { | |||
9818 | { "idle check (online)" } | 9818 | { "idle check (online)" } |
9819 | }; | 9819 | }; |
9820 | 9820 | ||
9821 | static int bnx2x_self_test_count(struct net_device *dev) | ||
9822 | { | ||
9823 | return BNX2X_NUM_TESTS; | ||
9824 | } | ||
9825 | |||
9826 | static int bnx2x_test_registers(struct bnx2x *bp) | 9821 | static int bnx2x_test_registers(struct bnx2x *bp) |
9827 | { | 9822 | { |
9828 | int idx, i, rc = -ENODEV; | 9823 | int idx, i, rc = -ENODEV; |
@@ -10436,6 +10431,36 @@ static const struct { | |||
10436 | #define IS_E1HMF_MODE_STAT(bp) \ | 10431 | #define IS_E1HMF_MODE_STAT(bp) \ |
10437 | (IS_E1HMF(bp) && !(bp->msglevel & BNX2X_MSG_STATS)) | 10432 | (IS_E1HMF(bp) && !(bp->msglevel & BNX2X_MSG_STATS)) |
10438 | 10433 | ||
10434 | static int bnx2x_get_sset_count(struct net_device *dev, int stringset) | ||
10435 | { | ||
10436 | struct bnx2x *bp = netdev_priv(dev); | ||
10437 | int i, num_stats; | ||
10438 | |||
10439 | switch(stringset) { | ||
10440 | case ETH_SS_STATS: | ||
10441 | if (is_multi(bp)) { | ||
10442 | num_stats = BNX2X_NUM_Q_STATS * bp->num_rx_queues; | ||
10443 | if (!IS_E1HMF_MODE_STAT(bp)) | ||
10444 | num_stats += BNX2X_NUM_STATS; | ||
10445 | } else { | ||
10446 | if (IS_E1HMF_MODE_STAT(bp)) { | ||
10447 | num_stats = 0; | ||
10448 | for (i = 0; i < BNX2X_NUM_STATS; i++) | ||
10449 | if (IS_FUNC_STAT(i)) | ||
10450 | num_stats++; | ||
10451 | } else | ||
10452 | num_stats = BNX2X_NUM_STATS; | ||
10453 | } | ||
10454 | return num_stats; | ||
10455 | |||
10456 | case ETH_SS_TEST: | ||
10457 | return BNX2X_NUM_TESTS; | ||
10458 | |||
10459 | default: | ||
10460 | return -EINVAL; | ||
10461 | } | ||
10462 | } | ||
10463 | |||
10439 | static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf) | 10464 | static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf) |
10440 | { | 10465 | { |
10441 | struct bnx2x *bp = netdev_priv(dev); | 10466 | struct bnx2x *bp = netdev_priv(dev); |
@@ -10473,28 +10498,6 @@ static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf) | |||
10473 | } | 10498 | } |
10474 | } | 10499 | } |
10475 | 10500 | ||
10476 | static int bnx2x_get_stats_count(struct net_device *dev) | ||
10477 | { | ||
10478 | struct bnx2x *bp = netdev_priv(dev); | ||
10479 | int i, num_stats; | ||
10480 | |||
10481 | if (is_multi(bp)) { | ||
10482 | num_stats = BNX2X_NUM_Q_STATS * bp->num_rx_queues; | ||
10483 | if (!IS_E1HMF_MODE_STAT(bp)) | ||
10484 | num_stats += BNX2X_NUM_STATS; | ||
10485 | } else { | ||
10486 | if (IS_E1HMF_MODE_STAT(bp)) { | ||
10487 | num_stats = 0; | ||
10488 | for (i = 0; i < BNX2X_NUM_STATS; i++) | ||
10489 | if (IS_FUNC_STAT(i)) | ||
10490 | num_stats++; | ||
10491 | } else | ||
10492 | num_stats = BNX2X_NUM_STATS; | ||
10493 | } | ||
10494 | |||
10495 | return num_stats; | ||
10496 | } | ||
10497 | |||
10498 | static void bnx2x_get_ethtool_stats(struct net_device *dev, | 10501 | static void bnx2x_get_ethtool_stats(struct net_device *dev, |
10499 | struct ethtool_stats *stats, u64 *buf) | 10502 | struct ethtool_stats *stats, u64 *buf) |
10500 | { | 10503 | { |
@@ -10637,11 +10640,10 @@ static const struct ethtool_ops bnx2x_ethtool_ops = { | |||
10637 | .set_sg = ethtool_op_set_sg, | 10640 | .set_sg = ethtool_op_set_sg, |
10638 | .get_tso = ethtool_op_get_tso, | 10641 | .get_tso = ethtool_op_get_tso, |
10639 | .set_tso = bnx2x_set_tso, | 10642 | .set_tso = bnx2x_set_tso, |
10640 | .self_test_count = bnx2x_self_test_count, | ||
10641 | .self_test = bnx2x_self_test, | 10643 | .self_test = bnx2x_self_test, |
10644 | .get_sset_count = bnx2x_get_sset_count, | ||
10642 | .get_strings = bnx2x_get_strings, | 10645 | .get_strings = bnx2x_get_strings, |
10643 | .phys_id = bnx2x_phys_id, | 10646 | .phys_id = bnx2x_phys_id, |
10644 | .get_stats_count = bnx2x_get_stats_count, | ||
10645 | .get_ethtool_stats = bnx2x_get_ethtool_stats, | 10647 | .get_ethtool_stats = bnx2x_get_ethtool_stats, |
10646 | }; | 10648 | }; |
10647 | 10649 | ||
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c index 89c82c5e63e4..0fa21a936d13 100644 --- a/drivers/net/ibm_newemac/core.c +++ b/drivers/net/ibm_newemac/core.c | |||
@@ -2145,9 +2145,12 @@ static int emac_ethtool_nway_reset(struct net_device *ndev) | |||
2145 | return res; | 2145 | return res; |
2146 | } | 2146 | } |
2147 | 2147 | ||
2148 | static int emac_ethtool_get_stats_count(struct net_device *ndev) | 2148 | static int emac_ethtool_get_sset_count(struct net_device *ndev, int stringset) |
2149 | { | 2149 | { |
2150 | return EMAC_ETHTOOL_STATS_COUNT; | 2150 | if (stringset == ETH_SS_STATS) |
2151 | return EMAC_ETHTOOL_STATS_COUNT; | ||
2152 | else | ||
2153 | return -EINVAL; | ||
2151 | } | 2154 | } |
2152 | 2155 | ||
2153 | static void emac_ethtool_get_strings(struct net_device *ndev, u32 stringset, | 2156 | static void emac_ethtool_get_strings(struct net_device *ndev, u32 stringset, |
@@ -2178,7 +2181,6 @@ static void emac_ethtool_get_drvinfo(struct net_device *ndev, | |||
2178 | info->fw_version[0] = '\0'; | 2181 | info->fw_version[0] = '\0'; |
2179 | sprintf(info->bus_info, "PPC 4xx EMAC-%d %s", | 2182 | sprintf(info->bus_info, "PPC 4xx EMAC-%d %s", |
2180 | dev->cell_index, dev->ofdev->node->full_name); | 2183 | dev->cell_index, dev->ofdev->node->full_name); |
2181 | info->n_stats = emac_ethtool_get_stats_count(ndev); | ||
2182 | info->regdump_len = emac_ethtool_get_regs_len(ndev); | 2184 | info->regdump_len = emac_ethtool_get_regs_len(ndev); |
2183 | } | 2185 | } |
2184 | 2186 | ||
@@ -2198,7 +2200,7 @@ static const struct ethtool_ops emac_ethtool_ops = { | |||
2198 | .get_rx_csum = emac_ethtool_get_rx_csum, | 2200 | .get_rx_csum = emac_ethtool_get_rx_csum, |
2199 | 2201 | ||
2200 | .get_strings = emac_ethtool_get_strings, | 2202 | .get_strings = emac_ethtool_get_strings, |
2201 | .get_stats_count = emac_ethtool_get_stats_count, | 2203 | .get_sset_count = emac_ethtool_get_sset_count, |
2202 | .get_ethtool_stats = emac_ethtool_get_ethtool_stats, | 2204 | .get_ethtool_stats = emac_ethtool_get_ethtool_stats, |
2203 | 2205 | ||
2204 | .get_link = ethtool_op_get_link, | 2206 | .get_link = ethtool_op_get_link, |
diff --git a/drivers/net/igbvf/ethtool.c b/drivers/net/igbvf/ethtool.c index ee17a097d1ca..bc606f8b61aa 100644 --- a/drivers/net/igbvf/ethtool.c +++ b/drivers/net/igbvf/ethtool.c | |||
@@ -363,16 +363,6 @@ static int igbvf_link_test(struct igbvf_adapter *adapter, u64 *data) | |||
363 | return *data; | 363 | return *data; |
364 | } | 364 | } |
365 | 365 | ||
366 | static int igbvf_get_self_test_count(struct net_device *netdev) | ||
367 | { | ||
368 | return IGBVF_TEST_LEN; | ||
369 | } | ||
370 | |||
371 | static int igbvf_get_stats_count(struct net_device *netdev) | ||
372 | { | ||
373 | return IGBVF_GLOBAL_STATS_LEN; | ||
374 | } | ||
375 | |||
376 | static void igbvf_diag_test(struct net_device *netdev, | 366 | static void igbvf_diag_test(struct net_device *netdev, |
377 | struct ethtool_test *eth_test, u64 *data) | 367 | struct ethtool_test *eth_test, u64 *data) |
378 | { | 368 | { |
@@ -480,6 +470,18 @@ static void igbvf_get_ethtool_stats(struct net_device *netdev, | |||
480 | 470 | ||
481 | } | 471 | } |
482 | 472 | ||
473 | static int igbvf_get_sset_count(struct net_device *dev, int stringset) | ||
474 | { | ||
475 | switch(stringset) { | ||
476 | case ETH_SS_TEST: | ||
477 | return IGBVF_TEST_LEN; | ||
478 | case ETH_SS_STATS: | ||
479 | return IGBVF_GLOBAL_STATS_LEN; | ||
480 | default: | ||
481 | return -EINVAL; | ||
482 | } | ||
483 | } | ||
484 | |||
483 | static void igbvf_get_strings(struct net_device *netdev, u32 stringset, | 485 | static void igbvf_get_strings(struct net_device *netdev, u32 stringset, |
484 | u8 *data) | 486 | u8 *data) |
485 | { | 487 | { |
@@ -528,11 +530,10 @@ static const struct ethtool_ops igbvf_ethtool_ops = { | |||
528 | .get_tso = ethtool_op_get_tso, | 530 | .get_tso = ethtool_op_get_tso, |
529 | .set_tso = igbvf_set_tso, | 531 | .set_tso = igbvf_set_tso, |
530 | .self_test = igbvf_diag_test, | 532 | .self_test = igbvf_diag_test, |
533 | .get_sset_count = igbvf_get_sset_count, | ||
531 | .get_strings = igbvf_get_strings, | 534 | .get_strings = igbvf_get_strings, |
532 | .phys_id = igbvf_phys_id, | 535 | .phys_id = igbvf_phys_id, |
533 | .get_ethtool_stats = igbvf_get_ethtool_stats, | 536 | .get_ethtool_stats = igbvf_get_ethtool_stats, |
534 | .self_test_count = igbvf_get_self_test_count, | ||
535 | .get_stats_count = igbvf_get_stats_count, | ||
536 | .get_coalesce = igbvf_get_coalesce, | 537 | .get_coalesce = igbvf_get_coalesce, |
537 | .set_coalesce = igbvf_set_coalesce, | 538 | .set_coalesce = igbvf_set_coalesce, |
538 | }; | 539 | }; |
diff --git a/drivers/net/niu.c b/drivers/net/niu.c index f9364d0678f2..1d1e657991d2 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c | |||
@@ -7855,10 +7855,13 @@ static void niu_get_strings(struct net_device *dev, u32 stringset, u8 *data) | |||
7855 | } | 7855 | } |
7856 | } | 7856 | } |
7857 | 7857 | ||
7858 | static int niu_get_stats_count(struct net_device *dev) | 7858 | static int niu_get_sset_count(struct net_device *dev, int stringset) |
7859 | { | 7859 | { |
7860 | struct niu *np = netdev_priv(dev); | 7860 | struct niu *np = netdev_priv(dev); |
7861 | 7861 | ||
7862 | if (stringset != ETH_SS_STATS) | ||
7863 | return -EINVAL; | ||
7864 | |||
7862 | return ((np->flags & NIU_FLAGS_XMAC ? | 7865 | return ((np->flags & NIU_FLAGS_XMAC ? |
7863 | NUM_XMAC_STAT_KEYS : | 7866 | NUM_XMAC_STAT_KEYS : |
7864 | NUM_BMAC_STAT_KEYS) + | 7867 | NUM_BMAC_STAT_KEYS) + |
@@ -7978,7 +7981,7 @@ static const struct ethtool_ops niu_ethtool_ops = { | |||
7978 | .get_settings = niu_get_settings, | 7981 | .get_settings = niu_get_settings, |
7979 | .set_settings = niu_set_settings, | 7982 | .set_settings = niu_set_settings, |
7980 | .get_strings = niu_get_strings, | 7983 | .get_strings = niu_get_strings, |
7981 | .get_stats_count = niu_get_stats_count, | 7984 | .get_sset_count = niu_get_sset_count, |
7982 | .get_ethtool_stats = niu_get_ethtool_stats, | 7985 | .get_ethtool_stats = niu_get_ethtool_stats, |
7983 | .phys_id = niu_phys_id, | 7986 | .phys_id = niu_phys_id, |
7984 | .get_rxnfc = niu_get_nfc, | 7987 | .get_rxnfc = niu_get_nfc, |