datapath: Simplify send_frags().
authorBen Pfaff <blp@nicira.com>
Tue, 1 Mar 2011 23:31:32 +0000 (15:31 -0800)
committerBen Pfaff <blp@nicira.com>
Wed, 2 Mar 2011 22:33:57 +0000 (14:33 -0800)
This should make no difference at runtime, but it is shorter and looks more
straightforward to me.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
datapath/tunnel.c

index f1711f1f5411433078849b0f19f03cfc1a1cbf37..07bb00b6265e1355cdf54a29d0e1be42761b9609 100644 (file)
@@ -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;