aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2025-01-06 16:22:20 -0500
committerDave Barach <vpp@barachs.net>2025-01-08 13:16:42 +0000
commit4d9df5cb3da12498ffd41ee2adddc97dfe31e626 (patch)
tree6bf6fc4e6bcf675e9a47493b499e0b6036537743 /src
parent6082665d44d35a5fc244ff760a9ec773a8c37048 (diff)
vcl: fix vls wrk index on fork
Type: fix Change-Id: If634dac31fd54466428db0726ac441a1247985b8 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vcl/vcl_locked.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/vcl/vcl_locked.c b/src/vcl/vcl_locked.c
index a9992e9317c..e32e96ceaa5 100644
--- a/src/vcl/vcl_locked.c
+++ b/src/vcl/vcl_locked.c
@@ -416,7 +416,7 @@ vls_n_workers (void)
return pool_elts (vlsm->workers);
}
-static void
+static vls_worker_t *
vls_worker_alloc (void)
{
vls_worker_t *wrk;
@@ -427,6 +427,8 @@ vls_worker_alloc (void)
wrk->vcl_wrk_index = vcl_get_worker_index ();
vec_validate (wrk->pending_vcl_wrk_cleanup, 16);
vec_reset_length (wrk->pending_vcl_wrk_cleanup);
+
+ return wrk;
}
static void
@@ -1879,6 +1881,7 @@ static void
vls_app_fork_child_handler (void)
{
vcl_worker_t *parent_wrk;
+ vls_worker_t *vls_wrk;
int parent_wrk_index;
parent_wrk_index = vcl_get_worker_index ();
@@ -1902,11 +1905,11 @@ vls_app_fork_child_handler (void)
/*
* Allocate/initialize vls worker and share sessions
*/
- vls_worker_alloc ();
+ vls_wrk = vls_worker_alloc ();
/* Reset number of threads and set wrk index */
vlsl->vls_mt_n_threads = 1;
- vlsl->vls_wrk_index = vcl_get_worker_index ();
+ vlsl->vls_wrk_index = vls_wrk - vlsm->workers;
vlsl->select_mp_check = 0;
clib_rwlock_init (&vlsl->vls_pool_lock);
vls_mt_locks_init ();