[ovs-dev] [PATCH 1/2] datapath: Simplify send_frags().

Ben Pfaff blp at nicira.com
Tue Mar 1 23:34:49 UTC 2011


This should make no difference at runtime, but it is shorter and looks more
straightforward to me.

Signed-off-by: Ben Pfaff <blp at nicira.com>
---
 datapath/tunnel.c |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/datapath/tunnel.c b/datapath/tunnel.c
index f1711f1..07bb00b 100644
--- a/datapath/tunnel.c
+++ b/datapath/tunnel.c
@@ -1105,25 +1105,21 @@ static int send_frags(struct sk_buff *skb,
 		      const struct tnl_mutable_config *mutable)
 {
 	int sent_len;
-	int err;
 
 	sent_len = 0;
 	while (skb) {
 		struct sk_buff *next = skb->next;
 		int frag_len = skb->len - mutable->tunnel_hlen;
+		int err;
 
 		skb->next = NULL;
 		memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
 
 		err = ip_local_out(skb);
-		if (likely(net_xmit_eval(err) == 0))
-			sent_len += frag_len;
-		else {
-			skb = next;
-			goto free_frags;
-		}
-
 		skb = next;
+		if (unlikely(net_xmit_eval(err)))
+			goto free_frags;
+		sent_len += frag_len;
 	}
 
 	return sent_len;
-- 
1.7.1





More information about the dev mailing list