From a58fce23de31778fc3df306d7953e0eef068b4a9 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Thu, 28 Mar 2024 20:07:31 -0700 Subject: session: use custom types for session flags and state Type: improvement Signed-off-by: Florin Coras Change-Id: I04f836d09a1cbd5a5b55dc64359d2d761dfc4988 --- src/vnet/session/session_types.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/vnet/session') diff --git a/src/vnet/session/session_types.h b/src/vnet/session/session_types.h index ce115b21af8..5e650727d61 100644 --- a/src/vnet/session/session_types.h +++ b/src/vnet/session/session_types.h @@ -154,19 +154,19 @@ typedef enum session_ft_action_ /* * Session states */ -#define foreach_session_state \ - _(CREATED, "created") \ - _(LISTENING, "listening") \ - _(CONNECTING, "connecting") \ - _(ACCEPTING, "accepting") \ - _(READY, "ready") \ - _(OPENED, "opened") \ - _(TRANSPORT_CLOSING, "transport-closing") \ - _(CLOSING, "closing") \ - _(APP_CLOSED, "app-closed") \ - _(TRANSPORT_CLOSED, "transport-closed") \ - _(CLOSED, "closed") \ - _(TRANSPORT_DELETED, "transport-deleted") \ +#define foreach_session_state \ + _ (CREATED, "created") \ + _ (LISTENING, "listening") \ + _ (CONNECTING, "connecting") \ + _ (ACCEPTING, "accepting") \ + _ (READY, "ready") \ + _ (OPENED, "opened") \ + _ (TRANSPORT_CLOSING, "transport-closing") \ + _ (CLOSING, "closing") \ + _ (APP_CLOSED, "app-closed") \ + _ (TRANSPORT_CLOSED, "transport-closed") \ + _ (CLOSED, "closed") \ + _ (TRANSPORT_DELETED, "transport-deleted") typedef enum { @@ -174,7 +174,7 @@ typedef enum foreach_session_state #undef _ SESSION_N_STATES, -} session_state_t; +} __clib_packed session_state_t; #define foreach_session_flag \ _ (RX_EVT, "rx-event") \ @@ -225,13 +225,13 @@ typedef struct session_ session_type_t session_type; /** State in session layer state machine. See @ref session_state_t */ - volatile u8 session_state; + volatile session_state_t session_state; /** Index of the app worker that owns the session */ u32 app_wrk_index; /** Session flags. See @ref session_flags_t */ - u32 flags; + session_flags_t flags; /** Index of the transport connection associated to the session */ u32 connection_index; -- cgit 1.2.3-korg