]> xenbits.xensource.com Git - legacy/linux-2.6.18-xen.git/commitdiff
xen/netback: Re-factor net_tx_action_dealloc() slightly
authorKeir Fraser <keir@xen.org>
Fri, 17 Dec 2010 10:08:41 +0000 (10:08 +0000)
committerKeir Fraser <keir@xen.org>
Fri, 17 Dec 2010 10:08:41 +0000 (10:08 +0000)
There is no need for processing of the pending_inuse list to be within
the dealloc_prod/cons loop.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@novell.com>
drivers/xen/netback/netback.c

index 34d8d1df1d6a64f0dfabbb81fba7d7c057075a7e..154c7fbe153a68adbda0a61921cec20e323cfd8e 100644 (file)
@@ -915,7 +915,6 @@ inline static void net_tx_action_dealloc(void)
        u16 pending_idx;
        PEND_RING_IDX dc, dp;
        netif_t *netif;
-       int ret;
        LIST_HEAD(list);
 
        dc = dealloc_cons;
@@ -950,11 +949,17 @@ inline static void net_tx_action_dealloc(void)
                        gop++;
                }
 
-               if (netbk_copy_skb_mode != NETBK_DELAYED_COPY_SKB ||
-                   list_empty(&pending_inuse_head))
-                       break;
+       } while (dp != dealloc_prod);
+
+       dealloc_cons = dc;
+
+       if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref,
+                                     tx_unmap_ops, gop - tx_unmap_ops))
+               BUG();
 
-               /* Copy any entries that have been pending for too long. */
+       /* Copy any entries that have been pending for too long. */
+       if (netbk_copy_skb_mode == NETBK_DELAYED_COPY_SKB &&
+           !list_empty(&pending_inuse_head)) {
                list_for_each_entry_safe(inuse, n, &pending_inuse_head, list) {
                        if (time_after(inuse->alloc_time + HZ / 2, jiffies))
                                break;
@@ -976,13 +981,7 @@ inline static void net_tx_action_dealloc(void)
 
                        break;
                }
-       } while (dp != dealloc_prod);
-
-       dealloc_cons = dc;
-
-       ret = HYPERVISOR_grant_table_op(
-               GNTTABOP_unmap_grant_ref, tx_unmap_ops, gop - tx_unmap_ops);
-       BUG_ON(ret);
+       }
 
        list_for_each_entry_safe(inuse, n, &list, list) {
                pending_idx = inuse - pending_inuse;