Skip to content

Commit

Permalink
sfc: Wait at most 10ms for the MC to finish reading out MAC statistics
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Apr 28, 2010
1 parent c078669 commit aabc564
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions drivers/net/sfc/siena.c
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,17 @@ static int siena_try_update_nic_stats(struct efx_nic *efx)

static void siena_update_nic_stats(struct efx_nic *efx)
{
while (siena_try_update_nic_stats(efx) == -EAGAIN)
cpu_relax();
int retry;

/* If we're unlucky enough to read statistics wduring the DMA, wait
* up to 10ms for it to finish (typically takes <500us) */
for (retry = 0; retry < 100; ++retry) {
if (siena_try_update_nic_stats(efx) == 0)
return;
udelay(100);
}

/* Use the old values instead */
}

static void siena_start_nic_stats(struct efx_nic *efx)
Expand Down

0 comments on commit aabc564

Please sign in to comment.