summaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2024-07-02 04:34:54 -0700
committerDave Barach <vpp@barachs.net>2024-07-08 16:27:06 +0000
commit75e8e1e948da182dbf4f6b3394f1b7fc44c1403a (patch)
treef35ad5134743fda3ac732bb5f7d3945e5005ac28 /src/vnet/session
parent6df9f442277603d3ebd3bcf950f7dd0d28fb42f5 (diff)
session: improve enable and disable handling
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I3c79d16f6a19767d990e8a4683c296219b559ccd
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/application_local.c19
-rw-r--r--src/vnet/session/session.c16
-rw-r--r--src/vnet/session/session_node.c2
3 files changed, 23 insertions, 14 deletions
diff --git a/src/vnet/session/application_local.c b/src/vnet/session/application_local.c
index 064dd6fe77e..3ac2ba4cfbc 100644
--- a/src/vnet/session/application_local.c
+++ b/src/vnet/session/application_local.c
@@ -70,6 +70,7 @@ typedef struct ct_main_
u32 **fwrk_pending_connects; /**< First wrk pending half-opens */
u32 fwrk_thread; /**< First worker thread */
u8 fwrk_have_flush; /**< Flag for connect flush rpc */
+ u8 is_init;
} ct_main_t;
static ct_main_t ct_main;
@@ -1353,19 +1354,19 @@ ct_enable_disable (vlib_main_t * vm, u8 is_en)
if (is_en == 0)
return 0;
+ if (cm->is_init)
+ return 0;
+
cm->n_workers = vlib_num_workers ();
cm->fwrk_thread = transport_cl_thread ();
vec_validate (cm->wrk, vtm->n_vlib_mains);
- vec_foreach (wrk, cm->wrk)
- {
- if (wrk->pending_connects_lock == 0)
- clib_spinlock_init (&wrk->pending_connects_lock);
- }
- if (cm->ho_reuseable_lock == 0)
- clib_spinlock_init (&cm->ho_reuseable_lock);
- if (cm->app_segs_lock == 0)
- clib_rwlock_init (&cm->app_segs_lock);
vec_validate (cm->fwrk_pending_connects, cm->n_workers);
+ vec_foreach (wrk, cm->wrk)
+ clib_spinlock_init (&wrk->pending_connects_lock);
+ clib_spinlock_init (&cm->ho_reuseable_lock);
+ clib_rwlock_init (&cm->app_segs_lock);
+ cm->is_init = 1;
+
return 0;
}
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 5897693c34e..f1598519363 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -2152,6 +2152,16 @@ session_node_enable_dma (u8 is_en, int n_vlibs)
}
}
+static void
+session_main_start_q_process (vlib_main_t *vm, vlib_node_state_t state)
+{
+ vlib_node_t *n;
+
+ 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);
+}
+
void
session_node_enable_disable (u8 is_en)
{
@@ -2159,7 +2169,6 @@ session_node_enable_disable (u8 is_en)
u8 state = is_en ? VLIB_NODE_STATE_POLLING : VLIB_NODE_STATE_DISABLED;
session_main_t *sm = &session_main;
vlib_main_t *vm;
- vlib_node_t *n;
int n_vlibs, i;
n_vlibs = vlib_get_n_threads ();
@@ -2173,10 +2182,7 @@ session_node_enable_disable (u8 is_en)
if (is_en)
{
session_main_get_worker (0)->state = SESSION_WRK_INTERRUPT;
- 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);
+ session_main_start_q_process (vm, state);
}
else
{
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 0ec158fb429..a6804f7882e 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -2163,6 +2163,8 @@ session_queue_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
session_queue_run_on_main (vm);
break;
case SESSION_Q_PROCESS_STOP:
+ /* Free event_data, the node will be restarted if needed */
+ vec_free (event_data);
vlib_node_set_state (vm, session_queue_process_node.index,
VLIB_NODE_STATE_DISABLED);
timeout = 100000.0;