Commit b681e57c authored by Ben Hutchings's avatar Ben Hutchings

sfc: Remove driver-local struct ethtool_string

It's not really helpful to pretend ethtool string arrays are
structured.
Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
parent e5136124
...@@ -19,10 +19,6 @@ ...@@ -19,10 +19,6 @@
#include "filter.h" #include "filter.h"
#include "nic.h" #include "nic.h"
struct ethtool_string {
char name[ETH_GSTRING_LEN];
};
struct efx_ethtool_stat { struct efx_ethtool_stat {
const char *name; const char *name;
enum { enum {
...@@ -289,12 +285,11 @@ static void efx_ethtool_set_msglevel(struct net_device *net_dev, u32 msg_enable) ...@@ -289,12 +285,11 @@ static void efx_ethtool_set_msglevel(struct net_device *net_dev, u32 msg_enable)
* *
* Fill in an individual self-test entry. * Fill in an individual self-test entry.
*/ */
static void efx_fill_test(unsigned int test_index, static void efx_fill_test(unsigned int test_index, u8 *strings, u64 *data,
struct ethtool_string *strings, u64 *data,
int *test, const char *unit_format, int unit_id, int *test, const char *unit_format, int unit_id,
const char *test_format, const char *test_id) const char *test_format, const char *test_id)
{ {
struct ethtool_string unit_str, test_str; char unit_str[ETH_GSTRING_LEN], test_str[ETH_GSTRING_LEN];
/* Fill data value, if applicable */ /* Fill data value, if applicable */
if (data) if (data)
...@@ -303,15 +298,14 @@ static void efx_fill_test(unsigned int test_index, ...@@ -303,15 +298,14 @@ static void efx_fill_test(unsigned int test_index,
/* Fill string, if applicable */ /* Fill string, if applicable */
if (strings) { if (strings) {
if (strchr(unit_format, '%')) if (strchr(unit_format, '%'))
snprintf(unit_str.name, sizeof(unit_str.name), snprintf(unit_str, sizeof(unit_str),
unit_format, unit_id); unit_format, unit_id);
else else
strcpy(unit_str.name, unit_format); strcpy(unit_str, unit_format);
snprintf(test_str.name, sizeof(test_str.name), snprintf(test_str, sizeof(test_str), test_format, test_id);
test_format, test_id); snprintf(strings + test_index * ETH_GSTRING_LEN,
snprintf(strings[test_index].name, ETH_GSTRING_LEN,
sizeof(strings[test_index].name), "%-6s %-24s", unit_str, test_str);
"%-6s %-24s", unit_str.name, test_str.name);
} }
} }
...@@ -334,7 +328,7 @@ static int efx_fill_loopback_test(struct efx_nic *efx, ...@@ -334,7 +328,7 @@ static int efx_fill_loopback_test(struct efx_nic *efx,
struct efx_loopback_self_tests *lb_tests, struct efx_loopback_self_tests *lb_tests,
enum efx_loopback_mode mode, enum efx_loopback_mode mode,
unsigned int test_index, unsigned int test_index,
struct ethtool_string *strings, u64 *data) u8 *strings, u64 *data)
{ {
struct efx_channel *channel = struct efx_channel *channel =
efx_get_channel(efx, efx->tx_channel_offset); efx_get_channel(efx, efx->tx_channel_offset);
...@@ -371,8 +365,7 @@ static int efx_fill_loopback_test(struct efx_nic *efx, ...@@ -371,8 +365,7 @@ static int efx_fill_loopback_test(struct efx_nic *efx,
*/ */
static int efx_ethtool_fill_self_tests(struct efx_nic *efx, static int efx_ethtool_fill_self_tests(struct efx_nic *efx,
struct efx_self_tests *tests, struct efx_self_tests *tests,
struct ethtool_string *strings, u8 *strings, u64 *data)
u64 *data)
{ {
struct efx_channel *channel; struct efx_channel *channel;
unsigned int n = 0, i; unsigned int n = 0, i;
...@@ -446,20 +439,16 @@ static void efx_ethtool_get_strings(struct net_device *net_dev, ...@@ -446,20 +439,16 @@ static void efx_ethtool_get_strings(struct net_device *net_dev,
u32 string_set, u8 *strings) u32 string_set, u8 *strings)
{ {
struct efx_nic *efx = netdev_priv(net_dev); struct efx_nic *efx = netdev_priv(net_dev);
struct ethtool_string *ethtool_strings =
(struct ethtool_string *)strings;
int i; int i;
switch (string_set) { switch (string_set) {
case ETH_SS_STATS: case ETH_SS_STATS:
for (i = 0; i < EFX_ETHTOOL_NUM_STATS; i++) for (i = 0; i < EFX_ETHTOOL_NUM_STATS; i++)
strlcpy(ethtool_strings[i].name, strlcpy(strings + i * ETH_GSTRING_LEN,
efx_ethtool_stats[i].name, efx_ethtool_stats[i].name, ETH_GSTRING_LEN);
sizeof(ethtool_strings[i].name));
break; break;
case ETH_SS_TEST: case ETH_SS_TEST:
efx_ethtool_fill_self_tests(efx, NULL, efx_ethtool_fill_self_tests(efx, NULL, strings, NULL);
ethtool_strings, NULL);
break; break;
default: default:
/* No other string sets */ /* No other string sets */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment