netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sfc: Call netif_napi_add() before registering our interrupt handler
@ 2009-03-31 19:07 Ben Hutchings
  2009-03-31 22:07 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Hutchings @ 2009-03-31 19:07 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-net-drivers

If we use a shared legacy IRQ then our interrupt handler may be called
as soon as it is registered even though IRQs are disabled on the NIC.
Now that the legacy interrupt handler also checks for event delivery,
it may decide to schedule polling in this case.  Ensure that the NAPI
context is valid but disabled at this point.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
Please apply this to net-2.6; the bug it fixes is much easier to hit
following commit a9de9a74c69f75e9456cd6b45ecab44ff4c81d04

Ben.

 drivers/net/sfc/efx.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
index 00c23b1..dee23b1 100644
--- a/drivers/net/sfc/efx.c
+++ b/drivers/net/sfc/efx.c
@@ -448,6 +448,9 @@ static void efx_init_channels(struct efx_nic *efx)
 
 		WARN_ON(channel->rx_pkt != NULL);
 		efx_rx_strategy(channel);
+
+		netif_napi_add(channel->napi_dev, &channel->napi_str,
+			       efx_poll, napi_weight);
 	}
 }
 
@@ -462,10 +465,6 @@ static void efx_start_channel(struct efx_channel *channel)
 
 	EFX_LOG(channel->efx, "starting chan %d\n", channel->channel);
 
-	if (!(channel->efx->net_dev->flags & IFF_UP))
-		netif_napi_add(channel->napi_dev, &channel->napi_str,
-			       efx_poll, napi_weight);
-
 	/* The interrupt handler for this channel may set work_pending
 	 * as soon as we enable it.  Make sure it's cleared before
 	 * then.  Similarly, make sure it sees the enabled flag set. */

-- 
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] 2+ messages in thread

* Re: [PATCH] sfc: Call netif_napi_add() before registering our interrupt handler
  2009-03-31 19:07 [PATCH] sfc: Call netif_napi_add() before registering our interrupt handler Ben Hutchings
@ 2009-03-31 22:07 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-03-31 22:07 UTC (permalink / raw)
  To: bhutchings; +Cc: netdev, linux-net-drivers

From: Ben Hutchings <bhutchings@solarflare.com>
Date: Tue, 31 Mar 2009 20:07:44 +0100

> If we use a shared legacy IRQ then our interrupt handler may be called
> as soon as it is registered even though IRQs are disabled on the NIC.
> Now that the legacy interrupt handler also checks for event delivery,
> it may decide to schedule polling in this case.  Ensure that the NAPI
> context is valid but disabled at this point.
> 
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>

Applied, thanks.

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

end of thread, other threads:[~2009-03-31 22:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-31 19:07 [PATCH] sfc: Call netif_napi_add() before registering our interrupt handler Ben Hutchings
2009-03-31 22:07 ` 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).