Skip to content

Commit

Permalink
tehuti: Convert ethtool get_stats_count() ops to get_sset_count()
Browse files Browse the repository at this point in the history
This string query operation was supposed to be replaced by the
generic get_sset_count() starting in 2007.  Convert tehuti's
implementation.

Also remove the dummy self-test name which was not used since tehuti
does not advertise any self-tests.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Oct 5, 2009
1 parent df8b4ec commit 1ddee09
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions drivers/net/tehuti.c
Original file line number Diff line number Diff line change
Expand Up @@ -2105,12 +2105,6 @@ bdx_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
}

/****************** Ethtool interface *********************/
/* get strings for tests */
static const char
bdx_test_names[][ETH_GSTRING_LEN] = {
"No tests defined"
};

/* get strings for statistics counters */
static const char
bdx_stat_names[][ETH_GSTRING_LEN] = {
Expand Down Expand Up @@ -2380,25 +2374,28 @@ bdx_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring)
static void bdx_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
{
switch (stringset) {
case ETH_SS_TEST:
memcpy(data, *bdx_test_names, sizeof(bdx_test_names));
break;
case ETH_SS_STATS:
memcpy(data, *bdx_stat_names, sizeof(bdx_stat_names));
break;
}
}

/*
* bdx_get_stats_count - return number of 64bit statistics counters
* bdx_get_sset_count - return number of statistics or tests
* @netdev
*/
static int bdx_get_stats_count(struct net_device *netdev)
static int bdx_get_sset_count(struct net_device *netdev, int stringset)
{
struct bdx_priv *priv = netdev_priv(netdev);
BDX_ASSERT(ARRAY_SIZE(bdx_stat_names)
!= sizeof(struct bdx_stats) / sizeof(u64));
return ((priv->stats_flag) ? ARRAY_SIZE(bdx_stat_names) : 0);

switch (stringset) {
case ETH_SS_STATS:
BDX_ASSERT(ARRAY_SIZE(bdx_stat_names)
!= sizeof(struct bdx_stats) / sizeof(u64));
return ((priv->stats_flag) ? ARRAY_SIZE(bdx_stat_names) : 0);
default:
return -EINVAL;
}
}

/*
Expand Down Expand Up @@ -2441,7 +2438,7 @@ static void bdx_ethtool_ops(struct net_device *netdev)
.get_sg = ethtool_op_get_sg,
.get_tso = ethtool_op_get_tso,
.get_strings = bdx_get_strings,
.get_stats_count = bdx_get_stats_count,
.get_sset_count = bdx_get_sset_count,
.get_ethtool_stats = bdx_get_ethtool_stats,
};

Expand Down

0 comments on commit 1ddee09

Please sign in to comment.