summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/session_api.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-02-22 13:11:38 -0800
committerDave Barach <openvpp@barachs.net>2019-02-27 21:05:11 +0000
commitd4295e61a0ca183f54e54696e9edc5c87d2d116c (patch)
treed134bd2fc1d71e6c4911c1cb208506ca06a75829 /src/vnet/session/session_api.c
parente869269121b61883d55f2469fabf3c751b525d0f (diff)
session: refactor local/cut-through listens
Introduce a cut-through transport as replacement to local sessions. This first patch removes the per app local listener pools and switches local listeners to sessions with cut-through transport. Change-Id: I98b20c25bc5df5f4110bf66f76c650a973032618 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/session_api.c')
-rwxr-xr-xsrc/vnet/session/session_api.c66
1 files changed, 16 insertions, 50 deletions
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index f96274ae3f3..cf5a5cd7fd1 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -253,22 +253,10 @@ send_session_accept_callback (session_t * s)
else
{
local_session_t *ls = (local_session_t *) s;
- local_session_t *ll;
- if (application_local_session_listener_has_transport (ls))
- {
- listener = listen_session_get (ls->listener_index);
- al = app_listener_get (server, listener->al_index);
- mp->listener_handle = app_listener_handle (al);
- mp->is_ip4 = session_type_is_ip4 (listener->session_type);
- }
- else
- {
- ll = application_get_local_listen_session (server,
- ls->listener_index);
- al = app_listener_get (server, ll->al_index);
- mp->listener_handle = app_listener_handle (al);
- mp->is_ip4 = session_type_is_ip4 (ll->listener_session_type);
- }
+ listener = listen_session_get (ls->listener_index);
+ al = app_listener_get (server, listener->al_index);
+ mp->listener_handle = app_listener_handle (al);
+ mp->is_ip4 = session_type_is_ip4 (listener->session_type);
mp->handle = application_local_session_handle (ls);
mp->port = ls->port;
mp->vpp_event_queue_address = ls->client_evt_q;
@@ -464,7 +452,6 @@ mq_send_session_accepted_cb (session_t * s)
else
{
local_session_t *ls = (local_session_t *) s;
- local_session_t *ll;
u8 main_thread = vlib_num_workers ()? 1 : 0;
send_app_cut_through_registration_add (app_wrk->api_client_index,
@@ -472,20 +459,10 @@ mq_send_session_accepted_cb (session_t * s)
ls->server_evt_q,
ls->client_evt_q);
- if (application_local_session_listener_has_transport (ls))
- {
- listener = listen_session_get (ls->listener_index);
- al = app_listener_get (app, listener->al_index);
- mp->listener_handle = app_listener_handle (al);
- mp->is_ip4 = session_type_is_ip4 (listener->session_type);
- }
- else
- {
- ll = application_get_local_listen_session (app, ls->listener_index);
- al = app_listener_get (app, ll->al_index);
- mp->listener_handle = app_listener_handle (al);
- mp->is_ip4 = session_type_is_ip4 (ll->listener_session_type);
- }
+ listener = listen_session_get (ls->listener_index);
+ al = app_listener_get (app, listener->al_index);
+ mp->listener_handle = app_listener_handle (al);
+ mp->is_ip4 = session_type_is_ip4 (listener->session_type);
mp->handle = application_local_session_handle (ls);
mp->port = ls->port;
vpp_queue = session_manager_get_vpp_event_queue (main_thread);
@@ -671,12 +648,10 @@ mq_send_session_bound_cb (u32 app_wrk_index, u32 api_context,
session_bound_msg_t *mp;
app_worker_t *app_wrk;
session_event_t *evt;
- application_t *app;
app_listener_t *al;
session_t *ls = 0;
app_wrk = app_worker_get (app_wrk_index);
- app = application_get (app_wrk->app_index);
app_mq = app_wrk->event_queue;
if (!app_mq)
{
@@ -698,24 +673,15 @@ mq_send_session_bound_cb (u32 app_wrk_index, u32 api_context,
goto done;
mp->handle = handle;
- if (application_has_global_scope (app))
- {
- al = app_listener_get_w_handle (handle);
- ls = app_listener_get_session (al);
- tc = listen_session_get_transport (ls);
- mp->lcl_port = tc->lcl_port;
- mp->lcl_is_ip4 = tc->is_ip4;
- clib_memcpy_fast (mp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip));
- }
+ al = app_listener_get_w_handle (handle);
+ if (al->session_index != SESSION_INVALID_INDEX)
+ ls = app_listener_get_session (al);
else
- {
- local_session_t *local;
- app_listener_t *al;
- al = app_listener_get_w_handle (handle);
- local = application_get_local_listen_session (app, al->local_index);
- mp->lcl_port = local->port;
- mp->lcl_is_ip4 = session_type_is_ip4 (local->session_type);
- }
+ ls = app_listener_get_local_session (al);
+ tc = listen_session_get_transport (ls);
+ mp->lcl_port = tc->lcl_port;
+ mp->lcl_is_ip4 = tc->is_ip4;
+ clib_memcpy_fast (mp->lcl_ip, &tc->lcl_ip, sizeof (tc->lcl_ip));
vpp_evt_q = session_manager_get_vpp_event_queue (0);
mp->vpp_evt_q = pointer_to_uword (vpp_evt_q);