session: improve cli
Type: feature
Allow session cli filtering based on thread index, transport protocol,
session state and range of session pool indices. For instance
show session thread 1 proto tcp state ready range 0 20 verbose
Shows the session ids for the first 20 tcp sessions in thread 1 that are
in ready state.
To avoid excessive output that could reasult in the worker barrier being
held by the main thread for long periods of time, the session cli will
only output:
- session ids (verbose == 1) for a maximum of 50 sessions / worker
- verbose > 1 details for a maximum of 10 sessions
Change-Id: I2cfb351b548e2e0a1d5b4345810be613e2917d17
Signed-off-by: Florin Coras <fcoras@cisco.com>
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index 04fdebe..cb0cac7 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -584,6 +584,14 @@
return &session_main.wrk[thread_index];
}
+static inline session_worker_t *
+session_main_get_worker_if_valid (u32 thread_index)
+{
+ if (pool_is_free_index (session_main.wrk, thread_index))
+ return 0;
+ return &session_main.wrk[thread_index];
+}
+
always_inline svm_msg_q_t *
session_main_get_vpp_event_queue (u32 thread_index)
{
@@ -598,8 +606,8 @@
#define session_cli_return_if_not_enabled() \
do { \
- if (!session_main.is_enabled) \
- return clib_error_return(0, "session layer is not enabled"); \
+ if (!session_main.is_enabled) \
+ return clib_error_return (0, "session layer is not enabled"); \
} while (0)
int session_main_flush_enqueue_events (u8 proto, u32 thread_index);