From: Frédéric Lécaille Date: Mon, 20 Sep 2021 13:23:17 +0000 (+0200) Subject: MINOR: quic: Implement quic_conn_subscribe() X-Git-Tag: v2.5-dev8~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=513b4f290ad544146456eb29afae8408402fc147;p=thirdparty%2Fhaproxy.git MINOR: quic: Implement quic_conn_subscribe() We implement ->subscribe() xprt callback which should be used only by the mux. --- diff --git a/include/haproxy/mux_quic-t.h b/include/haproxy/mux_quic-t.h index 18e2cec954..8907249b87 100644 --- a/include/haproxy/mux_quic-t.h +++ b/include/haproxy/mux_quic-t.h @@ -154,6 +154,7 @@ struct qcc { struct list blocked_list; /* list of streams blocked for other reasons (e.g. sfctl, dep) */ struct buffer_wait buf_wait; /* wait list for buffer allocations */ struct wait_event wait_event; /* To be used if we're waiting for I/Os */ + struct wait_event *subs; /* recv wait_event the mux associated is waiting on (via quic_conn_subscribe) */ struct mt_list qcs_rxbuf_wlist; /* list of streams waiting for their rxbuf */ void *ctx; /* Application layer context */ const struct qcc_app_ops *app_ops; diff --git a/include/haproxy/xprt_quic-t.h b/include/haproxy/xprt_quic-t.h index 1bbae968da..30a28a214f 100644 --- a/include/haproxy/xprt_quic-t.h +++ b/include/haproxy/xprt_quic-t.h @@ -215,6 +215,8 @@ enum quic_pkt_type { #define QUIC_EV_CONN_PTIMER (1ULL << 34) #define QUIC_EV_CONN_SPTO (1ULL << 35) #define QUIC_EV_CONN_BCFRMS (1ULL << 36) +#define QUIC_EV_CONN_XPRTSEND (1ULL << 37) +#define QUIC_EV_CONN_XPRTRECV (1ULL << 38) /* Similar to kernel min()/max() definitions. */ #define QUIC_MIN(a, b) ({ \ diff --git a/src/xprt_quic.c b/src/xprt_quic.c index 2d79d9a2f4..88ac8a45a9 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -102,6 +102,8 @@ static const struct trace_event quic_trace_events[] = { { .mask = QUIC_EV_CONN_PTIMER, .name = "ptimer", .desc = "process timer" }, { .mask = QUIC_EV_CONN_SPTO, .name = "spto", .desc = "set PTO" }, { .mask = QUIC_EV_CONN_BCFRMS, .name = "bcfrms", .desc = "build CRYPTO data frames" }, + { .mask = QUIC_EV_CONN_XPRTSEND, .name = "xprt_send", .desc = "sending XRPT subscription" }, + { .mask = QUIC_EV_CONN_XPRTRECV, .name = "xprt_recv", .desc = "receiving XRPT subscription" }, { /* end */ } }; @@ -4357,7 +4359,21 @@ static size_t quic_conn_from_buf(struct connection *conn, void *xprt_ctx, const */ static int quic_conn_subscribe(struct connection *conn, void *xprt_ctx, int event_type, struct wait_event *es) { - return conn_subscribe(conn, xprt_ctx, event_type, es); + struct qcc *qcc = conn->qc->qcc; + + BUG_ON(event_type & ~(SUB_RETRY_SEND|SUB_RETRY_RECV)); + BUG_ON(qcc->subs && qcc->subs != es); + + es->events |= event_type; + qcc->subs = es; + + if (event_type & SUB_RETRY_RECV) + TRACE_DEVEL("subscribe(recv)", QUIC_EV_CONN_XPRTRECV, conn, qcc); + + if (event_type & SUB_RETRY_SEND) + TRACE_DEVEL("subscribe(send)", QUIC_EV_CONN_XPRTSEND, conn, qcc); + + return 0; } /* Called from the upper layer, to unsubscribe from events .