datapath: Use consume_skb() on non-errors.
authorJesse Gross <jesse@nicira.com>
Thu, 16 Jun 2011 22:32:26 +0000 (15:32 -0700)
committerJesse Gross <jesse@nicira.com>
Fri, 17 Jun 2011 00:03:29 +0000 (17:03 -0700)
It's possible to trace kfree_skb() call sites to find out where
packets are getting dropped.  Situations where kfree_skb() does
not actually indicate an error adds additional noise, so use
consume_skb() instead to avoid tracing non-errors.

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

index a8884a3d4c95460232464ce778674ddf149a6105..ed61039a0a3d6dee88d762ea62934ce95dcf2e67 100644 (file)
@@ -322,7 +322,7 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb,
        if (prev_port != -1)
                do_output(dp, skb, prev_port);
        else
-               kfree_skb(skb);
+               consume_skb(skb);
 
        return 0;
 }
index 566aeed6e5dc3d10cc62d2512f1f03cd6035d4b4..7eadd2f5af27d2f1f3bfcf0fb8e34258f97f057f 100644 (file)
@@ -289,7 +289,7 @@ void dp_process_received_packet(struct vport *p, struct sk_buff *skb)
                }
 
                if (is_frag && dp->drop_frags) {
-                       kfree_skb(skb);
+                       consume_skb(skb);
                        stats_counter_off = offsetof(struct dp_stats_percpu, n_frags);
                        goto out;
                }
@@ -406,12 +406,13 @@ int dp_upcall(struct datapath *dp, struct sk_buff *skb, const struct dp_upcall_i
        if (skb_is_gso(skb)) {
                struct sk_buff *nskb = skb_gso_segment(skb, NETIF_F_SG | NETIF_F_HW_CSUM);
                
-               kfree_skb(skb);
-               skb = nskb;
-               if (IS_ERR(skb)) {
-                       err = PTR_ERR(skb);
+               if (IS_ERR(nskb)) {
+                       kfree_skb(skb);
+                       err = PTR_ERR(nskb);
                        goto err;
                }
+               consume_skb(skb);
+               skb = nskb;
        }
 
        err = queue_control_packets(dp, skb, upcall_info);
@@ -506,7 +507,7 @@ static int queue_control_packets(struct datapath *dp, struct sk_buff *skb,
                if (err)
                        goto err_kfree_skbs;
 
-               kfree_skb(skb);
+               consume_skb(skb);
                skb = nskb;
        } while (skb);
        return 0;
index 5c05c49eec7f3bb044ad484ccd2cfb22251bfe49..c2439f0e17c37e24806d9d8ae69b866cff7d8962 100644 (file)
@@ -968,7 +968,7 @@ static struct tnl_cache *build_cache(struct vport *vport,
                err = flow_extract(skb, dst_vport->port_no, &flow_key,
                                   &flow_key_len, &is_frag);
 
-               kfree_skb(skb);
+               consume_skb(skb);
                if (err || is_frag)
                        goto done;
 
@@ -1081,12 +1081,13 @@ static struct sk_buff *handle_offloads(struct sk_buff *skb,
                struct sk_buff *nskb;
 
                nskb = skb_gso_segment(skb, 0);
-               kfree_skb(skb);
                if (IS_ERR(nskb)) {
+                       kfree_skb(skb);
                        err = PTR_ERR(nskb);
                        goto error;
                }
 
+               consume_skb(skb);
                skb = nskb;
        } else if (get_ip_summed(skb) == OVS_CSUM_PARTIAL) {
                /* Pages aren't locked and could change at any time.
index bc3108b95dff9f5e3c8341b6c7eafffafb6c9704..3239135f09d74dee89fa4d5ff892c40383028ef6 100644 (file)
@@ -343,10 +343,12 @@ static int netdev_send(struct vport *vport, struct sk_buff *skb)
                                goto tag;
                        }
 
-                       kfree_skb(skb);
-                       skb = nskb;
-                       if (IS_ERR(skb))
+                       if (IS_ERR(nskb)) {
+                               kfree_skb(skb);
                                return 0;
+                       }
+                       consume_skb(skb);
+                       skb = nskb;
 
                        len = 0;
                        do {