]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[NETPOLL]: netpoll_poll() cleanup
authorStephen Hemminger <shemminger@linux-foundation.org>
Tue, 20 Nov 2007 03:18:11 +0000 (19:18 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 22:54:16 +0000 (14:54 -0800)
Restructure code slightly to improve readability:
  * dereference device once
  * change obvious while() loop
  * let poll_napi() handle null list itself

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/netpoll.c

index f63a70be3cd09f70074375e8027f00451c2227a7..250868f687627f1bbe6be8dc8f2da459e785b94b 100644 (file)
@@ -139,16 +139,15 @@ static int poll_one_napi(struct netpoll_info *npinfo,
        return budget - work;
 }
 
-static void poll_napi(struct netpoll *np)
+static void poll_napi(struct net_device *dev)
 {
-       struct netpoll_info *npinfo = np->dev->npinfo;
        struct napi_struct *napi;
        int budget = 16;
 
-       list_for_each_entry(napi, &np->dev->napi_list, dev_list) {
+       list_for_each_entry(napi, &dev->napi_list, dev_list) {
                if (napi->poll_owner != smp_processor_id() &&
                    spin_trylock(&napi->poll_lock)) {
-                       budget = poll_one_napi(npinfo, napi, budget);
+                       budget = poll_one_napi(dev->npinfo, napi, budget);
                        spin_unlock(&napi->poll_lock);
 
                        if (!budget)
@@ -159,30 +158,27 @@ static void poll_napi(struct netpoll *np)
 
 static void service_arp_queue(struct netpoll_info *npi)
 {
-       struct sk_buff *skb;
-
-       if (unlikely(!npi))
-               return;
+       if (npi) {
+               struct sk_buff *skb;
 
-       skb = skb_dequeue(&npi->arp_tx);
-
-       while (skb != NULL) {
-               arp_reply(skb);
-               skb = skb_dequeue(&npi->arp_tx);
+               while ((skb = skb_dequeue(&npi->arp_tx)))
+                       arp_reply(skb);
        }
 }
 
 void netpoll_poll(struct netpoll *np)
 {
-       if (!np->dev || !netif_running(np->dev) || !np->dev->poll_controller)
+       struct net_device *dev = np->dev;
+
+       if (!dev || !netif_running(dev) || !dev->poll_controller)
                return;
 
        /* Process pending work on NIC */
-       np->dev->poll_controller(np->dev);
-       if (!list_empty(&np->dev->napi_list))
-               poll_napi(np);
+       dev->poll_controller(dev);
+
+       poll_napi(dev);
 
-       service_arp_queue(np->dev->npinfo);
+       service_arp_queue(dev->npinfo);
 
        zap_completion_queue();
 }