datapath: distinguish between the dropped and consumed skb
authorLi RongQing <roy.qing.li@gmail.com>
Sun, 7 Sep 2014 21:49:02 +0000 (14:49 -0700)
committerPravin B Shelar <pshelar@nicira.com>
Mon, 8 Sep 2014 17:43:34 +0000 (10:43 -0700)
distinguish between the dropped and consumed skb, not assume the skb
is consumed always

Cc: Thomas Graf <tgraf@noironetworks.com>
Cc: Pravin Shelar <pshelar@nicira.com>
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
datapath/datapath.c

index 921c172..fae0ac7 100644 (file)
@@ -269,13 +269,19 @@ void ovs_dp_process_packet(struct sk_buff *skb)
                                         &n_mask_hit);
        if (unlikely(!flow)) {
                struct dp_upcall_info upcall;
+               int error;
 
                upcall.cmd = OVS_PACKET_CMD_MISS;
                upcall.userdata = NULL;
                upcall.portid = ovs_vport_find_upcall_portid(p, skb);
                upcall.egress_tun_info = NULL;
-               ovs_dp_upcall(dp, skb, &upcall);
-               consume_skb(skb);
+
+               error = ovs_dp_upcall(dp, skb, &upcall);
+               if (unlikely(error))
+                       kfree_skb(skb);
+               else
+                       consume_skb(skb);
+
                stats_counter = &stats->n_missed;
                goto out;
        }