Skip to contentSkip to conversation

linux-2.6.18/netback: Re-factor net_tx_action_dealloc() slightly

PATCH New Jan Beulich 1 participant 1 message Dec 17, 2010 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-2.6.18/netback: Re-factor net_tx_action_dealloc() slightly

From: Paul Durrant <[email protected]>
Subject: Re-factor net_tx_action_dealloc() slightly.

There is no need for processing of the pending_inuse list to be within the dealloc_prod/cons loop.

drivers/xen/netback/netback.c +11 -12
@@ -924,7 +924,6 @@ inline static void net_tx_action_dealloc
 	u16 pending_idx;
 	PEND_RING_IDX dc, dp;
 	netif_t *netif;
-	int ret;
 	LIST_HEAD(list);
 
 	dc = dealloc_cons;
@@ -959,11 +958,17 @@ inline static void net_tx_action_dealloc
 			gop++;
 		}
 
-		if (netbk_copy_skb_mode != NETBK_DELAYED_COPY_SKB ||
-		    list_empty(&pending_inuse_head))
-			break;
+	} while (dp != dealloc_prod);
+
+	dealloc_cons = dc;
 
-		/* Copy any entries that have been pending for too long. */
+	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. */
+	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;
@@ -985,13 +990,7 @@ inline static void net_tx_action_dealloc
 
 			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;

From: Paul Durrant <[email protected]>
Subject: Re-factor net_tx_action_dealloc() slightly.

There is no need for processing of the pending_inuse list to be within the dealloc_prod/cons loop.

drivers/xen/netback/netback.c +11 -12
@@ -924,7 +924,6 @@ inline static void net_tx_action_dealloc
 	u16 pending_idx;
 	PEND_RING_IDX dc, dp;
 	netif_t *netif;
-	int ret;
 	LIST_HEAD(list);
 
 	dc = dealloc_cons;
@@ -959,11 +958,17 @@ inline static void net_tx_action_dealloc
 			gop++;
 		}
 
-		if (netbk_copy_skb_mode != NETBK_DELAYED_COPY_SKB ||
-		    list_empty(&pending_inuse_head))
-			break;
+	} while (dp != dealloc_prod);
+
+	dealloc_cons = dc;
 
-		/* Copy any entries that have been pending for too long. */
+	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. */
+	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;
@@ -985,13 +990,7 @@ inline static void net_tx_action_dealloc
 
 			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;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel