[MIPS] Move some kernel globals from asm file to C file.
[powerpc.git] / net / core / netpoll.c
index 8a27128..823215d 100644 (file)
@@ -55,6 +55,7 @@ static void queue_process(struct work_struct *work)
        struct netpoll_info *npinfo =
                container_of(work, struct netpoll_info, tx_work.work);
        struct sk_buff *skb;
+       unsigned long flags;
 
        while ((skb = skb_dequeue(&npinfo->txq))) {
                struct net_device *dev = skb->dev;
@@ -64,15 +65,19 @@ static void queue_process(struct work_struct *work)
                        continue;
                }
 
-               netif_tx_lock_bh(dev);
+               local_irq_save(flags);
+               netif_tx_lock(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);
+                       netif_tx_unlock(dev);
+                       local_irq_restore(flags);
 
                        schedule_delayed_work(&npinfo->tx_work, HZ/10);
                        return;
                }
+               netif_tx_unlock(dev);
+               local_irq_restore(flags);
        }
 }
 
@@ -242,22 +247,28 @@ static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
 
        /* don't get messages out of order, and no recursion */
        if (skb_queue_len(&npinfo->txq) == 0 &&
-           npinfo->poll_owner != smp_processor_id() &&
-           netif_tx_trylock(dev)) {
-               /* try until next clock tick */
-               for (tries = jiffies_to_usecs(1)/USEC_PER_POLL; tries > 0; --tries) {
-                       if (!netif_queue_stopped(dev))
-                               status = dev->hard_start_xmit(skb, dev);
+                   npinfo->poll_owner != smp_processor_id()) {
+               unsigned long flags;
 
-                       if (status == NETDEV_TX_OK)
-                               break;
+               local_irq_save(flags);
+               if (netif_tx_trylock(dev)) {
+                       /* try until next clock tick */
+                       for (tries = jiffies_to_usecs(1)/USEC_PER_POLL;
+                                       tries > 0; --tries) {
+                               if (!netif_queue_stopped(dev))
+                                       status = dev->hard_start_xmit(skb, dev);
 
-                       /* tickle device maybe there is some cleanup */
-                       netpoll_poll(np);
+                               if (status == NETDEV_TX_OK)
+                                       break;
+
+                               /* tickle device maybe there is some cleanup */
+                               netpoll_poll(np);
 
-                       udelay(USEC_PER_POLL);
+                               udelay(USEC_PER_POLL);
+                       }
+                       netif_tx_unlock(dev);
                }
-               netif_tx_unlock(dev);
+               local_irq_restore(flags);
        }
 
        if (status != NETDEV_TX_OK) {