summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-10-25 14:00:29 -0700
committerDamjan Marion <dmarion@me.com>2020-10-26 15:24:32 +0000
commite10da62bd6341f214264006b4196281299c66b62 (patch)
treeedaf3e4ee85f3ba850aba18e3db79a0c8d25a9d8 /src
parenta8375082a29af68fbaf853f29bc7e20d812c9e5f (diff)
session: fix feature disable
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I69e912ddf64d8ec89f8d93e02a201781b99de0bd
Diffstat (limited to 'src')
-rw-r--r--src/vnet/session/session.c18
-rw-r--r--src/vnet/session/session.h4
-rw-r--r--src/vnet/session/session_node.c2
3 files changed, 22 insertions, 2 deletions
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 6413da51f3b..18850cc1ba2 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -1665,6 +1665,10 @@ session_manager_main_enable (vlib_main_t * vm)
session_worker_t *wrk;
int i;
+ /* We only initialize once and do not de-initialized on disable */
+ if (smm->is_initialized)
+ goto done;
+
num_threads = 1 /* main thread */ + vtm->n_threads;
if (num_threads < 1)
@@ -1721,6 +1725,9 @@ session_manager_main_enable (vlib_main_t * vm)
session_lookup_init ();
app_namespaces_init ();
transport_init ();
+ smm->is_initialized = 1;
+
+done:
smm->is_enabled = 1;
@@ -1731,6 +1738,12 @@ session_manager_main_enable (vlib_main_t * vm)
return 0;
}
+static void
+session_manager_main_disable (vlib_main_t * vm)
+{
+ transport_enable_disable (vm, 0 /* is_en */ );
+}
+
void
session_node_enable_disable (u8 is_en)
{
@@ -1742,10 +1755,10 @@ session_node_enable_disable (u8 is_en)
foreach_vlib_main (({
if (have_workers && ii == 0)
{
- vlib_node_set_state (this_vlib_main, session_queue_process_node.index,
- state);
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);
@@ -1780,6 +1793,7 @@ vnet_session_enable_disable (vlib_main_t * vm, u8 is_en)
else
{
session_main.is_enabled = 0;
+ session_manager_main_disable (vm);
session_node_enable_disable (is_en);
}
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index 5e0a832d796..2de22bd2650 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -164,6 +164,10 @@ typedef struct session_main_
/** Session manager is enabled */
u8 is_enabled;
+
+ /** Session manager initialized (not necessarily enabled) */
+ u8 is_initialized;
+
/** Enable session manager at startup */
u8 session_enable_asap;
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 346b9f43343..482f8b019ff 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -1564,6 +1564,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:
+ vlib_node_set_state (vm, session_queue_process_node.index,
+ VLIB_NODE_STATE_DISABLED);
timeout = 100000.0;
break;
case ~0: