netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-2.6 1/3] sfc: Wait at most 10ms for the MC to finish reading out MAC statistics
@ 2010-04-28 19:00 Ben Hutchings
  2010-04-28 19:01 ` [PATCH net-2.6 2/3] sfc: Always close net device at the end of a disabling reset Ben Hutchings
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ben Hutchings @ 2010-04-28 19:00 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers

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

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Cc: stable@kernel.org
---
 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] 6+ messages in thread

end of thread, other threads:[~2010-04-28 19:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-28 19:00 [PATCH net-2.6 1/3] sfc: Wait at most 10ms for the MC to finish reading out MAC statistics Ben Hutchings
2010-04-28 19:01 ` [PATCH net-2.6 2/3] sfc: Always close net device at the end of a disabling reset Ben Hutchings
2010-04-28 19:18   ` David Miller
2010-04-28 19:01 ` [PATCH net-2.6 3/3] sfc: Change falcon_probe_board() to fail for unsupported boards Ben Hutchings
2010-04-28 19:18   ` David Miller
2010-04-28 19:18 ` [PATCH net-2.6 1/3] sfc: Wait at most 10ms for the MC to finish reading out MAC statistics David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).