aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2008-12-26 16:46:38 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-26 16:46:38 -0500
commita5692e49cd9e6512c48ebf61e52991cbe643c12d (patch)
tree194cc3f4a1a1822b41408781a3641c4b483a1a11 /drivers/net/sfc
parentcaa8d8bbddc9157cb8f34465be98fc83faf37155 (diff)
sfc: Clean up PHY mode management in loopback self-test
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc')
-rw-r--r--drivers/net/sfc/selftest.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c
index 6bb09f263b33..7813ab354411 100644
--- a/drivers/net/sfc/selftest.c
+++ b/drivers/net/sfc/selftest.c
@@ -564,8 +564,7 @@ efx_test_loopback(struct efx_tx_queue *tx_queue,
564 return 0; 564 return 0;
565} 565}
566 566
567static int efx_test_loopbacks(struct efx_nic *efx, struct ethtool_cmd ecmd, 567static int efx_test_loopbacks(struct efx_nic *efx, struct efx_self_tests *tests,
568 struct efx_self_tests *tests,
569 unsigned int loopback_modes) 568 unsigned int loopback_modes)
570{ 569{
571 enum efx_loopback_mode mode; 570 enum efx_loopback_mode mode;
@@ -693,7 +692,7 @@ int efx_offline_test(struct efx_nic *efx,
693{ 692{
694 enum efx_loopback_mode loopback_mode = efx->loopback_mode; 693 enum efx_loopback_mode loopback_mode = efx->loopback_mode;
695 int phy_mode = efx->phy_mode; 694 int phy_mode = efx->phy_mode;
696 struct ethtool_cmd ecmd, ecmd_test; 695 struct ethtool_cmd ecmd;
697 int rc, rc2 = 0; 696 int rc, rc2 = 0;
698 697
699 /* force the carrier state off so the kernel doesn't transmit during 698 /* force the carrier state off so the kernel doesn't transmit during
@@ -724,16 +723,12 @@ int efx_offline_test(struct efx_nic *efx,
724 /* reset the chip to recover from the register test */ 723 /* reset the chip to recover from the register test */
725 rc = falcon_reset_hw(efx, RESET_TYPE_ALL); 724 rc = falcon_reset_hw(efx, RESET_TYPE_ALL);
726 725
727 /* Modify the saved ecmd so that when efx_reset_up() restores the phy 726 /* Ensure that the phy is powered and out of loopback
728 * state, AN is disabled, and the phy is powered, and out of loopback */ 727 * for the bist and loopback tests */
729 memcpy(&ecmd_test, &ecmd, sizeof(ecmd_test)); 728 efx->phy_mode &= ~PHY_MODE_LOW_POWER;
730 if (ecmd_test.autoneg == AUTONEG_ENABLE) {
731 ecmd_test.autoneg = AUTONEG_DISABLE;
732 ecmd_test.duplex = DUPLEX_FULL;
733 }
734 efx->loopback_mode = LOOPBACK_NONE; 729 efx->loopback_mode = LOOPBACK_NONE;
735 730
736 rc = efx_reset_up(efx, &ecmd_test, rc == 0); 731 rc = efx_reset_up(efx, &ecmd, rc == 0);
737 if (rc) { 732 if (rc) {
738 EFX_ERR(efx, "Unable to recover from chip test\n"); 733 EFX_ERR(efx, "Unable to recover from chip test\n");
739 efx_schedule_reset(efx, RESET_TYPE_DISABLE); 734 efx_schedule_reset(efx, RESET_TYPE_DISABLE);
@@ -744,7 +739,7 @@ int efx_offline_test(struct efx_nic *efx,
744 if (rc && !rc2) 739 if (rc && !rc2)
745 rc2 = rc; 740 rc2 = rc;
746 741
747 rc = efx_test_loopbacks(efx, ecmd_test, tests, loopback_modes); 742 rc = efx_test_loopbacks(efx, tests, loopback_modes);
748 if (rc && !rc2) 743 if (rc && !rc2)
749 rc2 = rc; 744 rc2 = rc;
750 745