diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2010-04-28 05:00:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-28 15:18:26 -0400 |
commit | aabc5649078310094cbffb430fcbf9c25b6268f9 (patch) | |
tree | c633f0c143068b22558547081cf90544846b409f /drivers/net/sfc/siena.c | |
parent | c0786693404cffd80ca3cb6e75ee7b35186b2825 (diff) |
sfc: Wait at most 10ms for the MC to finish reading out MAC statistics
The original code would wait indefinitely if MAC stats DMA failed.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Cc: stable@kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/siena.c')
-rw-r--r-- | drivers/net/sfc/siena.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c index 38dcc42c4f79..e0c46f59d1f8 100644 --- a/drivers/net/sfc/siena.c +++ b/drivers/net/sfc/siena.c | |||
@@ -456,8 +456,17 @@ static int siena_try_update_nic_stats(struct efx_nic *efx) | |||
456 | 456 | ||
457 | static void siena_update_nic_stats(struct efx_nic *efx) | 457 | static void siena_update_nic_stats(struct efx_nic *efx) |
458 | { | 458 | { |
459 | while (siena_try_update_nic_stats(efx) == -EAGAIN) | 459 | int retry; |
460 | cpu_relax(); | 460 | |
461 | /* If we're unlucky enough to read statistics wduring the DMA, wait | ||
462 | * up to 10ms for it to finish (typically takes <500us) */ | ||
463 | for (retry = 0; retry < 100; ++retry) { | ||
464 | if (siena_try_update_nic_stats(efx) == 0) | ||
465 | return; | ||
466 | udelay(100); | ||
467 | } | ||
468 | |||
469 | /* Use the old values instead */ | ||
461 | } | 470 | } |
462 | 471 | ||
463 | static void siena_start_nic_stats(struct efx_nic *efx) | 472 | static void siena_start_nic_stats(struct efx_nic *efx) |