Commit 17e678d1 authored by Ben Hutchings's avatar Ben Hutchings Committed by David S. Miller

sfc: Cosmetic changes to self-test from the out-of-tree driver

Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: default avatarShradha Shah <sshah@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6a350fdb
...@@ -251,6 +251,9 @@ static void efx_fill_test(unsigned int test_index, u8 *strings, u64 *data, ...@@ -251,6 +251,9 @@ static void efx_fill_test(unsigned int test_index, u8 *strings, u64 *data,
* @test_index: Starting index of the test * @test_index: Starting index of the test
* @strings: Ethtool strings, or %NULL * @strings: Ethtool strings, or %NULL
* @data: Ethtool test results, or %NULL * @data: Ethtool test results, or %NULL
*
* Fill in a block of loopback self-test entries. Return new test
* index.
*/ */
static int efx_fill_loopback_test(struct efx_nic *efx, static int efx_fill_loopback_test(struct efx_nic *efx,
struct efx_loopback_self_tests *lb_tests, struct efx_loopback_self_tests *lb_tests,
...@@ -290,6 +293,12 @@ static int efx_fill_loopback_test(struct efx_nic *efx, ...@@ -290,6 +293,12 @@ static int efx_fill_loopback_test(struct efx_nic *efx,
* @tests: Efx self-test results structure, or %NULL * @tests: Efx self-test results structure, or %NULL
* @strings: Ethtool strings, or %NULL * @strings: Ethtool strings, or %NULL
* @data: Ethtool test results, or %NULL * @data: Ethtool test results, or %NULL
*
* Get self-test number of strings, strings, and/or test results.
* Return number of strings (== number of test results).
*
* The reason for merging these three functions is to make sure that
* they can never be inconsistent.
*/ */
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,
...@@ -444,7 +453,7 @@ static void efx_ethtool_self_test(struct net_device *net_dev, ...@@ -444,7 +453,7 @@ static void efx_ethtool_self_test(struct net_device *net_dev,
{ {
struct efx_nic *efx = netdev_priv(net_dev); struct efx_nic *efx = netdev_priv(net_dev);
struct efx_self_tests *efx_tests; struct efx_self_tests *efx_tests;
int already_up; bool already_up;
int rc = -ENOMEM; int rc = -ENOMEM;
efx_tests = kzalloc(sizeof(*efx_tests), GFP_KERNEL); efx_tests = kzalloc(sizeof(*efx_tests), GFP_KERNEL);
...@@ -453,7 +462,7 @@ static void efx_ethtool_self_test(struct net_device *net_dev, ...@@ -453,7 +462,7 @@ static void efx_ethtool_self_test(struct net_device *net_dev,
if (efx->state != STATE_READY) { if (efx->state != STATE_READY) {
rc = -EIO; rc = -EIO;
goto fail1; goto out;
} }
netif_info(efx, drv, efx->net_dev, "starting %sline testing\n", netif_info(efx, drv, efx->net_dev, "starting %sline testing\n",
...@@ -466,7 +475,7 @@ static void efx_ethtool_self_test(struct net_device *net_dev, ...@@ -466,7 +475,7 @@ static void efx_ethtool_self_test(struct net_device *net_dev,
if (rc) { if (rc) {
netif_err(efx, drv, efx->net_dev, netif_err(efx, drv, efx->net_dev,
"failed opening device.\n"); "failed opening device.\n");
goto fail1; goto out;
} }
} }
...@@ -479,8 +488,7 @@ static void efx_ethtool_self_test(struct net_device *net_dev, ...@@ -479,8 +488,7 @@ static void efx_ethtool_self_test(struct net_device *net_dev,
rc == 0 ? "passed" : "failed", rc == 0 ? "passed" : "failed",
(test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on");
fail1: out:
/* Fill ethtool results structures */
efx_ethtool_fill_self_tests(efx, efx_tests, NULL, data); efx_ethtool_fill_self_tests(efx, efx_tests, NULL, data);
kfree(efx_tests); kfree(efx_tests);
fail: fail:
......
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