netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 12/19] fix irq problem with NAPI + NETPOLL
@ 2007-03-06 10:41 akpm
  2007-03-06 11:06 ` Jeff Garzik
  2007-03-07 23:18 ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: akpm @ 2007-03-06 10:41 UTC (permalink / raw)
  To: jeff; +Cc: netdev, akpm, anemo, davem, romieu

From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

It seems netif_receive_skb() was designed not to call from irq context, but
NAPI + NETPOLL break this rule.  If netif_receive_skb() was called from irq
context, redirect to netif_rx() instead of processing the skb in that
context.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Francois Romieu <romieu@fr.zoreil.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 net/core/dev.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff -puN net/core/dev.c~8139too-fix-irq-problem-with-napi-netpoll net/core/dev.c
--- a/net/core/dev.c~8139too-fix-irq-problem-with-napi-netpoll
+++ a/net/core/dev.c
@@ -1769,8 +1769,15 @@ int netif_receive_skb(struct sk_buff *sk
 	__be16 type;
 
 	/* if we've gotten here through NAPI, check netpoll */
-	if (skb->dev->poll && netpoll_rx(skb))
-		return NET_RX_DROP;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	if (skb->dev->poll && skb->dev->poll_controller) {
+		/* NAPI poll might be called in irq context on NETPOLL */
+		if (in_irq() || irqs_disabled())
+			return netif_rx(skb);
+		if (netpoll_rx(skb))
+			return NET_RX_DROP;
+	}
+#endif
 
 	if (!skb->tstamp.off_sec)
 		net_timestamp(skb);
_

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

end of thread, other threads:[~2007-03-13  8:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-06 10:41 [patch 12/19] fix irq problem with NAPI + NETPOLL akpm
2007-03-06 11:06 ` Jeff Garzik
2007-03-06 11:14   ` Andrew Morton
2007-03-07 23:18 ` David Miller
2007-03-08  1:35   ` Atsushi Nemoto
2007-03-13  8:14     ` Atsushi Nemoto

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).