This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / net / core / netpoll.c
index 5cf9f04..cb3a03f 100644 (file)
 #include <linux/netpoll.h>
 #include <linux/sched.h>
 #include <linux/rcupdate.h>
-#include <linux/nmi.h>
 #include <net/tcp.h>
 #include <net/udp.h>
 #include <asm/unaligned.h>
-#include <asm/byteorder.h>
 
 /*
  * We maintain a small pool of fully-sized skbs, to make sure the
@@ -67,25 +65,27 @@ static int checksum_udp(struct sk_buff *skb, struct udphdr *uh,
        return csum_fold(skb_checksum(skb, 0, skb->len, skb->csum));
 }
 
-/*
- * Check whether delayed processing was scheduled for our current CPU,
- * and then manually invoke NAPI polling to pump data off the card.
- *
- * In cases where there is bi-directional communications, reading only
- * one message at a time can lead to packets being dropped by the
- * network adapter, forcing superfluous retries and possibly timeouts.
- * Thus, we set our budget to greater than 1.
- */
-static void poll_napi(struct netpoll *np)
+void netpoll_poll(struct netpoll *np)
 {
-       int budget = netdump_mode ? 64 : 16;
+       /*
+        * In cases where there is bi-directional communications, reading
+        * only one message at a time can lead to packets being dropped by
+        * the network adapter, forcing superfluous retries and possibly
+        * timeouts.  Thus, we set our budget to a more reasonable value.
+        */
+       int budget = 16;
        unsigned long flags;
-       struct softnet_data *queue;
 
+       if(!np->dev || !netif_running(np->dev) || !np->dev->poll_controller)
+               return;
+
+       /* Process pending work on NIC */
+       np->dev->poll_controller(np->dev);
+
+       /* If scheduling is stopped, tickle NAPI bits */
        spin_lock_irqsave(&netpoll_poll_lock, flags);
-       queue = &__get_cpu_var(softnet_data);
-       if (test_bit(__LINK_STATE_RX_SCHED, &np->dev->state) &&
-           !list_empty(&queue->poll_list)) {
+       if (np->dev->poll &&
+           test_bit(__LINK_STATE_RX_SCHED, &np->dev->state)) {
                np->dev->netpoll_rx |= NETPOLL_RX_DROP;
                atomic_inc(&trapped);
 
@@ -95,17 +95,6 @@ static void poll_napi(struct netpoll *np)
                np->dev->netpoll_rx &= ~NETPOLL_RX_DROP;
        }
        spin_unlock_irqrestore(&netpoll_poll_lock, flags);
-}
-
-void netpoll_poll(struct netpoll *np)
-{
-       if(!np->dev || !netif_running(np->dev) || !np->dev->poll_controller)
-               return;
-
-       /* Process pending work on NIC */
-       np->dev->poll_controller(np->dev);
-       if (np->dev->poll)
-               poll_napi(np);
 
        zap_completion_queue();
 }
@@ -149,7 +138,6 @@ static void zap_completion_queue(void)
        }
 
        put_cpu_var(softnet_data);
-       touch_nmi_watchdog();
 }
 
 static struct sk_buff * find_skb(struct netpoll *np, int len, int reserve)
@@ -264,7 +252,7 @@ void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
        iph->check    = 0;
        put_unaligned(htonl(np->local_ip), &(iph->saddr));
        put_unaligned(htonl(np->remote_ip), &(iph->daddr));
-       iph->check    = ip_fast_csum((unsigned char *)iph, 5);
+       iph->check    = ip_fast_csum((unsigned char *)iph, iph->ihl);
 
        eth = (struct ethhdr *) skb_push(skb, ETH_HLEN);
 
@@ -380,9 +368,6 @@ int netpoll_rx(struct sk_buff *skb)
        struct list_head *p;
        unsigned long flags;
 
-       if (!(skb->dev->netpoll_rx & NETPOLL_RX_ENABLED))
-               return 1;
-
        if (skb->dev->type != ARPHRD_ETHER)
                goto out;
 
@@ -580,7 +565,7 @@ int netpoll_setup(struct netpoll *np)
                goto release;
        }
 
-       if (!netif_running(ndev)) {
+       if (!(ndev->flags & IFF_UP)) {
                unsigned short oflags;
                unsigned long atmost, atleast;
 
@@ -626,7 +611,7 @@ int netpoll_setup(struct netpoll *np)
                rcu_read_lock();
                in_dev = __in_dev_get(ndev);
 
-               if (!in_dev || !in_dev->ifa_list) {
+               if (!in_dev) {
                        rcu_read_unlock();
                        printk(KERN_ERR "%s: no IP address for %s, aborting\n",
                               np->name, np->dev_name);
@@ -651,9 +636,6 @@ int netpoll_setup(struct netpoll *np)
                spin_unlock_irqrestore(&rx_list_lock, flags);
        }
 
-       if(np->dump_func)
-               netdump_func = np->dump_func;
-
        return 0;
  release:
        dev_put(ndev);
@@ -689,13 +671,6 @@ void netpoll_set_trap(int trap)
                atomic_dec(&trapped);
 }
 
-void netpoll_reset_locks(struct netpoll *np)
-{
-       spin_lock_init(&rx_list_lock);
-       spin_lock_init(&skb_list_lock);
-       spin_lock_init(&np->dev->xmit_lock);
-}
-
 EXPORT_SYMBOL(netpoll_set_trap);
 EXPORT_SYMBOL(netpoll_trap);
 EXPORT_SYMBOL(netpoll_parse_options);
@@ -704,4 +679,3 @@ EXPORT_SYMBOL(netpoll_cleanup);
 EXPORT_SYMBOL(netpoll_send_skb);
 EXPORT_SYMBOL(netpoll_send_udp);
 EXPORT_SYMBOL(netpoll_poll);
-EXPORT_SYMBOL_GPL(netpoll_reset_locks);