From d4d6aa7b5c2623371e9ef4f68109127659536f88 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Fri, 3 Sep 2021 15:56:18 +0200 Subject: [PATCH] MINOR: quic: Attach the QUIC connection to a thread. Compute a thread ID from a QUIC CID and attach the I/O handler to this thread. --- include/haproxy/xprt_quic.h | 6 ++++++ src/xprt_quic.c | 1 + 2 files changed, 7 insertions(+) diff --git a/include/haproxy/xprt_quic.h b/include/haproxy/xprt_quic.h index 0586124..1158d0d 100644 --- a/include/haproxy/xprt_quic.h +++ b/include/haproxy/xprt_quic.h @@ -117,6 +117,12 @@ static inline void quic_cid_dump(struct buffer *buf, struct quic_cid *cid) chunk_appendf(buf, ")"); } +/* Simply compute a thread ID from a CID */ +static inline unsigned long quic_get_cid_tid(const struct quic_cid *cid) +{ + return cid->data[0] % global.nbthread; +} + /* Free the CIDs attached to QUIC connection. * Always succeeds. */ diff --git a/src/xprt_quic.c b/src/xprt_quic.c index ee7004b..cfe43b1 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -4406,6 +4406,7 @@ static int qc_conn_init(struct connection *conn, void **xprt_ctx) struct bind_conf *bc = __objt_listener(conn->target)->bind_conf; struct quic_conn *qc = ctx->conn->qc; + ctx->wait_event.tasklet->tid = quic_get_cid_tid(&qc->scid); if (ssl_bio_and_sess_init(conn, bc->initial_ctx, &ctx->ssl, &ctx->bio, ha_quic_meth, ctx) == -1) goto err; -- 1.7.10.4