diff options
author | Nathan Skrzypczak <nathan.skrzypczak@gmail.com> | 2019-12-10 10:10:01 +0100 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2019-12-11 15:44:26 +0000 |
commit | 038c7e662a8673f13ed12310a450ff646e825824 (patch) | |
tree | 65797907f5b95abc17a542a2ebac808f634c8902 | |
parent | 5d4c99f27ee89a823d993853fe6b52e12c9e6c58 (diff) |
quic: Use per thread next_cid
Type: fix
Change-Id: Ia89427257b78f6f7ba62c9d1076bf0593ee2dca7
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
-rw-r--r-- | src/plugins/quic/quic.c | 16 | ||||
-rw-r--r-- | src/plugins/quic/quic.h | 2 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c index 24c5bb44934..d59504a3d99 100644 --- a/src/plugins/quic/quic.c +++ b/src/plugins/quic/quic.c @@ -1557,10 +1557,10 @@ quic_udp_session_connected_callback (u32 quic_app_index, u32 ctx_index, quicly_ctx = quic_get_quicly_ctx_from_ctx (ctx); ret = quicly_connect (&ctx->conn, quicly_ctx, (char *) ctx->srv_hostname, - sa, NULL, &quic_main.next_cid, ptls_iovec_init (NULL, - 0), - &quic_main.hs_properties, NULL); - ++quic_main.next_cid.master_id; + sa, NULL, &quic_main.wrk_ctx[thread_index].next_cid, + ptls_iovec_init (NULL, 0), &quic_main.hs_properties, + NULL); + ++quic_main.wrk_ctx[thread_index].next_cid.master_id; /* Save context handle in quicly connection */ quic_store_conn_ctx (ctx->conn, ctx); assert (ret == 0); @@ -1613,7 +1613,7 @@ quic_udp_session_migrate_callback (session_t * s, session_handle_t new_sh) u32 new_thread = session_thread_from_handle (new_sh); quic_ctx_t *ctx; - QUIC_ERR ("Session %x migrated to %lx", s->session_index, new_sh); + QUIC_DBG (2, "Session %x migrated to %lx", s->session_index, new_sh); QUIC_ASSERT (vlib_get_thread_index () == s->thread_index); ctx = quic_ctx_get (s->opaque, s->thread_index); QUIC_ASSERT (ctx->udp_session_handle == session_handle (s)); @@ -1816,7 +1816,8 @@ quic_accept_connection (u32 ctx_index, quic_rx_packet_ctx_t * pctx) quicly_ctx = quic_get_quicly_ctx_from_ctx (ctx); if ((rv = quicly_accept (&conn, quicly_ctx, NULL, &pctx->sa, - &pctx->packet, NULL, &quic_main.next_cid, NULL))) + &pctx->packet, NULL, + &quic_main.wrk_ctx[thread_index].next_cid, NULL))) { /* Invalid packet, pass */ assert (conn == NULL); @@ -1826,7 +1827,7 @@ quic_accept_connection (u32 ctx_index, quic_rx_packet_ctx_t * pctx) } assert (conn != NULL); - ++quic_main.next_cid.master_id; + ++quic_main.wrk_ctx[thread_index].next_cid.master_id; /* Save ctx handle in quicly connection */ quic_store_conn_ctx (conn, ctx); ctx->conn = conn; @@ -2228,6 +2229,7 @@ quic_init (vlib_main_t * vm) /* Timer wheels, one per thread. */ for (i = 0; i < num_threads; i++) { + qm->wrk_ctx[i].next_cid.thread_id = i; tw = &qm->wrk_ctx[i].timer_wheel; tw_timer_wheel_init_1t_3w_1024sl_ov (tw, quic_expired_timers_dispatch, 1e-3 /* timer period 1ms */ , ~0); diff --git a/src/plugins/quic/quic.h b/src/plugins/quic/quic.h index 9433a895a8b..dcdb6cf8e24 100644 --- a/src/plugins/quic/quic.h +++ b/src/plugins/quic/quic.h @@ -187,6 +187,7 @@ typedef struct quic_worker_ctx_ CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); int64_t time_now; /**< worker time */ tw_timer_wheel_1t_3w_1024sl_ov_t timer_wheel; /**< worker timer wheel */ + quicly_cid_plaintext_t next_cid; } quic_worker_ctx_t; typedef struct quic_rx_packet_ctx_ @@ -225,7 +226,6 @@ typedef struct quic_main_ u8 default_crypto_engine; /**< Used if you do connect with CRYPTO_ENGINE_NONE (0) */ ptls_handshake_properties_t hs_properties; - quicly_cid_plaintext_t next_cid; quic_session_cache_t session_cache; u32 udp_fifo_size; |