public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-2.6 1/9] sfc: Wait at most 10ms for the MC to finish reading out MAC statistics
@ 2010-04-23 22:23 Ben Hutchings
  2010-04-23 22:33 ` Ben Hutchings
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Hutchings @ 2010-04-23 22:23 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers

From: Steve Hodgson <shodgson@solarflare.com>

The original code would wait indefinitely if MAC stats DMA failed.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
 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 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)
-- 
1.6.2.5


-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-04-23 22:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-23 22:23 [PATCH net-2.6 1/9] sfc: Wait at most 10ms for the MC to finish reading out MAC statistics Ben Hutchings
2010-04-23 22:33 ` Ben Hutchings
2010-04-23 22:36   ` David Miller
2010-04-23 22:54     ` Ben Hutchings
2010-04-23 22:58       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox