aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/selftest.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2008-12-26 16:47:25 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-26 16:47:25 -0500
commit1796721a5a691a5d392abf8070ad40a0b787b667 (patch)
tree16ed5a5a8c77db9e8f70c9b23f6b26cde491c336 /drivers/net/sfc/selftest.c
parent2ef3068e6c40ec44d27f6f8027616e284d1b0466 (diff)
sfc: Add support for multiple PHY self-tests
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/selftest.c')
-rw-r--r--drivers/net/sfc/selftest.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c
index d10f6fbbb5ce..dba0d64d50cd 100644
--- a/drivers/net/sfc/selftest.c
+++ b/drivers/net/sfc/selftest.c
@@ -247,17 +247,20 @@ static int efx_test_eventq_irq(struct efx_channel *channel,
247 return 0; 247 return 0;
248} 248}
249 249
250static int efx_test_phy(struct efx_nic *efx, struct efx_self_tests *tests) 250static int efx_test_phy(struct efx_nic *efx, struct efx_self_tests *tests,
251 unsigned flags)
251{ 252{
252 int rc; 253 int rc;
253 254
254 if (!efx->phy_op->test) 255 if (!efx->phy_op->run_tests)
255 return 0; 256 return 0;
256 257
258 EFX_BUG_ON_PARANOID(efx->phy_op->num_tests == 0 ||
259 efx->phy_op->num_tests > EFX_MAX_PHY_TESTS);
260
257 mutex_lock(&efx->mac_lock); 261 mutex_lock(&efx->mac_lock);
258 rc = efx->phy_op->test(efx); 262 rc = efx->phy_op->run_tests(efx, tests->phy, flags);
259 mutex_unlock(&efx->mac_lock); 263 mutex_unlock(&efx->mac_lock);
260 tests->phy = rc ? -1 : 1;
261 return rc; 264 return rc;
262} 265}
263 266
@@ -691,7 +694,7 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests,
691 return rc_test; 694 return rc_test;
692 695
693 if (!(flags & ETH_TEST_FL_OFFLINE)) 696 if (!(flags & ETH_TEST_FL_OFFLINE))
694 return 0; 697 return efx_test_phy(efx, tests, flags);
695 698
696 /* Offline (i.e. disruptive) testing 699 /* Offline (i.e. disruptive) testing
697 * This checks MAC and PHY loopback on the specified port. */ 700 * This checks MAC and PHY loopback on the specified port. */
@@ -739,7 +742,7 @@ int efx_selftest(struct efx_nic *efx, struct efx_self_tests *tests,
739 return rc_reset; 742 return rc_reset;
740 } 743 }
741 744
742 rc = efx_test_phy(efx, tests); 745 rc = efx_test_phy(efx, tests, flags);
743 if (rc && !rc_test) 746 if (rc && !rc_test)
744 rc_test = rc; 747 rc_test = rc;
745 748