Skip to contentSkip to conversation

openvswitch: distinguish between the dropped and consumed skb

PATCH In review [email protected] 3 participants 3 messages Sep 2, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 openvswitch: distinguish between the dropped and consumed skb

From: Li RongQing <[email protected]>

distinguish between the dropped and consumed skb, not assume the skb is consumed always

---
 net/openvswitch/datapath.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/openvswitch/datapath.c +2 -1
index 35d866f..dacf56f 100644
@@ -266,7 +266,6 @@ void ovs_dp_process_received_packet(struct vport *p, struct sk_buff *skb)
 		upcall.userdata = NULL;
 		upcall.portid = ovs_vport_find_upcall_portid(p, skb);
 		ovs_dp_upcall(dp, skb, &upcall);
-		consume_skb(skb);
 		stats_counter = &stats->n_missed;
 		goto out;
 	}
@@ -304,9 +303,11 @@ int ovs_dp_upcall(struct datapath *dp, struct sk_buff *skb,
 	if (err)
 		goto err;
 
+	consume_skb(skb);
 	return 0;
 
 err:
+	kfree_skb(skb);
 	stats = this_cpu_ptr(dp->stats_percpu);
 
 	u64_stats_update_begin(&stats->syncp);
Signature · 1 line
1.7.10.4
#1 lore raw

net/openvswitch/datapath.c int ovs_dp_upcall(struct datapath *dp, struct sk_buff *skb, · line 307

Quoted 6 lines · On 09/02/14 at 08:52pm, [email protected] wrote:
net/openvswitch/datapath.c +1 -0
@@ -304,9 +303,11 @@ int ovs_dp_upcall(struct datapath *dp, struct sk_buff *skb,
 	if (err)
 		goto err;
 
+	consume_skb(skb);
 	return 0;

What about the path from output_userspace()?

#2 lore raw
Quoted 9 lines · Thomas Graf

net/openvswitch/datapath.c int ovs_dp_upcall(struct datapath *dp, struct sk_buff *skb, · line 307

Quoted 6 lines · On 09/02/14 at 08:52pm, [email protected] wrote:
net/openvswitch/datapath.c +1 -0
@@ -304,9 +303,11 @@ int ovs_dp_upcall(struct datapath *dp, struct sk_buff *skb,
      if (err)
              goto err;
 
+     consume_skb(skb);
      return 0;

What about the path from output_userspace()?

Right, output_userspace() can not free the skb in any case.