aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session_node.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-10-30 19:22:51 -0700
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-11-15 07:20:32 +0000
commit0b8f7cf89f2d2312a98e84975a7c43ab0ec4436f (patch)
tree756a6714b7b89f9a2e8340eea5f490d6f0fb1fa0 /src/vnet/session/session_node.c
parent513a8ffd88eef6cc8597989ce7163bae2dac1caf (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> (cherry picked from commit 45b7973dddc9f1b50d7f20cc1abe150b2ad9931f)
Diffstat (limited to 'src/vnet/session/session_node.c')
-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 e8b68daae93..824085aecb9 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -1295,6 +1295,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, ({
@@ -1316,25 +1318,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;
+ };
+ }
vlib_node_increment_counter (vm, session_queue_node.index,
SESSION_QUEUE_ERROR_TX, n_tx_packets);