From: Dale Farnsworth <[EMAIL PROTECTED]>

Add support for the netpoll api for use by netconsole, kgdboe, etc.

Signed-off-by: Dale Farnsworth <[EMAIL PROTECTED]>

--- linux-2.6.15-rc5-mm2/drivers/net/gianfar.c  2005-12-12 11:34:03.000000000 
-0700
+++ new/drivers/net/gianfar.c   2005-12-12 11:34:09.000000000 -0700
@@ -133,6 +133,9 @@
 #ifdef CONFIG_GFAR_NAPI
 static int gfar_poll(struct net_device *dev, int *budget);
 #endif
+#ifdef CONFIG_NET_POLL_CONTROLLER
+static void gfar_netpoll(struct net_device *dev);
+#endif
 int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit);
 static int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, int 
length);
 static void gfar_vlan_rx_register(struct net_device *netdev,
@@ -261,6 +264,9 @@
        dev->change_mtu = gfar_change_mtu;
        dev->mtu = 1500;
        dev->set_multicast_list = gfar_set_multi;
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       dev->poll_controller = gfar_netpoll;
+#endif
 
        dev->ethtool_ops = &gfar_ethtool_ops;
 
@@ -1018,6 +1024,31 @@
        return 0;
 }
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/*
+ * Polling - used by netconsole and other diagnostic tools
+ * to allow network i/o with interrupts disabled.
+ */
+static void gfar_netpoll(struct net_device *dev)
+{
+       struct gfar_private *priv = netdev_priv(dev);
+
+       if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_MULTI_INTR) {
+               disable_irq(priv->interruptReceive);
+               disable_irq(priv->interruptTransmit);
+               disable_irq(priv->interruptError);
+               gfar_interrupt(priv->interruptTransmit, dev, NULL);
+               enable_irq(priv->interruptError);
+               enable_irq(priv->interruptTransmit);
+               enable_irq(priv->interruptReceive);
+       } else {
+               disable_irq(priv->interruptTransmit);
+               gfar_interrupt(priv->interruptTransmit, dev, NULL);
+               enable_irq(priv->interruptTransmit);
+       }
+}
+#endif
+
 /* returns a net_device_stats structure pointer */
 static struct net_device_stats * gfar_get_stats(struct net_device *dev)
 {
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to