linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] gianfar: Make polling safe with IRQs disabled
@ 2009-11-04 22:57 Anton Vorontsov
  2009-11-05 14:01 ` Jon Loeliger
  2009-11-08  9:05 ` [PATCH RFC] gianfar: Make polling safe with IRQs disabled David Miller
  0 siblings, 2 replies; 16+ messages in thread
From: Anton Vorontsov @ 2009-11-04 22:57 UTC (permalink / raw)
  To: David Miller; +Cc: linuxppc-dev, netdev, Andy Fleming, Jason Wessel

When using KGDBoE, gianfar driver spits 'Interrupt problem' messages,
which appears to be a legitimate warning, i.e. we may end up calling
netif_receive_skb() or vlan_hwaccel_receive_skb() with IRQs disabled.

This patch reworks the RX path so that if netpoll is enabled (the
only case when the driver don't know from what context the polling
may be called), we check whether IRQs are disabled, and if so we
fall back to safe variants of skb receiving functions.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---

I'm not sure if this is suitable for mainline since it doesn't
have KGDBoE support. Jason, if the patch is OK, would you like
to merge it into KGDB tree?

 drivers/net/gianfar.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 197b358..024ca4a 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -2412,9 +2412,17 @@ static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb,
 {
 	struct gfar_private *priv = netdev_priv(dev);
 	struct rxfcb *fcb = NULL;
-
+	int irqs_dis = 0;
 	int ret;
 
+	/*
+	 * With netpoll we don't know from what context we're called (e.g
+	 * KGDBoE may call us from an exception handler), otherwise we're
+	 * pretty sure that IRQs are enabled.
+	 */
+#ifdef CONFIG_NETPOLL
+	irqs_dis = irqs_disabled();
+#endif
 	/* fcb is at the beginning if exists */
 	fcb = (struct rxfcb *)skb->data;
 
@@ -2432,7 +2440,10 @@ static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb,
 
 	/* Send the packet up the stack */
 	if (unlikely(priv->vlgrp && (fcb->flags & RXFCB_VLN)))
-		ret = vlan_hwaccel_receive_skb(skb, priv->vlgrp, fcb->vlctl);
+		ret = __vlan_hwaccel_rx(skb, priv->vlgrp, fcb->vlctl,
+					!irqs_dis);
+	else if (irqs_dis)
+		ret = netif_rx(skb);
 	else
 		ret = netif_receive_skb(skb);
 
@@ -2504,8 +2515,6 @@ int gfar_clean_rx_ring(struct gfar_priv_rx_q *rx_queue, int rx_work_limit)
 				skb_put(skb, pkt_len);
 				dev->stats.rx_bytes += pkt_len;
 
-				if (in_irq() || irqs_disabled())
-					printk("Interrupt problem!\n");
 				gfar_process_frame(dev, skb, amount_pull);
 
 			} else {
-- 
1.6.3.3

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

end of thread, other threads:[~2009-11-09 13:41 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-04 22:57 [PATCH RFC] gianfar: Make polling safe with IRQs disabled Anton Vorontsov
2009-11-05 14:01 ` Jon Loeliger
2009-11-05 14:20   ` Anton Vorontsov
2009-11-05 14:41     ` Jon Loeliger
2009-11-05 15:43       ` Jon Loeliger
2009-11-05 16:57         ` [PATCH RFC] gianfar: Do not call skb recycling with disabled IRQs Anton Vorontsov
2009-11-05 17:23           ` Kumar Gopalpet-B05799
2009-11-05 17:34             ` Anton Vorontsov
2009-11-05 17:40             ` Jon Loeliger
2009-11-05 17:53               ` Anton Vorontsov
2009-11-06 20:38                 ` Jon Loeliger
2009-11-05 17:53               ` Kumar Gopalpet-B05799
2009-11-08  9:08           ` David Miller
2009-11-09 13:41             ` Anton Vorontsov
2009-11-08  9:05 ` [PATCH RFC] gianfar: Make polling safe with IRQs disabled David Miller
2009-11-09 13:32   ` Anton Vorontsov

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