aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/selftest.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2008-12-13 00:50:08 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-13 00:58:17 -0500
commit177dfcd80f28f8fbc3e22c2d8b24d21cb86f1d97 (patch)
treea6e5e9949f388d48ac20c4efbb2811762ac5f9d4 /drivers/net/sfc/selftest.c
parent356eebb2b3af24cc701823f1e025f04eef333239 (diff)
sfc: Add support for sub-10G speeds
The SFC4000 has a separate MAC for use at sub-10G speeds. Introduce an efx_mac_operations structure with implementations for the two MACs. Switch between the MACs as necessary. PHY settings are independent of the MAC, so add get_settings() and set_settings() to efx_phy_operations. Also add macs field to indicate which MACs the PHY is connected to. 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.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c
index 362956e3fe17..8142e37a518f 100644
--- a/drivers/net/sfc/selftest.c
+++ b/drivers/net/sfc/selftest.c
@@ -26,7 +26,6 @@
26#include "selftest.h" 26#include "selftest.h"
27#include "boards.h" 27#include "boards.h"
28#include "workarounds.h" 28#include "workarounds.h"
29#include "mac.h"
30#include "spi.h" 29#include "spi.h"
31#include "falcon_io.h" 30#include "falcon_io.h"
32#include "mdio_10g.h" 31#include "mdio_10g.h"
@@ -105,9 +104,11 @@ static int efx_test_mii(struct efx_nic *efx, struct efx_self_tests *tests)
105 goto out; 104 goto out;
106 } 105 }
107 106
108 rc = mdio_clause45_check_mmds(efx, efx->phy_op->mmds, 0); 107 if (EFX_IS10G(efx)) {
109 if (rc) 108 rc = mdio_clause45_check_mmds(efx, efx->phy_op->mmds, 0);
110 goto out; 109 if (rc)
110 goto out;
111 }
111 112
112out: 113out:
113 mutex_unlock(&efx->mac_lock); 114 mutex_unlock(&efx->mac_lock);
@@ -598,7 +599,7 @@ static int efx_test_loopbacks(struct efx_nic *efx, struct ethtool_cmd ecmd,
598 do { 599 do {
599 struct efx_channel *channel = &efx->channel[0]; 600 struct efx_channel *channel = &efx->channel[0];
600 601
601 falcon_check_xmac(efx); 602 efx->mac_op->check_hw(efx);
602 schedule_timeout_uninterruptible(HZ / 10); 603 schedule_timeout_uninterruptible(HZ / 10);
603 if (channel->work_pending) 604 if (channel->work_pending)
604 efx_process_channel_now(channel); 605 efx_process_channel_now(channel);
@@ -606,13 +607,12 @@ static int efx_test_loopbacks(struct efx_nic *efx, struct ethtool_cmd ecmd,
606 flush_workqueue(efx->workqueue); 607 flush_workqueue(efx->workqueue);
607 rmb(); 608 rmb();
608 609
609 /* efx->link_up can be 1 even if the XAUI link is down, 610 /* We need both the phy and xaui links to be ok.
610 * (bug5762). Usually, it's not worth bothering with the 611 * rather than relying on the falcon_xmac irq/poll
611 * difference, but for selftests, we need that extra 612 * regime, just poll xaui directly */
612 * guarantee that the link is really, really, up.
613 */
614 link_up = efx->link_up; 613 link_up = efx->link_up;
615 if (!falcon_xaui_link_ok(efx)) 614 if (link_up && EFX_IS10G(efx) &&
615 !falcon_xaui_link_ok(efx))
616 link_up = false; 616 link_up = false;
617 617
618 } while ((++count < 20) && !link_up); 618 } while ((++count < 20) && !link_up);
@@ -721,7 +721,6 @@ int efx_offline_test(struct efx_nic *efx,
721 if (ecmd_test.autoneg == AUTONEG_ENABLE) { 721 if (ecmd_test.autoneg == AUTONEG_ENABLE) {
722 ecmd_test.autoneg = AUTONEG_DISABLE; 722 ecmd_test.autoneg = AUTONEG_DISABLE;
723 ecmd_test.duplex = DUPLEX_FULL; 723 ecmd_test.duplex = DUPLEX_FULL;
724 ecmd_test.speed = SPEED_10000;
725 } 724 }
726 efx->loopback_mode = LOOPBACK_NONE; 725 efx->loopback_mode = LOOPBACK_NONE;
727 726
@@ -732,9 +731,6 @@ int efx_offline_test(struct efx_nic *efx,
732 return rc; 731 return rc;
733 } 732 }
734 733
735 tests->loopback_speed = ecmd_test.speed;
736 tests->loopback_full_duplex = ecmd_test.duplex;
737
738 rc = efx_test_phy(efx, tests); 734 rc = efx_test_phy(efx, tests);
739 if (rc && !rc2) 735 if (rc && !rc2)
740 rc2 = rc; 736 rc2 = rc;