]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: h3: add traces on frame recv
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 30 May 2022 13:50:34 +0000 (15:50 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 30 May 2022 15:35:57 +0000 (17:35 +0200)
Add h3 traces events for several received frames : SETTINGS, HEADERS and
DATA.

src/h3.c

index 9627e0ba4a3104b700868709e05f65c6c90d108b..49750f93c8e8d8d3b18412ad99e7b2444b6cd97b 100644 (file)
--- a/src/h3.c
+++ b/src/h3.c
@@ -43,6 +43,14 @@ static void h3_trace(enum trace_level level, uint64_t mask,
                      const void *a1, const void *a2, const void *a3, const void *a4);
 
 static const struct trace_event h3_trace_events[] = {
+#define           H3_EV_RX_FRAME      (1ULL <<  0)
+       { .mask = H3_EV_RX_FRAME,     .name = "rx_frame",    .desc = "receipt of any H3 frame" },
+#define           H3_EV_RX_DATA       (1ULL <<  1)
+       { .mask = H3_EV_RX_DATA,      .name = "rx_data",     .desc = "receipt of H3 DATA frame" },
+#define           H3_EV_RX_HDR        (1ULL <<  2)
+       { .mask = H3_EV_RX_HDR,       .name = "rx_hdr",      .desc = "receipt of H3 HEADERS frame" },
+#define           H3_EV_RX_SETTINGS   (1ULL <<  3)
+       { .mask = H3_EV_RX_SETTINGS,  .name = "rx_settings", .desc = "receipt of H3 SETTINGS frame" },
        { }
 };
 
@@ -320,6 +328,8 @@ static int h3_headers_to_htx(struct qcs *qcs, struct ncbuf *buf, uint64_t len,
        struct ist authority = IST_NULL;
        int hdr_idx;
 
+       TRACE_ENTER(H3_EV_RX_FRAME|H3_EV_RX_HDR, qcs->qcc->conn, qcs);
+
        /* TODO support buffer wrapping */
        BUG_ON(ncb_head(buf) + len >= ncb_wrap(buf));
        if (qpack_decode_fs((const unsigned char *)ncb_head(buf), len, tmp, list) < 0)
@@ -392,6 +402,7 @@ static int h3_headers_to_htx(struct qcs *qcs, struct ncbuf *buf, uint64_t len,
        b_free(&htx_buf);
        offer_buffers(NULL, 1);
 
+       TRACE_LEAVE(H3_EV_RX_FRAME|H3_EV_RX_HDR, qcs->qcc->conn, qcs);
        return len;
 }
 
@@ -410,6 +421,8 @@ static int h3_data_to_htx(struct qcs *qcs, struct ncbuf *buf, uint64_t len,
        int htx_space;
        char *head;
 
+       TRACE_ENTER(H3_EV_RX_FRAME|H3_EV_RX_DATA, qcs->qcc->conn, qcs);
+
        appbuf = qc_get_buf(qcs, &qcs->rx.app_buf);
        BUG_ON(!appbuf);
        htx = htx_from_buf(appbuf);
@@ -456,6 +469,8 @@ static int h3_data_to_htx(struct qcs *qcs, struct ncbuf *buf, uint64_t len,
 
  out:
        htx_to_buf(htx, appbuf);
+
+       TRACE_LEAVE(H3_EV_RX_FRAME|H3_EV_RX_DATA, qcs->qcc->conn, qcs);
        return htx_sent;
 }
 
@@ -471,6 +486,8 @@ static size_t h3_parse_settings_frm(struct h3c *h3c, const struct ncbuf *rxbuf,
        size_t ret = 0;
        long mask = 0;   /* used to detect duplicated settings identifier */
 
+       TRACE_ENTER(H3_EV_RX_FRAME|H3_EV_RX_SETTINGS, h3c->qcc->conn);
+
        b = h3_b_dup(rxbuf);
        b_set_data(&b, len);
 
@@ -531,6 +548,7 @@ static size_t h3_parse_settings_frm(struct h3c *h3c, const struct ncbuf *rxbuf,
                }
        }
 
+       TRACE_LEAVE(H3_EV_RX_FRAME|H3_EV_RX_SETTINGS);
        return ret;
 }