summaryrefslogtreecommitdiffstats
path: root/src/vcl/vcl_locked.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-09-08 16:47:57 -0700
committerFlorin Coras <florin.coras@gmail.com>2020-09-14 14:33:46 +0000
commitb88de908101081f870d94e1415659326b589b9ce (patch)
tree21d670f5af2899eb4b67a058bc825179950302b6 /src/vcl/vcl_locked.c
parent61ae056bdb6cdf7cb718cf9f459d41e903abcb47 (diff)
vcl: cleanup bapi and wrk registration
Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I0391db5c3ad038265cb8ebf9de02925653e35959
Diffstat (limited to 'src/vcl/vcl_locked.c')
-rw-r--r--src/vcl/vcl_locked.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/src/vcl/vcl_locked.c b/src/vcl/vcl_locked.c
index 4b88b27ac6f..678499cd71c 100644
--- a/src/vcl/vcl_locked.c
+++ b/src/vcl/vcl_locked.c
@@ -1491,44 +1491,30 @@ static void
vls_app_fork_child_handler (void)
{
vcl_worker_t *parent_wrk;
- int rv, parent_wrk_index;
- u8 *child_name;
+ int parent_wrk_index;
parent_wrk_index = vcl_get_worker_index ();
VDBG (0, "initializing forked child %u with parent wrk %u", getpid (),
parent_wrk_index);
/*
- * Allocate worker vcl
+ * Clear old state
*/
vcl_set_worker_index (~0);
- if (!vcl_worker_alloc_and_init ())
- VERR ("couldn't allocate new worker");
/*
- * Attach to binary api
+ * Allocate and register vcl worker with vpp
*/
- child_name = format (0, "%v-child-%u%c", vcm->app_name, getpid (), 0);
- vcl_cleanup_bapi ();
- vppcom_api_hookup ();
- vcm->app_state = STATE_APP_START;
- rv = vppcom_connect_to_vpp ((char *) child_name);
- vec_free (child_name);
- if (rv)
+ if (vppcom_worker_register ())
{
- VERR ("couldn't connect to VPP!");
+ VERR ("couldn't register new worker!");
return;
}
/*
- * Allocate/initialize vls worker
+ * Allocate/initialize vls worker and share sessions
*/
vls_worker_alloc ();
-
- /*
- * Register worker with vpp and share sessions
- */
- vcl_worker_register_with_vpp ();
parent_wrk = vcl_worker_get (parent_wrk_index);
vls_worker_copy_on_fork (parent_wrk);
parent_wrk->forked_child = vcl_get_worker_index ();