diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2010-04-28 05:00:35 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-05-12 18:02:34 -0400 |
commit | fa8472cab002dbbb70bf2b1c975b56f75e5d88c6 (patch) | |
tree | 611a18eb6b7b688a8dbc23f66d8acef397aca2e5 /drivers/net | |
parent | b916189a5e80cabb49b1c64a350a5f13e485cb61 (diff) |
sfc: Wait at most 10ms for the MC to finish reading out MAC statistics
commit aabc5649078310094cbffb430fcbf9c25b6268f9 upstream.
The original code would wait indefinitely if MAC stats DMA failed.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/net')
-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 f8c6771e66d8..afbac2d82519 100644 --- a/drivers/net/sfc/siena.c +++ b/drivers/net/sfc/siena.c | |||
@@ -454,8 +454,17 @@ static int siena_try_update_nic_stats(struct efx_nic *efx) | |||
454 | 454 | ||
455 | static void siena_update_nic_stats(struct efx_nic *efx) | 455 | static void siena_update_nic_stats(struct efx_nic *efx) |
456 | { | 456 | { |
457 | while (siena_try_update_nic_stats(efx) == -EAGAIN) | 457 | int retry; |
458 | cpu_relax(); | 458 | |
459 | /* If we're unlucky enough to read statistics wduring the DMA, wait | ||
460 | * up to 10ms for it to finish (typically takes <500us) */ | ||
461 | for (retry = 0; retry < 100; ++retry) { | ||
462 | if (siena_try_update_nic_stats(efx) == 0) | ||
463 | return; | ||
464 | udelay(100); | ||
465 | } | ||
466 | |||
467 | /* Use the old values instead */ | ||
459 | } | 468 | } |
460 | 469 | ||
461 | static void siena_start_nic_stats(struct efx_nic *efx) | 470 | static void siena_start_nic_stats(struct efx_nic *efx) |