aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2x_main.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2009-10-01 07:58:24 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-05 03:10:10 -0400
commit15f0a394c6573f4cb65a13095288ab9b9f8135f9 (patch)
tree211fe96826513a68a107feb9850817b9c4b2c8d1 /drivers/net/bnx2x_main.c
parent1ddee09ff0420090d5b03ef3f9eba0e4db647035 (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>
Diffstat (limited to 'drivers/net/bnx2x_main.c')
-rw-r--r--drivers/net/bnx2x_main.c60
1 files changed, 31 insertions, 29 deletions
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
9821static int bnx2x_self_test_count(struct net_device *dev)
9822{
9823 return BNX2X_NUM_TESTS;
9824}
9825
9826static int bnx2x_test_registers(struct bnx2x *bp) 9821static 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
10434static 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
10439static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf) 10464static 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
10476static 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
10498static void bnx2x_get_ethtool_stats(struct net_device *dev, 10501static 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