aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-05-10 17:21:06 -0700
committerDamjan Marion <dmarion@me.com>2021-05-11 07:38:27 +0000
commit033e6ef52473aa3a87b1fe6db64114258106304b (patch)
tree4630d7bcdcc4d528102e4aa1cefc40f63c47f4a6 /src/plugins
parent04a14133c89bf869d51bace64d2c3e62d9e61c87 (diff)
quic: alloc ctx on udp thread
UDP sessions are allocated on first worker because main does not poll. Consequently, quic should also allocate connection on first, to avoid multiple migration events. Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ice229a42c399e87150e0f6dd76e2e06ab271556c
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/quic/quic.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 5a57947325a..4ca42b9fdfc 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -1298,16 +1298,17 @@ quic_connect_connection (session_endpoint_cfg_t * sep)
vnet_connect_args_t _cargs, *cargs = &_cargs;
transport_endpt_crypto_cfg_t *ccfg;
quic_main_t *qm = &quic_main;
+ u32 ctx_index, thread_index;
quic_ctx_t *ctx;
app_worker_t *app_wrk;
application_t *app;
- u32 ctx_index;
- u32 thread_index = vlib_get_thread_index ();
int error;
if (!sep->ext_cfg)
return SESSION_E_NOEXTCFG;
+ /* Use pool on thread 1 if we have workers because of UDP */
+ thread_index = vlib_num_workers () ? 1 : 0;
ccfg = &sep->ext_cfg->crypto;
clib_memset (cargs, 0, sizeof (*cargs));
@@ -1785,11 +1786,15 @@ quic_udp_session_connected_callback (u32 quic_app_index, u32 ctx_index,
app_worker_t *app_wrk;
quicly_conn_t *conn;
quic_ctx_t *ctx;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index;
int ret;
quicly_context_t *quicly_ctx;
-
+ /* Allocate session on whatever thread udp used, i.e., probably first
+ * worker, although this may be main thread. If it is main, it's done
+ * with a worker barrier */
+ thread_index = udp_session->thread_index;
+ ASSERT (thread_index == 0 || thread_index == 1);
ctx = quic_ctx_get (ctx_index, thread_index);
if (err)
{
@@ -1833,11 +1838,7 @@ quic_udp_session_connected_callback (u32 quic_app_index, u32 ctx_index,
QUIC_DBG (2, "Registering conn with id %lu %lu", kv.key[0], kv.key[1]);
clib_bihash_add_del_16_8 (&quic_main.connection_hash, &kv, 1 /* is_add */ );
- /* UDP stack quirk? preemptively transfer connection if that happens */
- if (udp_session->thread_index != thread_index)
- quic_transfer_connection (ctx_index, udp_session->thread_index);
- else
- quic_send_packets (ctx);
+ quic_send_packets (ctx);
return ret;
}