summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-10-03 14:29:10 -0700
committerDave Barach <openvpp@barachs.net>2018-10-04 17:51:30 +0000
commita44d6b133bfb7ee0fb11d6ae8d9f0f00e57f242c (patch)
tree50715befb88bf17faca354acbf75781b0b441cfd /src/vnet
parent3e42ebe6ab460ba3eb0a6e334c084c9a669fbc4f (diff)
udp_echo: fix cut-through server mode
Change-Id: I20dd2071c936eb2c1870d45860553007c8e20587 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/session/application.c21
-rw-r--r--src/vnet/session/application.h24
2 files changed, 26 insertions, 19 deletions
diff --git a/src/vnet/session/application.c b/src/vnet/session/application.c
index 260ae588209..61909660ad6 100644
--- a/src/vnet/session/application.c
+++ b/src/vnet/session/application.c
@@ -872,10 +872,10 @@ app_worker_get_connect_segment_manager (app_worker_t * app)
segment_manager_t *
app_worker_get_listen_segment_manager (app_worker_t * app,
- stream_session_t * s)
+ stream_session_t * listener)
{
uword *smp;
- smp = hash_get (app->listeners_table, listen_session_get_handle (s));
+ smp = hash_get (app->listeners_table, listen_session_get_handle (listener));
ASSERT (smp != 0);
return segment_manager_get (*smp);
}
@@ -1721,21 +1721,28 @@ application_local_session_cleanup (app_worker_t * client_wrk,
local_session_t * ls)
{
svm_fifo_segment_private_t *seg;
+ stream_session_t *listener;
segment_manager_t *sm;
uword client_key;
u8 has_transport;
- has_transport = session_has_transport ((stream_session_t *) ls);
- client_key = application_client_local_connect_key (ls);
+ /* Retrieve listener transport type as it is the one that decides where
+ * the fifos are allocated */
+ has_transport = application_local_session_listener_has_transport (ls);
if (!has_transport)
sm = application_get_local_segment_manager_w_session (server_wrk, ls);
else
- sm = app_worker_get_listen_segment_manager (server_wrk,
- (stream_session_t *) ls);
+ {
+ listener = listen_session_get (ls->listener_index);
+ sm = app_worker_get_listen_segment_manager (server_wrk, listener);
+ }
seg = segment_manager_get_segment (sm, ls->svm_segment_index);
if (client_wrk)
- hash_unset (client_wrk->local_connects, client_key);
+ {
+ client_key = application_client_local_connect_key (ls);
+ hash_unset (client_wrk->local_connects, client_key);
+ }
if (!has_transport)
{
diff --git a/src/vnet/session/application.h b/src/vnet/session/application.h
index e83b7a6ba6e..e2f2279d77f 100644
--- a/src/vnet/session/application.h
+++ b/src/vnet/session/application.h
@@ -231,7 +231,7 @@ segment_manager_t *app_worker_get_listen_segment_manager (app_worker_t *,
stream_session_t *);
segment_manager_t *app_worker_get_connect_segment_manager (app_worker_t *);
int app_worker_alloc_connects_segment_manager (app_worker_t * app);
-int app_worker_add_segment_notify (u32 app_wrk_index, ssvm_private_t * fs);
+int app_worker_add_segment_notify (u32 app_or_wrk, ssvm_private_t * fs);
u32 app_worker_n_listeners (app_worker_t * app);
stream_session_t *app_worker_first_listener (app_worker_t * app,
u8 fib_proto,
@@ -245,7 +245,7 @@ clib_error_t *vnet_app_worker_add_del (vnet_app_worker_add_del_args_t * a);
int application_start_listen (application_t * app,
session_endpoint_extended_t * tep,
session_handle_t * handle);
-int application_stop_listen (u32 app_index, u32 app_wrk_index,
+int application_stop_listen (u32 app_index, u32 app_or_wrk,
session_handle_t handle);
application_t *application_alloc (void);
@@ -268,7 +268,7 @@ int application_is_builtin (application_t * app);
int application_is_builtin_proxy (application_t * app);
u32 application_session_table (application_t * app, u8 fib_proto);
u32 application_local_session_table (application_t * app);
-u8 *application_name_from_index (u32 app_wrk_index);
+u8 *application_name_from_index (u32 app_or_wrk);
u8 application_has_local_scope (application_t * app);
u8 application_has_global_scope (application_t * app);
u8 application_use_mq_for_ctrl (application_t * app);
@@ -297,15 +297,15 @@ local_session_t
int application_start_local_listen (application_t * server,
session_endpoint_extended_t * sep,
session_handle_t * handle);
-int application_stop_local_listen (u32 app_index, u32 app_wrk_index,
+int application_stop_local_listen (u32 app_index, u32 app_or_wrk,
session_handle_t lh);
int application_local_session_connect (app_worker_t * client,
app_worker_t * server,
local_session_t * ls, u32 opaque);
int application_local_session_connect_notify (local_session_t * ls);
-int application_local_session_disconnect (u32 app_wrk_index,
+int application_local_session_disconnect (u32 app_or_wrk,
local_session_t * ls);
-int application_local_session_disconnect_w_index (u32 app_wrk_index,
+int application_local_session_disconnect_w_index (u32 app_or_wrk,
u32 ls_index);
void app_worker_local_sessions_free (app_worker_t * app);
@@ -330,20 +330,20 @@ local_session_id (local_session_t * ls)
}
always_inline void
-local_session_parse_id (u32 ls_id, u32 * app_wrk_index, u32 * session_index)
+local_session_parse_id (u32 ls_id, u32 * app_or_wrk, u32 * session_index)
{
- *app_wrk_index = ls_id >> 16;
- *session_index = ls_id & 0xFFF;
+ *app_or_wrk = ls_id >> 16;
+ *session_index = ls_id & 0xFF;
}
always_inline void
-local_session_parse_handle (session_handle_t handle, u32 * server_index,
+local_session_parse_handle (session_handle_t handle, u32 * app_or_wrk_index,
u32 * session_index)
{
u32 bottom;
ASSERT ((handle >> 32) == SESSION_LOCAL_HANDLE_PREFIX);
bottom = (handle & 0xFFFFFFFF);
- local_session_parse_id (bottom, server_index, session_index);
+ local_session_parse_id (bottom, app_or_wrk_index, session_index);
}
always_inline session_handle_t
@@ -377,7 +377,7 @@ application_local_session_listener_has_transport (local_session_t * ls)
return (tp != TRANSPORT_PROTO_NONE);
}
-void mq_send_local_session_disconnected_cb (u32 app_wrk_index,
+void mq_send_local_session_disconnected_cb (u32 app_or_wrk,
local_session_t * ls);
uword unformat_application_proto (unformat_input_t * input, va_list * args);