From c6c4e866378318e966e011cc749b7a2e2ce741f1 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Thu, 9 Mar 2023 18:23:05 -0800 Subject: [PATCH] vcl: init ldp config before vcl init This avoids printing ldp debug messages while debug is disabled and vcl is initializing. Type: fix Signed-off-by: Florin Coras Change-Id: I5dfd1d59032db937fea146b6b84b8e26307a0de0 --- src/vcl/ldp.c | 57 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/src/vcl/ldp.c b/src/vcl/ldp.c index 9876c1ea17a..b750671ecd6 100644 --- a/src/vcl/ldp.c +++ b/src/vcl/ldp.c @@ -194,31 +194,9 @@ ldp_alloc_workers (void) pool_alloc (ldp->workers, LDP_MAX_NWORKERS); } -static int -ldp_init (void) +static void +ldp_init_cfg (void) { - ldp_worker_ctx_t *ldpw; - int rv; - - ASSERT (!ldp->init); - - ldp->init = 1; - ldp->vcl_needs_real_epoll = 1; - rv = vls_app_create (ldp_get_app_name ()); - if (rv != VPPCOM_OK) - { - ldp->vcl_needs_real_epoll = 0; - if (rv == VPPCOM_EEXIST) - return 0; - LDBG (2, "\nERROR: ldp_init: vppcom_app_create()" - " failed! rv = %d (%s)\n", rv, vppcom_retval_str (rv)); - ldp->init = 0; - return rv; - } - ldp->vcl_needs_real_epoll = 0; - ldp_alloc_workers (); - ldpw = ldp_worker_get_current (); - char *env_var_str = getenv (LDP_ENV_DEBUG); if (env_var_str) { @@ -298,12 +276,39 @@ ldp_init (void) { ldp->transparent_tls = 1; } +} + +static int +ldp_init (void) +{ + ldp_worker_ctx_t *ldpw; + int rv; + + ASSERT (!ldp->init); + + ldp_init_cfg (); + ldp->init = 1; + ldp->vcl_needs_real_epoll = 1; + rv = vls_app_create (ldp_get_app_name ()); + if (rv != VPPCOM_OK) + { + ldp->vcl_needs_real_epoll = 0; + if (rv == VPPCOM_EEXIST) + return 0; + LDBG (2, + "\nERROR: ldp_init: vppcom_app_create()" + " failed! rv = %d (%s)\n", + rv, vppcom_retval_str (rv)); + ldp->init = 0; + return rv; + } + ldp->vcl_needs_real_epoll = 0; + ldp_alloc_workers (); + ldpw = ldp_worker_get_current (); - /* *INDENT-OFF* */ pool_foreach (ldpw, ldp->workers) { clib_memset (&ldpw->clib_time, 0, sizeof (ldpw->clib_time)); } - /* *INDENT-ON* */ LDBG (0, "LDP initialization: done!"); -- 2.16.6