From 72d96679c14988f3267135459aba7333d0ec32a0 Mon Sep 17 00:00:00 2001 From: Daniele Di Proietto Date: Tue, 24 Jun 2014 16:08:34 -0700 Subject: [PATCH] dpif-netdev: Delete packet if not able to do upcall In dp_netdev_input() we nevered fully covered the case where handler queues are not there. With this change we increment the stat counter and free the packet. Signed-off-by: Daniele Di Proietto Acked-by: Pravin B Shelar --- lib/dpif-netdev.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 4dcc268a2..e8146450c 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -2094,12 +2094,20 @@ dp_netdev_input(struct dp_netdev *dp, struct dpif_packet **packets, int cnt, packet_batch_init(&batch, netdev_flow, packets[i], md, &key.flow); } - } else if (dp->handler_queues) { + } else { + /* Packet's flow not in datapath */ dp_netdev_count_packet(dp, DP_STAT_MISS, 1); - dp_netdev_output_userspace(dp, &buf, 1, - miniflow_hash_5tuple(&key.flow, 0) - % dp->n_handlers, - DPIF_UC_MISS, &key.flow, NULL); + + if (dp->handler_queues) { + /* Upcall */ + dp_netdev_output_userspace(dp, &buf, 1, + miniflow_hash_5tuple(&key.flow, 0) + % dp->n_handlers, + DPIF_UC_MISS, &key.flow, NULL); + } else { + /* No upcall queue. Freeing the packet */ + dpif_packet_delete(packets[i]); + } } } -- 2.20.1