aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/forcedeth.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/forcedeth.c')
-rw-r--r--drivers/net/forcedeth.c45
1 files changed, 22 insertions, 23 deletions
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