aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/session/session.h')
-rw-r--r--src/vnet/session/session.h24
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) \