From: Ben Hutchings Date: Wed, 28 Apr 2010 09:00:35 +0000 (+0000) Subject: sfc: Wait at most 10ms for the MC to finish reading out MAC statistics X-Git-Tag: upstream/snapshot3+hdmi~14680^2~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aabc5649078310094cbffb430fcbf9c25b6268f9;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git 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 Cc: stable@kernel.org Signed-off-by: David S. Miller --- diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c index 38dcc42..e0c46f5 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) 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)