diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2023-03-14 08:50:28 +0100 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2023-03-22 19:43:56 +0000 |
commit | ac3c8dcb076245544e61dabb984d057167572276 (patch) | |
tree | 5647af082aa3227a6c428a290ce317e3a505ddc8 /src/vnet/session/session.h | |
parent | b53b88a08ef25031708d1e51960713845752c6f2 (diff) |
session: add session stats
Type: feature
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Change-Id: I02d9bb5292b32ffb1b2f05daccd8a7d5dba05125
Diffstat (limited to 'src/vnet/session/session.h')
-rw-r--r-- | src/vnet/session/session.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h index 456718afb89..e92b1f079d6 100644 --- a/src/vnet/session/session.h +++ b/src/vnet/session/session.h @@ -40,6 +40,11 @@ typedef enum SESSION_N_ERROR, } session_input_error_t; +typedef struct session_wrk_stats_ +{ + u32 errors[SESSION_N_ERRORS]; +} session_wrk_stats_t; + typedef struct session_tx_context_ { CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); @@ -169,6 +174,8 @@ typedef struct session_worker_ u16 batch_num; vlib_dma_batch_t *batch; + session_wrk_stats_t stats; + #if SESSION_DEBUG /** last event poll time by thread */ clib_time_type_t last_event_poll; @@ -732,6 +739,23 @@ session_main_is_enabled () return session_main.is_enabled == 1; } +always_inline void +session_worker_stat_error_inc (session_worker_t *wrk, int error, int value) +{ + if ((-(error) >= 0 && -(error) < SESSION_N_ERRORS)) + wrk->stats.errors[-error] += value; + else + SESSION_DBG ("unknown session counter"); +} + +always_inline void +session_stat_error_inc (int error, int value) +{ + session_worker_t *wrk; + wrk = session_main_get_worker (vlib_get_thread_index ()); + session_worker_stat_error_inc (wrk, error, value); +} + #define session_cli_return_if_not_enabled() \ do { \ if (!session_main.is_enabled) \ |