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 <fcoras@cisco.com>
Change-Id: I5dfd1d59032db937fea146b6b84b8e26307a0de0
This commit is contained in:
Florin Coras
2023-03-09 18:23:05 -08:00
committed by Dave Barach
parent 767a9ab4b1
commit c6c4e86637

View File

@ -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!");