aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/ethtool.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2008-12-26 16:47:04 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-26 16:47:04 -0500
commit2ef3068e6c40ec44d27f6f8027616e284d1b0466 (patch)
treef4aaf6d442f7dbbe64a7744c111707680893862b /drivers/net/sfc/ethtool.c
parenta5692e49cd9e6512c48ebf61e52991cbe643c12d (diff)
sfc: Merge top-level functions for self-tests
Pass in ethtool test flags to determine which tests to run. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/ethtool.c')
-rw-r--r--drivers/net/sfc/ethtool.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c
index 3aaece6b12cc..7fa28443c7bc 100644
--- a/drivers/net/sfc/ethtool.c
+++ b/drivers/net/sfc/ethtool.c
@@ -487,7 +487,7 @@ static void efx_ethtool_self_test(struct net_device *net_dev,
487{ 487{
488 struct efx_nic *efx = netdev_priv(net_dev); 488 struct efx_nic *efx = netdev_priv(net_dev);
489 struct efx_self_tests efx_tests; 489 struct efx_self_tests efx_tests;
490 int offline, already_up; 490 int already_up;
491 int rc; 491 int rc;
492 492
493 ASSERT_RTNL(); 493 ASSERT_RTNL();
@@ -507,24 +507,15 @@ static void efx_ethtool_self_test(struct net_device *net_dev,
507 } 507 }
508 508
509 memset(&efx_tests, 0, sizeof(efx_tests)); 509 memset(&efx_tests, 0, sizeof(efx_tests));
510 offline = (test->flags & ETH_TEST_FL_OFFLINE);
511 510
512 /* Perform online self tests first */ 511 rc = efx_selftest(efx, &efx_tests, test->flags);
513 rc = efx_online_test(efx, &efx_tests);
514 if (rc)
515 goto out;
516
517 /* Perform offline tests only if online tests passed */
518 if (offline)
519 rc = efx_offline_test(efx, &efx_tests,
520 efx->loopback_modes);
521 512
522 out:
523 if (!already_up) 513 if (!already_up)
524 dev_close(efx->net_dev); 514 dev_close(efx->net_dev);
525 515
526 EFX_LOG(efx, "%s all %sline self-tests\n", 516 EFX_LOG(efx, "%s %sline self-tests\n",
527 rc == 0 ? "passed" : "failed", offline ? "off" : "on"); 517 rc == 0 ? "passed" : "failed",
518 (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on");
528 519
529 fail2: 520 fail2:
530 fail1: 521 fail1: