Skip to contentSkip to conversation

(3/3) 8139too -- poll_controller

RFT Stephen Hemminger 1 participant 1 message Nov 19, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

For net-drivers-2.5-exp, add a poll_controller hook to allow use of netconsole with this driver.

jeff, don't have netconsole setup to test this so please give it a try before including it.

drivers/net/8139too.c +16 -0
diff -Nru a/drivers/net/8139too.c b/drivers/net/8139too.c
@@ -612,6 +612,7 @@
 static int rtl8139_start_xmit (struct sk_buff *skb,
 			       struct net_device *dev);
 static int rtl8139_poll(struct net_device *dev, int *budget);
+static void rtl8139_poll_controller(struct net_device *dev);
 static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance,
 			       struct pt_regs *regs);
 static int rtl8139_close (struct net_device *dev);
@@ -989,6 +990,9 @@
 	dev->ethtool_ops = &rtl8139_ethtool_ops;
 	dev->tx_timeout = rtl8139_tx_timeout;
 	dev->watchdog_timeo = TX_TIMEOUT;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	dev->poll_controller = rtl8139_poll_controller;
+#endif
 
 	/* note: the hardware is not capable of sg/csum/highdma, however
 	 * through the use of skb_copy_and_csum_dev we enable these
@@ -2184,6 +2188,18 @@
 	return IRQ_RETVAL(handled);
 }
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/*
+ * Polling receive - used by netconsole and other diagnostic tools
+ * to allow network i/o with interrupts disabled.
+ */
+static void rtl8139_poll_controller(struct net_device *dev)
+{
+	disable_irq(dev->irq);
+	rtl8139_interrupt(dev->irq, dev, NULL);
+	enable_irq(dev->irq);
+}
+#endif
 
 static int rtl8139_close (struct net_device *dev)
 {