From: Jesse Gross Date: Thu, 16 Jun 2011 22:32:26 +0000 (-0700) Subject: datapath: Use consume_skb() on non-errors. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b95ab0edf18e44d6624c8aa98b658df2fbb48f2;p=openvswitch datapath: Use consume_skb() on non-errors. 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 Signed-off-by: Jesse Gross Acked-by: Ben Pfaff --- diff --git a/datapath/actions.c b/datapath/actions.c index a8884a3d..ed61039a 100644 --- a/datapath/actions.c +++ b/datapath/actions.c @@ -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; } diff --git a/datapath/datapath.c b/datapath/datapath.c index 566aeed6..7eadd2f5 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -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; diff --git a/datapath/tunnel.c b/datapath/tunnel.c index 5c05c49e..c2439f0e 100644 --- a/datapath/tunnel.c +++ b/datapath/tunnel.c @@ -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. diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c index bc3108b9..3239135f 100644 --- a/datapath/vport-netdev.c +++ b/datapath/vport-netdev.c @@ -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 {