aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2x_main.c
diff options
context:
space:
mode:
authorEilon Greenstein <eilong@broadcom.com>2009-01-22 01:01:32 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-22 16:47:12 -0500
commit3910c8ae44c59cebed721e33aa496f0a385b4e03 (patch)
treef299416ca45f71484235a599d7ecff46e901fd4e /drivers/net/bnx2x_main.c
parent5650d9d4cbf3898d3f9725ccad5dfca6bc086324 (diff)
bnx2x: loopback test failure
A link change interrupt might be queued and activated after the loopback was set and it will cause the loopback to fail. The PHY lock should be kept until the loopback test is over. That implies that the bnx2x_test_link should used within the loopback function and not bnx2x_wait_for_link since that function also takes the PHY link Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x_main.c')
-rw-r--r--drivers/net/bnx2x_main.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index f71b8a5872b3..d95714f780f3 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -8750,18 +8750,17 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode, u8 link_up)
8750 8750
8751 if (loopback_mode == BNX2X_MAC_LOOPBACK) { 8751 if (loopback_mode == BNX2X_MAC_LOOPBACK) {
8752 bp->link_params.loopback_mode = LOOPBACK_BMAC; 8752 bp->link_params.loopback_mode = LOOPBACK_BMAC;
8753 bnx2x_acquire_phy_lock(bp);
8754 bnx2x_phy_init(&bp->link_params, &bp->link_vars); 8753 bnx2x_phy_init(&bp->link_params, &bp->link_vars);
8755 bnx2x_release_phy_lock(bp);
8756 8754
8757 } else if (loopback_mode == BNX2X_PHY_LOOPBACK) { 8755 } else if (loopback_mode == BNX2X_PHY_LOOPBACK) {
8756 u16 cnt = 1000;
8758 bp->link_params.loopback_mode = LOOPBACK_XGXS_10; 8757 bp->link_params.loopback_mode = LOOPBACK_XGXS_10;
8759 bnx2x_acquire_phy_lock(bp);
8760 bnx2x_phy_init(&bp->link_params, &bp->link_vars); 8758 bnx2x_phy_init(&bp->link_params, &bp->link_vars);
8761 bnx2x_release_phy_lock(bp);
8762 /* wait until link state is restored */ 8759 /* wait until link state is restored */
8763 bnx2x_wait_for_link(bp, link_up); 8760 if (link_up)
8764 8761 while (cnt-- && bnx2x_test_link(&bp->link_params,
8762 &bp->link_vars))
8763 msleep(10);
8765 } else 8764 } else
8766 return -EINVAL; 8765 return -EINVAL;
8767 8766
@@ -8867,6 +8866,7 @@ static int bnx2x_test_loopback(struct bnx2x *bp, u8 link_up)
8867 return BNX2X_LOOPBACK_FAILED; 8866 return BNX2X_LOOPBACK_FAILED;
8868 8867
8869 bnx2x_netif_stop(bp, 1); 8868 bnx2x_netif_stop(bp, 1);
8869 bnx2x_acquire_phy_lock(bp);
8870 8870
8871 if (bnx2x_run_loopback(bp, BNX2X_MAC_LOOPBACK, link_up)) { 8871 if (bnx2x_run_loopback(bp, BNX2X_MAC_LOOPBACK, link_up)) {
8872 DP(NETIF_MSG_PROBE, "MAC loopback failed\n"); 8872 DP(NETIF_MSG_PROBE, "MAC loopback failed\n");
@@ -8878,6 +8878,7 @@ static int bnx2x_test_loopback(struct bnx2x *bp, u8 link_up)
8878 rc |= BNX2X_PHY_LOOPBACK_FAILED; 8878 rc |= BNX2X_PHY_LOOPBACK_FAILED;
8879 } 8879 }
8880 8880
8881 bnx2x_release_phy_lock(bp);
8881 bnx2x_netif_start(bp); 8882 bnx2x_netif_start(bp);
8882 8883
8883 return rc; 8884 return rc;