diff options
author | Florin Coras <fcoras@cisco.com> | 2020-02-09 20:03:12 +0000 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2020-02-11 20:30:11 +0000 |
commit | 16d974ec59776f0103ad62d0d04dc57989eef7ed (patch) | |
tree | 616dbcea0b086002e1245b92adea4a75b879d110 /src/vnet/session/session_node.c | |
parent | 90d28846f963a86d760b4a6b83aed62b862f1c61 (diff) |
session: avoid scanning new io list under load
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Idaa7cc26ad941be86daec4ed5920727237712f4a
Diffstat (limited to 'src/vnet/session/session_node.c')
-rw-r--r-- | src/vnet/session/session_node.c | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index bc22cc0a98c..c3570791898 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -1257,8 +1257,8 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, u32 thread_index = vm->thread_index, n_to_dequeue; session_worker_t *wrk = &smm->wrk[thread_index]; session_evt_elt_t *elt, *ctrl_he, *new_he, *old_he; + clib_llist_index_t ei, next_ei, old_ti; svm_msg_q_msg_t _msg, *msg = &_msg; - clib_llist_index_t old_ti; int i, n_tx_packets = 0; session_event_t *evt; svm_msg_q_t *mq; @@ -1314,24 +1314,14 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, 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, ({ - session_evt_type_t et; - - et = elt->evt.event_type; - clib_llist_remove (wrk->event_elts, evt_list, elt); - - /* Postpone tx events if we can't handle them this dispatch cycle */ - if (n_tx_packets >= VLIB_FRAME_SIZE - && (et == SESSION_IO_EVT_TX || et == SESSION_IO_EVT_TX_FLUSH)) - { - clib_llist_add (wrk->event_elts, evt_list, elt, new_he); - continue; - } - - session_event_dispatch_io (wrk, node, elt, thread_index, &n_tx_packets); - })); - /* *INDENT-ON* */ + ei = clib_llist_next_index (new_he, evt_list); + while (ei != wrk->new_head && n_tx_packets < VLIB_FRAME_SIZE) + { + elt = pool_elt_at_index (wrk->event_elts, ei); + ei = clib_llist_next_index (elt, evt_list); + clib_llist_remove (wrk->event_elts, evt_list, elt); + session_event_dispatch_io (wrk, node, elt, thread_index, &n_tx_packets); + } /* * Handle the old io events, if we had any prior to processing the new ones @@ -1339,8 +1329,6 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, if (old_ti != wrk->old_head) { - clib_llist_index_t ei, next_ei; - old_he = pool_elt_at_index (wrk->event_elts, wrk->old_head); ei = clib_llist_next_index (old_he, evt_list); |