summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/quic/quic.c6
-rw-r--r--src/vnet/session/application_worker.c16
-rw-r--r--src/vnet/session/session.h1
-rw-r--r--src/vnet/session/transport.h6
-rw-r--r--src/vnet/session/transport_types.h12
-rw-r--r--src/vnet/udp/udp.c16
6 files changed, 50 insertions, 7 deletions
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 3991656cefa..eeea8ab6f5c 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -1312,7 +1312,7 @@ quic_connect_connection (session_endpoint_cfg_t * sep)
vec_terminate_c_string (ctx->srv_hostname);
clib_memcpy (&cargs->sep, sep, sizeof (session_endpoint_cfg_t));
- cargs->sep.transport_proto = TRANSPORT_PROTO_UDPC;
+ cargs->sep.transport_proto = TRANSPORT_PROTO_UDP;
cargs->app_index = qm->app_index;
cargs->api_context = ctx_index;
@@ -1320,6 +1320,7 @@ quic_connect_connection (session_endpoint_cfg_t * sep)
app = application_get (app_wrk->app_index);
ctx->parent_app_id = app_wrk->app_index;
cargs->sep_ext.ns_index = app->ns_index;
+ cargs->sep_ext.flags = TRANSPORT_CFG_F_CONNECTED;
ctx->crypto_engine = sep->crypto_engine;
ctx->ckpair_index = sep->ckpair_index;
@@ -1427,7 +1428,8 @@ quic_start_listen (u32 quic_listen_session_index, transport_endpoint_t * tep)
args->app_index = qm->app_index;
args->sep_ext = *sep;
args->sep_ext.ns_index = app->ns_index;
- args->sep_ext.transport_proto = TRANSPORT_PROTO_UDPC;
+ args->sep_ext.transport_proto = TRANSPORT_PROTO_UDP;
+ args->sep_ext.transport_flags = TRANSPORT_CFG_F_CONNECTED;
if ((rv = vnet_listen (args)))
return rv;
diff --git a/src/vnet/session/application_worker.c b/src/vnet/session/application_worker.c
index 1793998f1e0..88ea7017d32 100644
--- a/src/vnet/session/application_worker.c
+++ b/src/vnet/session/application_worker.c
@@ -179,9 +179,14 @@ app_worker_init_listener (app_worker_t * app_wrk, session_t * ls)
hash_set (app_wrk->listeners_table, listen_session_get_handle (ls),
segment_manager_index (sm));
- if (session_transport_service_type (ls) == TRANSPORT_SERVICE_CL)
+ if (transport_connection_is_cless (session_get_transport (ls)))
{
- if (!ls->rx_fifo && app_worker_alloc_session_fifos (sm, ls))
+ if (ls->rx_fifo)
+ {
+ clib_warning ("sharing of connectionless listeners not supported");
+ return -1;
+ }
+ if (app_worker_alloc_session_fifos (sm, ls))
return -1;
}
return 0;
@@ -228,6 +233,13 @@ app_worker_stop_listen_session (app_worker_t * app_wrk, session_t * ls)
if (PREDICT_FALSE (!sm_indexp))
return;
+ /* Dealloc fifos first, if any, to avoid cleanup attempt lower */
+ if (ls->rx_fifo)
+ {
+ segment_manager_dealloc_fifos (ls->rx_fifo, ls->tx_fifo);
+ ls->tx_fifo = ls->rx_fifo = 0;
+ }
+
sm = segment_manager_get (*sm_indexp);
if (app_wrk->first_segment_manager == *sm_indexp)
{
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index 0a72f97a2f8..d72763a73ce 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -591,6 +591,7 @@ listen_session_get (u32 ls_index)
always_inline void
listen_session_free (session_t * s)
{
+ ASSERT (!s->rx_fifo);
session_free (s);
}
diff --git a/src/vnet/session/transport.h b/src/vnet/session/transport.h
index e5c09cd767d..53a0dd6c14e 100644
--- a/src/vnet/session/transport.h
+++ b/src/vnet/session/transport.h
@@ -195,6 +195,12 @@ transport_connection_deschedule (transport_connection_t * tc)
tc->flags |= TRANSPORT_CONNECTION_F_DESCHED;
}
+static inline u8
+transport_connection_is_cless (transport_connection_t * tc)
+{
+ return ((tc->flags & TRANSPORT_CONNECTION_F_CLESS) ? 1 : 0);
+}
+
void transport_connection_reschedule (transport_connection_t * tc);
/**
diff --git a/src/vnet/session/transport_types.h b/src/vnet/session/transport_types.h
index 44934daf0f0..b97955f5671 100644
--- a/src/vnet/session/transport_types.h
+++ b/src/vnet/session/transport_types.h
@@ -52,6 +52,12 @@ typedef enum transport_connection_flags_
* Connection descheduled by the session layer.
*/
TRANSPORT_CONNECTION_F_DESCHED = 1 << 2,
+ /**
+ * Connection is "connection less". Some important implications of that
+ * are that connections are not pinned to workers and listeners will
+ * have fifos associated to them
+ */
+ TRANSPORT_CONNECTION_F_CLESS = 1 << 3,
} transport_connection_flags_t;
typedef struct _spacer
@@ -186,10 +192,16 @@ typedef struct transport_endpoint_
#undef _
} transport_endpoint_t;
+typedef enum transport_endpt_cfg_flags_
+{
+ TRANSPORT_CFG_F_CONNECTED = 1 << 0,
+} transport_endpt_cfg_flags_t;
+
#define foreach_transport_endpoint_cfg_fields \
foreach_transport_endpoint_fields \
_(transport_endpoint_t, peer) \
_(u16, mss) \
+ _(u8, transport_flags) \
typedef struct transport_endpoint_pair_
{
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index 8fa1147b030..b069e720c7c 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -81,13 +81,14 @@ udp_session_bind (u32 session_index, transport_endpoint_t * lcl)
{
udp_main_t *um = vnet_get_udp_main ();
vlib_main_t *vm = vlib_get_main ();
+ transport_endpoint_cfg_t *lcl_ext;
udp_connection_t *listener;
+ udp_dst_port_info_t *pi;
u32 node_index;
void *iface_ip;
- udp_dst_port_info_t *pi;
- pi =
- udp_get_dst_port_info (um, clib_net_to_host_u16 (lcl->port), lcl->is_ip4);
+ pi = udp_get_dst_port_info (um, clib_net_to_host_u16 (lcl->port),
+ lcl->is_ip4);
if (pi)
return -1;
@@ -110,6 +111,11 @@ udp_session_bind (u32 session_index, transport_endpoint_t * lcl)
listener->c_s_index = session_index;
listener->c_fib_index = lcl->fib_index;
listener->flags |= UDP_CONN_F_OWNS_PORT;
+ lcl_ext = (transport_endpoint_cfg_t *) lcl;
+ if (lcl_ext->transport_flags & TRANSPORT_CFG_F_CONNECTED)
+ listener->flags |= UDP_CONN_F_CONNECTED;
+ else
+ listener->c_flags |= TRANSPORT_CONNECTION_F_CLESS;
clib_spinlock_init (&listener->rx_lock);
node_index = lcl->is_ip4 ? udp4_input_node.index : udp6_input_node.index;
@@ -327,6 +333,10 @@ udp_open_connection (transport_endpoint_cfg_t * rmt)
uc->c_proto = TRANSPORT_PROTO_UDP;
uc->c_fib_index = rmt->fib_index;
uc->flags |= UDP_CONN_F_OWNS_PORT;
+ if (rmt->transport_flags & TRANSPORT_CFG_F_CONNECTED)
+ uc->flags |= UDP_CONN_F_CONNECTED;
+ else
+ uc->c_flags |= TRANSPORT_CONNECTION_F_CLESS;
return uc->c_c_index;
}