aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session_node.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-02-27 07:55:46 -0800
committerDamjan Marion <dmarion@me.com>2019-03-01 11:51:53 +0000
commit2b81e3cba77e6427b47228318d55e40a859d02d1 (patch)
tree8034c15966f8fe40a87dbcddbbb67aa0864e9a7c /src/vnet/session/session_node.c
parent038243064ba0a6b587213ba56fffd9e3fddcf0ee (diff)
session: refactor local connects
- Switches local connects to cut-thru transport - Removes local sessions as a separate session type Change-Id: I997c6355d8c8e4f2110678f785b0f5d96bba47f7 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/session_node.c')
-rw-r--r--src/vnet/session/session_node.c60
1 files changed, 32 insertions, 28 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 7855bf8c56d..e6309429194 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -25,6 +25,14 @@
#include <vnet/session/session_debug.h>
#include <svm/queue.h>
+static void session_mq_accepted_reply_handler (void *data);
+
+static void
+accepted_notify_cb (void *data, u32 data_len)
+{
+ session_mq_accepted_reply_handler (data);
+}
+
static void
session_mq_accepted_reply_handler (void *data)
{
@@ -32,7 +40,6 @@ session_mq_accepted_reply_handler (void *data)
vnet_disconnect_args_t _a = { 0 }, *a = &_a;
session_state_t old_state;
app_worker_t *app_wrk;
- local_session_t *ls;
session_t *s;
/* Server isn't interested, kill the session */
@@ -44,38 +51,35 @@ session_mq_accepted_reply_handler (void *data)
return;
}
- if (session_handle_is_local (mp->handle))
+ /* Mail this back from the main thread. We're not polling in main
+ * thread so we're using other workers for notifications. */
+ if (vlib_num_workers () && vlib_get_thread_index () != 0
+ && session_thread_from_handle (mp->handle) == 0)
{
- ls = app_worker_get_local_session_from_handle (mp->handle);
- if (!ls)
- {
- clib_warning ("unknown local handle 0x%lx", mp->handle);
- return;
- }
- app_wrk = app_worker_get (ls->app_wrk_index);
- if (app_wrk->app_index != mp->context)
- {
- clib_warning ("server %u doesn't own local handle 0x%lx",
- mp->context, mp->handle);
- return;
- }
- if (app_worker_local_session_connect_notify (ls))
+ vl_api_rpc_call_main_thread (accepted_notify_cb, data,
+ sizeof (session_accepted_reply_msg_t));
+ return;
+ }
+
+ s = session_get_from_handle_if_valid (mp->handle);
+ if (!s)
+ return;
+
+ app_wrk = app_worker_get (s->app_wrk_index);
+ if (app_wrk->app_index != mp->context)
+ {
+ clib_warning ("app doesn't own session");
+ return;
+ }
+
+ if (!session_has_transport (s))
+ {
+ if (ct_session_connect_notify (s))
return;
- ls->session_state = SESSION_STATE_READY;
+ s->session_state = SESSION_STATE_READY;
}
else
{
- s = session_get_from_handle_if_valid (mp->handle);
- if (!s)
- return;
-
- app_wrk = app_worker_get (s->app_wrk_index);
- if (app_wrk->app_index != mp->context)
- {
- clib_warning ("app doesn't own session");
- return;
- }
-
old_state = s->session_state;
s->session_state = SESSION_STATE_READY;
if (!svm_fifo_is_empty (s->rx_fifo))