aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc
diff options
context:
space:
mode:
authorSteve Hodgson <shodgson@solarflare.com>2010-06-01 07:18:28 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-02 05:21:07 -0400
commit901d3fe848d8c34988699592c9f4b98c2ce10a8b (patch)
tree4b5e6a1930da8155d131b2ad9c774f929d2d6f21 /drivers/net/sfc
parentcffe9d4cdafdffa840abeb55c50fd2df2d7b0cdb (diff)
sfc: Wait for the link to stay up before running loopback selftest
It's been observed that some phys (such as the qt2025c) can do down-up-down-up transitions, presumably as pcs block lock settles down. The loopback selftest will start sending data immediately after the link comes up. Work around this by waiting for the link state to stay up for two consecutive polls, rather than one. 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.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/net/sfc/selftest.c b/drivers/net/sfc/selftest.c
index 371e86cc090f..52ac14af83a4 100644
--- a/drivers/net/sfc/selftest.c
+++ b/drivers/net/sfc/selftest.c
@@ -545,7 +545,7 @@ efx_test_loopback(struct efx_tx_queue *tx_queue,
545static int efx_wait_for_link(struct efx_nic *efx) 545static int efx_wait_for_link(struct efx_nic *efx)
546{ 546{
547 struct efx_link_state *link_state = &efx->link_state; 547 struct efx_link_state *link_state = &efx->link_state;
548 int count; 548 int count, link_up_count = 0;
549 bool link_up; 549 bool link_up;
550 550
551 for (count = 0; count < 40; count++) { 551 for (count = 0; count < 40; count++) {
@@ -567,8 +567,12 @@ static int efx_wait_for_link(struct efx_nic *efx)
567 link_up = !efx->mac_op->check_fault(efx); 567 link_up = !efx->mac_op->check_fault(efx);
568 mutex_unlock(&efx->mac_lock); 568 mutex_unlock(&efx->mac_lock);
569 569
570 if (link_up) 570 if (link_up) {
571 return 0; 571 if (++link_up_count == 2)
572 return 0;
573 } else {
574 link_up_count = 0;
575 }
572 } 576 }
573 577
574 return -ETIMEDOUT; 578 return -ETIMEDOUT;