Message ID | 20120123182443.GA22963@phenom.dumpdata.com |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
On Mon, 2012-01-23 at 18:24 +0000, Konrad Rzeszutek Wilk wrote: > Ok, so let me update the git commit description to include this. > > I am listed as the maintainer but I would have thought that it should > go through David? Generally folks listed as specific network driver maintainers are sub-maintainers under David, so the flow would be You->David->Linus. For netback I generally don't bother with the "You->" bit but just Ack them on list and David picks them up. > David, should it go through you or should I stick it in my tree? Here > is the patch with a better git description. > > From 1c265b7946f222ab6a5aac5245a0ab84618772c8 Mon Sep 17 00:00:00 2001 > From: Zhenzhong Duan <zhenzhong.duan@oracle.com> > Date: Thu, 12 Jan 2012 10:18:29 +0800 > Subject: [PATCH] xen/netfront: add netconsole support. > > add polling interface to xen-netfront device to support netconsole > > This patch also alters the spin_lock usage to use irqsave variant. > Documentation/networking/netdevices.txt states that start_xmit > can be called with interrupts disabled by netconsole and therefore using > the irqsave/restore locking in this function is looks correct. > > Signed-off-by: Tina.Yang <tina.yang@oracle.com> > Cc: Jeremy Fitzhardinge <jeremy@goop.org> > Signed-off-by: Zhenzhong.Duan <zhenzhong.duan@oracle.com> > Tested-by: gurudas.pai <gurudas.pai@oracle.com> > [v1: Copy-n-pasted Ian Campbell comments] > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Acked-by: Ian Campbell <ian.campbell@citrix.com> -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Ian Campbell <Ian.Campbell@citrix.com> Date: Tue, 24 Jan 2012 08:58:00 +0000 > On Mon, 2012-01-23 at 18:24 +0000, Konrad Rzeszutek Wilk wrote: > >> From 1c265b7946f222ab6a5aac5245a0ab84618772c8 Mon Sep 17 00:00:00 2001 >> From: Zhenzhong Duan <zhenzhong.duan@oracle.com> >> Date: Thu, 12 Jan 2012 10:18:29 +0800 >> Subject: [PATCH] xen/netfront: add netconsole support. >> >> add polling interface to xen-netfront device to support netconsole >> >> This patch also alters the spin_lock usage to use irqsave variant. >> Documentation/networking/netdevices.txt states that start_xmit >> can be called with interrupts disabled by netconsole and therefore using >> the irqsave/restore locking in this function is looks correct. >> >> Signed-off-by: Tina.Yang <tina.yang@oracle.com> >> Cc: Jeremy Fitzhardinge <jeremy@goop.org> >> Signed-off-by: Zhenzhong.Duan <zhenzhong.duan@oracle.com> >> Tested-by: gurudas.pai <gurudas.pai@oracle.com> >> [v1: Copy-n-pasted Ian Campbell comments] >> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> > > Acked-by: Ian Campbell <ian.campbell@citrix.com> Applied. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index d29365a..5a4b5df 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c @@ -478,6 +478,7 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev) int frags = skb_shinfo(skb)->nr_frags; unsigned int offset = offset_in_page(data); unsigned int len = skb_headlen(skb); + unsigned long flags; frags += DIV_ROUND_UP(offset + len, PAGE_SIZE); if (unlikely(frags > MAX_SKB_FRAGS + 1)) { @@ -487,12 +488,12 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev) goto drop; } - spin_lock_irq(&np->tx_lock); + spin_lock_irqsave(&np->tx_lock, flags); if (unlikely(!netif_carrier_ok(dev) || (frags > 1 && !xennet_can_sg(dev)) || netif_needs_gso(skb, netif_skb_features(skb)))) { - spin_unlock_irq(&np->tx_lock); + spin_unlock_irqrestore(&np->tx_lock, flags); goto drop; } @@ -561,7 +562,7 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev) if (!netfront_tx_slot_available(np)) netif_stop_queue(dev); - spin_unlock_irq(&np->tx_lock); + spin_unlock_irqrestore(&np->tx_lock, flags); return NETDEV_TX_OK; @@ -1176,6 +1177,33 @@ static int xennet_set_features(struct net_device *dev, u32 features) return 0; } +static irqreturn_t xennet_interrupt(int irq, void *dev_id) +{ + struct net_device *dev = dev_id; + struct netfront_info *np = netdev_priv(dev); + unsigned long flags; + + spin_lock_irqsave(&np->tx_lock, flags); + + if (likely(netif_carrier_ok(dev))) { + xennet_tx_buf_gc(dev); + /* Under tx_lock: protects access to rx shared-ring indexes. */ + if (RING_HAS_UNCONSUMED_RESPONSES(&np->rx)) + napi_schedule(&np->napi); + } + + spin_unlock_irqrestore(&np->tx_lock, flags); + + return IRQ_HANDLED; +} + +#ifdef CONFIG_NET_POLL_CONTROLLER +static void xennet_poll_controller(struct net_device *dev) +{ + xennet_interrupt(0, dev); +} +#endif + static const struct net_device_ops xennet_netdev_ops = { .ndo_open = xennet_open, .ndo_uninit = xennet_uninit, @@ -1186,6 +1214,9 @@ static const struct net_device_ops xennet_netdev_ops = { .ndo_validate_addr = eth_validate_addr, .ndo_fix_features = xennet_fix_features, .ndo_set_features = xennet_set_features, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = xennet_poll_controller, +#endif }; static struct net_device * __devinit xennet_create_dev(struct xenbus_device *dev) @@ -1388,26 +1419,6 @@ static int xen_net_read_mac(struct xenbus_device *dev, u8 mac[]) return 0; } -static irqreturn_t xennet_interrupt(int irq, void *dev_id) -{ - struct net_device *dev = dev_id; - struct netfront_info *np = netdev_priv(dev); - unsigned long flags; - - spin_lock_irqsave(&np->tx_lock, flags); - - if (likely(netif_carrier_ok(dev))) { - xennet_tx_buf_gc(dev); - /* Under tx_lock: protects access to rx shared-ring indexes. */ - if (RING_HAS_UNCONSUMED_RESPONSES(&np->rx)) - napi_schedule(&np->napi); - } - - spin_unlock_irqrestore(&np->tx_lock, flags); - - return IRQ_HANDLED; -} - static int setup_netfront(struct xenbus_device *dev, struct netfront_info *info) { struct xen_netif_tx_sring *txs;