]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Implement quic_conn_subscribe()
authorFrédéric Lécaille <flecaille@haproxy.com>
Mon, 20 Sep 2021 13:23:17 +0000 (15:23 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 23 Sep 2021 13:27:25 +0000 (15:27 +0200)
We implement ->subscribe() xprt callback which should be used only by the mux.

include/haproxy/mux_quic-t.h
include/haproxy/xprt_quic-t.h
src/xprt_quic.c

index 18e2cec954899300bbd682b9fce1a12aaa9b65b7..8907249b872c517cde4ad2d414d1134e6adde969 100644 (file)
@@ -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;
index 1bbae968da25cd1e2cfde7b0cb9a0f690b295fd4..30a28a214f3acafa95b12df8fc54b23678cab687 100644 (file)
@@ -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) ({ \
index 2d79d9a2f4b315426e4443bbf889e8bc09c1e2f3..88ac8a45a909f1f127501617cfa9e908944a7321 100644 (file)
@@ -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 <es> from events <event_type>.