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
vnet_connect_args_t _cargs, *cargs = &_cargs;
transport_endpt_crypto_cfg_t *ccfg;
quic_main_t *qm = &quic_main;
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;
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;
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));
ccfg = &sep->ext_cfg->crypto;
clib_memset (cargs, 0, sizeof (*cargs));
app_worker_t *app_wrk;
quicly_conn_t *conn;
quic_ctx_t *ctx;
app_worker_t *app_wrk;
quicly_conn_t *conn;
quic_ctx_t *ctx;
- u32 thread_index = vlib_get_thread_index ();
int ret;
quicly_context_t *quicly_ctx;
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)
{
ctx = quic_ctx_get (ctx_index, thread_index);
if (err)
{
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 */ );
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);