session: add session event log for session state
To aid sesipon debug, add session event log in SM debug to track
the session state.
Type: improvement
Signed-off-by: Steven Luong <sluong@cisco.com>
Change-Id: I6909cf969cd5b6a3ea5a06d08ae32c2f1d48f686
diff --git a/src/vnet/session/session_debug.h b/src/vnet/session/session_debug.h
index 588d58c..614ffc9 100644
--- a/src/vnet/session/session_debug.h
+++ b/src/vnet/session/session_debug.h
@@ -28,6 +28,7 @@
_ (DISPATCH_START, CLOCKS_EVT_DBG, 1, "dispatch start") \
_ (DISPATCH_END, CLOCKS_EVT_DBG, 1, "dispatch end") \
_ (DSP_CNTRS, CLOCKS_EVT_DBG, 1, "dispatch counters") \
+ _ (STATE_CHANGE, SM, 1, "session state change") \
_ (FREE, SM, 1, "session free") \
_ (IO_EVT_COUNTS, COUNTS_EVT_DBG, 1, "io evt counts") \
_ (COUNTS, COUNTS_EVT_DBG, 1, "ctrl evt counts")
@@ -165,6 +166,32 @@
ed = ELOG_DATA (&vlib_global_main.elog_main, _e)
#if SESSION_SM
+#define SESSION_EVT_STATE_CHANGE_HANDLER(_s) \
+ { \
+ ELOG_TYPE_DECLARE (_e) = { \
+ .format = "%s: idx %u", \
+ .format_args = "t4i4", \
+ .n_enum_strings = 12, \
+ .enum_strings = { \
+ "created", \
+ "listening", \
+ "connecting", \
+ "accepting", \
+ "ready", \
+ "opened", \
+ "transport closing", \
+ "closing", \
+ "app closed", \
+ "transport closed", \
+ "closed", \
+ "transport deleted", \
+ }, \
+ }; \
+ DEC_SESSION_ETD (_s, _e, 2); \
+ ed->data[0] = _s->session_state; \
+ ed->data[1] = _s->session_index; \
+ }
+
#define SESSION_EVT_FREE_HANDLER(_s) \
{ \
ELOG_TYPE_DECLARE (_e) = { \
@@ -175,6 +202,7 @@
ed->data[0] = _s->session_index; \
}
#else
+#define SESSION_EVT_STATE_CHANGE_HANDLER(_s)
#define SESSION_EVT_FREE_HANDLER(_s)
#endif