diff options
author | Steven Luong <sluong@cisco.com> | 2022-10-10 11:37:57 -0700 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2022-10-13 18:25:46 +0000 |
commit | 10e5b4a016061f2d9485ff309d1239abb012aae0 (patch) | |
tree | cdb9a68c3badf5f5ca1edea27e08300cba986507 /src/vnet/session/session_debug.c | |
parent | af36e96d07911f26e8e36f59ea2319cb5c13c0ad (diff) |
session: make session code compile with SESSION_DEBUG enable
Session debug code does not compile anymore due to vlib_mains global
variable disappearing over time. Replace it with vlib_get_main_by_index
call.
Add a cmake variable and pass it from make command line to enable
session debug. Notice transport debug is required for session debug.
make rebuild VPP_EXTRA_CMAKE_ARGS=-DVPP_TCP_DEBUG_ALWAYS=ON VPP_EXTRA_CMAKE_ARGS+=-DVPP_SESSION_DEBUG=ON
Type: fix
Signed-off-by: Steven Luong <sluong@cisco.com>
Change-Id: Ic2e887c6b10b77cbabd56934f4931fcfa04a6751
Diffstat (limited to 'src/vnet/session/session_debug.c')
-rw-r--r-- | src/vnet/session/session_debug.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/vnet/session/session_debug.c b/src/vnet/session/session_debug.c index 8e4588ecd0b..e4efe1b244e 100644 --- a/src/vnet/session/session_debug.c +++ b/src/vnet/session/session_debug.c @@ -61,6 +61,13 @@ VLIB_CLI_COMMAND (show_session_dbg_clock_cycles_command, static) = }; /* *INDENT-ON* */ +static_always_inline f64 +session_dbg_time_now (u32 thread) +{ + vlib_main_t *vm = vlib_get_main_by_index (thread); + + return clib_time_now (&vm->clib_time) + vm->time_offset; +} static clib_error_t * clear_session_dbg_clock_cycles_fn (vlib_main_t * vm, unformat_input_t * input, @@ -77,7 +84,7 @@ clear_session_dbg_clock_cycles_fn (vlib_main_t * vm, unformat_input_t * input, { sde = &session_dbg_main.wrk[thread]; clib_memset (sde, 0, sizeof (session_dbg_evts_t)); - sde->last_time = vlib_time_now (vlib_mains[thread]); + sde->last_time = session_dbg_time_now (thread); sde->start_time = sde->last_time; } @@ -107,7 +114,7 @@ session_debug_init (void) for (thread = 0; thread < num_threads; thread++) { clib_memset (&sdm->wrk[thread], 0, sizeof (session_dbg_evts_t)); - sdm->wrk[thread].start_time = vlib_time_now (vlib_mains[thread]); + sdm->wrk[thread].start_time = session_dbg_time_now (thread); } } #else |