session: add flag to track cless sessions 35/40135/7
authorFlorin Coras <fcoras@cisco.com>
Thu, 21 Dec 2023 21:50:53 +0000 (13:50 -0800)
committerFlorin Coras <fcoras@cisco.com>
Sat, 23 Dec 2023 03:30:09 +0000 (22:30 -0500)
Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I0bb6aba26f1cd974d6bb3b5fe6234aacfee0d30c

src/vnet/session/session.c
src/vnet/session/session_types.h

index 67652b5..9ac9229 100644 (file)
@@ -705,7 +705,7 @@ session_main_flush_enqueue_events (transport_proto_t transport_proto,
   session_worker_t *wrk = session_main_get_worker (thread_index);
   session_handle_t *handles;
   session_t *s;
-  u32 i;
+  u32 i, is_cl;
 
   handles = wrk->session_to_enqueue[transport_proto];
 
@@ -714,8 +714,12 @@ session_main_flush_enqueue_events (transport_proto_t transport_proto,
       s = session_get_from_handle (handles[i]);
       session_fifo_tuning (s, s->rx_fifo, SESSION_FT_ACTION_ENQUEUED,
                           0 /* TODO/not needed */);
-      session_enqueue_notify_inline (s,
-                                    s->thread_index != thread_index ? 1 : 0);
+      is_cl =
+       s->thread_index != thread_index || (s->flags & SESSION_F_IS_CLESS);
+      if (!is_cl)
+       session_enqueue_notify_inline (s, 0);
+      else
+       session_enqueue_notify_inline (s, 1);
     }
 
   vec_reset_length (handles);
@@ -1345,6 +1349,8 @@ session_open_cl (session_endpoint_cfg_t *rmt, session_handle_t *rsh)
   s->app_wrk_index = app_wrk->wrk_index;
   s->opaque = rmt->opaque;
   session_set_state (s, SESSION_STATE_OPENED);
+  if (transport_connection_is_cless (tc))
+    s->flags |= SESSION_F_IS_CLESS;
   if (app_worker_init_connected (app_wrk, s))
     {
       session_free (s);
@@ -1470,6 +1476,8 @@ session_listen (session_t * ls, session_endpoint_cfg_t * sep)
   ls = listen_session_get (s_index);
   ls->connection_index = tc_index;
   ls->opaque = sep->opaque;
+  if (transport_connection_is_cless (session_get_transport (ls)))
+    ls->flags |= SESSION_F_IS_CLESS;
 
   return 0;
 }
index 4fe0c7c..be3f9ff 100644 (file)
@@ -174,7 +174,8 @@ typedef enum
   _ (UNIDIRECTIONAL, "unidirectional")                                        \
   _ (CUSTOM_FIFO_TUNING, "custom-fifo-tuning")                                \
   _ (HALF_OPEN, "half-open")                                                  \
-  _ (APP_CLOSED, "app-closed")
+  _ (APP_CLOSED, "app-closed")                                                \
+  _ (IS_CLESS, "connectionless")
 
 typedef enum session_flags_bits_
 {