Commit f2d71c2d authored by Vitaly Wool's avatar Vitaly Wool Committed by Jeff Garzik

[PATCH] add netpoll support for gianfar: respin

The patch inlined below adds NET_POLL_CONTROLLER support for gianfar network driver, slightly modified wrt the comments from Andy Fleming.

 drivers/net/gianfar.c |   33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
Signed-off-by: default avatarVitaly Wool <vwool@ru.mvista.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 02e0e5e9
...@@ -133,6 +133,9 @@ static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); ...@@ -133,6 +133,9 @@ static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr);
#ifdef CONFIG_GFAR_NAPI #ifdef CONFIG_GFAR_NAPI
static int gfar_poll(struct net_device *dev, int *budget); static int gfar_poll(struct net_device *dev, int *budget);
#endif #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); 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 int gfar_process_frame(struct net_device *dev, struct sk_buff *skb, int length);
static void gfar_vlan_rx_register(struct net_device *netdev, static void gfar_vlan_rx_register(struct net_device *netdev,
...@@ -259,6 +262,9 @@ static int gfar_probe(struct platform_device *pdev) ...@@ -259,6 +262,9 @@ static int gfar_probe(struct platform_device *pdev)
#ifdef CONFIG_GFAR_NAPI #ifdef CONFIG_GFAR_NAPI
dev->poll = gfar_poll; dev->poll = gfar_poll;
dev->weight = GFAR_DEV_WEIGHT; dev->weight = GFAR_DEV_WEIGHT;
#endif
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = gfar_netpoll;
#endif #endif
dev->stop = gfar_close; dev->stop = gfar_close;
dev->get_stats = gfar_get_stats; dev->get_stats = gfar_get_stats;
...@@ -1536,6 +1542,33 @@ static int gfar_poll(struct net_device *dev, int *budget) ...@@ -1536,6 +1542,33 @@ static int gfar_poll(struct net_device *dev, int *budget)
} }
#endif #endif
#ifdef CONFIG_NET_POLL_CONTROLLER
/*
* Polling 'interrupt' - used by things like netconsole to send skbs
* without having to re-enable interrupts. It's not called while
* the interrupt routine is executing.
*/
static void gfar_netpoll(struct net_device *dev)
{
struct gfar_private *priv = netdev_priv(dev);
/* If the device has multiple interrupts, run tx/rx */
if (priv->einfo->device_flags & FSL_GIANFAR_DEV_HAS_MULTI_INTR) {
disable_irq(priv->interruptTransmit);
disable_irq(priv->interruptReceive);
disable_irq(priv->interruptError);
gfar_interrupt(priv->interruptTransmit, dev);
enable_irq(priv->interruptError);
enable_irq(priv->interruptReceive);
enable_irq(priv->interruptTransmit);
} else {
disable_irq(priv->interruptTransmit);
gfar_interrupt(priv->interruptTransmit, dev);
enable_irq(priv->interruptTransmit);
}
}
#endif
/* The interrupt handler for devices with one interrupt */ /* The interrupt handler for devices with one interrupt */
static irqreturn_t gfar_interrupt(int irq, void *dev_id) static irqreturn_t gfar_interrupt(int irq, void *dev_id)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment