summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-10-30 19:22:51 -0700
committerDave Barach <openvpp@barachs.net>2019-10-31 16:52:24 +0000
commit45b7973dddc9f1b50d7f20cc1abe150b2ad9931f (patch)
tree47ae819f40dcd0fbdf6561e7ab64df66fa60162e
parentba13c3b3695cb4758848d856174b725afcc7cdb8 (diff)
session: avoid double dispatch of new events
Type: fix Avoid re-dispatching new events if they've just been added to the old events linked list. Change-Id: Ie5d0b799eae6cebb118d97204e5111eb194c0b8e Signed-off-by: Florin Coras <fcoras@cisco.com>
-rw-r--r--src/vnet/session/session_node.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 4f0251bc3f6..b4b384fc617 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -1293,6 +1293,8 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
*/
new_he = pool_elt_at_index (wrk->event_elts, wrk->new_head);
+ old_he = pool_elt_at_index (wrk->event_elts, wrk->old_head);
+ old_ti = clib_llist_prev_index (old_he, evt_list);
/* *INDENT-OFF* */
clib_llist_foreach_safe (wrk->event_elts, evt_list, new_he, elt, ({
@@ -1314,25 +1316,26 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
/* *INDENT-ON* */
/*
- * Handle the old io events
+ * Handle the old io events, if we had any prior to processing the new ones
*/
- old_he = pool_elt_at_index (wrk->event_elts, wrk->old_head);
- old_ti = clib_llist_prev_index (old_he, evt_list);
-
- while (n_tx_packets < VLIB_FRAME_SIZE
- && !clib_llist_is_empty (wrk->event_elts, evt_list, old_he))
+ if (old_ti != wrk->old_head)
{
- clib_llist_index_t ei;
+ old_he = pool_elt_at_index (wrk->event_elts, wrk->old_head);
+ while (n_tx_packets < VLIB_FRAME_SIZE)
+ {
+ clib_llist_index_t ei;
- clib_llist_pop_first (wrk->event_elts, evt_list, elt, old_he);
- ei = clib_llist_entry_index (wrk->event_elts, elt);
- session_event_dispatch_io (wrk, node, elt, thread_index, &n_tx_packets);
+ clib_llist_pop_first (wrk->event_elts, evt_list, elt, old_he);
+ ei = clib_llist_entry_index (wrk->event_elts, elt);
+ session_event_dispatch_io (wrk, node, elt, thread_index,
+ &n_tx_packets);
- old_he = pool_elt_at_index (wrk->event_elts, wrk->old_head);
- if (ei == old_ti)
- break;
- };
+ old_he = pool_elt_at_index (wrk->event_elts, wrk->old_head);
+ if (ei == old_ti)
+ break;
+ };
+ }
if (vec_len (wrk->pending_tx_buffers))
session_flush_pending_tx_buffers (wrk, node);