diff options
author | Florin Coras <fcoras@cisco.com> | 2021-03-17 21:52:49 -0700 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2021-03-30 14:51:16 +0000 |
commit | 1d2e38bb6ec0841d3e64be562c669c6ea3db764f (patch) | |
tree | e9d6b967b5caf2778330d6467166c8fd7ece61c2 | |
parent | 4f81d447bcaab7e7642437f0e8f15eaab0e9f6d3 (diff) |
session: interrupt mode for session node on main thread
Signal, and implicitly run, main thread session queue node via
interrupts instead of the queue process node.
Process node still needed for timers.
Type: improvement
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I5efd393effc8dad65e4125a3d0ad1be6b7484cb7
-rw-r--r-- | src/vnet/session/session.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c index c447557f8b0..c24a95fd9a6 100644 --- a/src/vnet/session/session.c +++ b/src/vnet/session/session.c @@ -1656,8 +1656,7 @@ void session_queue_run_on_main_thread (vlib_main_t * vm) { ASSERT (vlib_get_thread_index () == 0); - vlib_process_signal_event_mt (vm, session_queue_process_node.index, - SESSION_Q_PROCESS_RUN_ON_MAIN, 0); + vlib_node_set_interrupt_pending (vm, session_queue_node.index); } static clib_error_t * @@ -1749,35 +1748,41 @@ session_manager_main_disable (vlib_main_t * vm) void session_node_enable_disable (u8 is_en) { + u8 mstate = is_en ? VLIB_NODE_STATE_INTERRUPT : VLIB_NODE_STATE_DISABLED; u8 state = is_en ? VLIB_NODE_STATE_POLLING : VLIB_NODE_STATE_DISABLED; - vlib_thread_main_t *vtm = vlib_get_thread_main (); - u8 have_workers = vtm->n_threads != 0; + session_main_t *sm = &session_main; + vlib_main_t *vm; + vlib_node_t *n; + int n_vlibs, i; - foreach_vlib_main () + n_vlibs = vlib_get_n_threads (); + for (i = 0; i < n_vlibs; i++) { - if (have_workers && ii == 0) + vm = vlib_get_main_by_index (i); + /* main thread with workers and not polling */ + if (i == 0 && n_vlibs > 1) { + vlib_node_set_state (vm, session_queue_node.index, mstate); if (is_en) { - vlib_node_set_state (this_vlib_main, - session_queue_process_node.index, state); - vlib_node_t *n = vlib_get_node ( - this_vlib_main, session_queue_process_node.index); - vlib_start_process (this_vlib_main, n->runtime_index); + vlib_node_set_state (vm, session_queue_process_node.index, + state); + n = vlib_get_node (vm, session_queue_process_node.index); + vlib_start_process (vm, n->runtime_index); } else { - vlib_process_signal_event_mt (this_vlib_main, + vlib_process_signal_event_mt (vm, session_queue_process_node.index, SESSION_Q_PROCESS_STOP, 0); } - if (!session_main.poll_main) + if (!sm->poll_main) continue; } - vlib_node_set_state (this_vlib_main, session_queue_node.index, state); + vlib_node_set_state (vm, session_queue_node.index, state); } - if (session_main.use_private_rx_mqs) + if (sm->use_private_rx_mqs) application_enable_rx_mqs_nodes (is_en); } |