summaryrefslogtreecommitdiffstats
path: root/net/core/netpoll.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2006-10-26 15:46:53 -0700
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-02 21:22:35 -0800
commit6c43ff18f91e54aa7555d8ae4f26eab7da5bce68 (patch)
tree6db170a9a05bc78b3d0e992877da7eab0c8650de /net/core/netpoll.c
parentb41848b61bae30e3661efd4ec62ea380cedef687 (diff)
downloadlinux-6c43ff18f91e54aa7555d8ae4f26eab7da5bce68.tar.bz2
netpoll deferred transmit path
When the netpoll beast got busy, he tended to babble. Instead of talking out of his large mouth as normal, he tended to try to snort out other orifices. This lead to words (skbs) ending up in odd places (like NIT) that he did not intend. The normal way of talking wouldn't work, but he could at least change to using the same tone all the time. Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Diffstat (limited to 'net/core/netpoll.c')
-rw-r--r--net/core/netpoll.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 621baa5da49f..93cb828f3aaf 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -55,9 +55,25 @@ static void queue_process(void *p)
struct netpoll_info *npinfo = p;
struct sk_buff *skb;
- while ((skb = skb_dequeue(&npinfo->txq)))
- dev_queue_xmit(skb);
+ while ((skb = skb_dequeue(&npinfo->txq))) {
+ struct net_device *dev = skb->dev;
+ if (!netif_device_present(dev) || !netif_running(dev)) {
+ __kfree_skb(skb);
+ continue;
+ }
+
+ netif_tx_lock_bh(dev);
+ if (netif_queue_stopped(dev) ||
+ dev->hard_start_xmit(skb, dev) != NETDEV_TX_OK) {
+ skb_queue_head(&npinfo->txq, skb);
+ netif_tx_unlock_bh(dev);
+
+ schedule_delayed_work(&npinfo->tx_work, HZ/10);
+ return;
+ }
+ netif_tx_unlock_bh(dev);
+ }
}
void netpoll_queue(struct sk_buff *skb)
@@ -765,6 +781,7 @@ void netpoll_cleanup(struct netpoll *np)
if (atomic_dec_and_test(&npinfo->refcnt)) {
skb_queue_purge(&npinfo->arp_tx);
skb_queue_purge(&npinfo->txq);
+ cancel_rearming_delayed_work(&npinfo->tx_work);
flush_scheduled_work();
kfree(npinfo);