From b88de908101081f870d94e1415659326b589b9ce Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Tue, 8 Sep 2020 16:47:57 -0700 Subject: vcl: cleanup bapi and wrk registration Type: refactor Signed-off-by: Florin Coras Change-Id: I0391db5c3ad038265cb8ebf9de02925653e35959 --- src/vcl/vcl_locked.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) (limited to 'src/vcl/vcl_locked.c') 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 (); -- cgit 1.2.3-korg