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

src/h3.c

index 49750f93c8e8d8d3b18412ad99e7b2444b6cd97b..8279c68ee9fb587358bd9ae00fb31e6616a98dde 100644 (file)
--- a/src/h3.c
+++ b/src/h3.c
@@ -51,6 +51,12 @@ static const struct trace_event h3_trace_events[] = {
        { .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" },
+#define           H3_EV_TX_DATA       (1ULL <<  4)
+       { .mask = H3_EV_TX_DATA,      .name = "tx_data",     .desc = "transmission of H3 DATA frame" },
+#define           H3_EV_TX_HDR        (1ULL <<  5)
+       { .mask = H3_EV_TX_HDR,       .name = "tx_hdr",      .desc = "transmission of H3 HEADERS frame" },
+#define           H3_EV_TX_SETTINGS   (1ULL <<  6)
+       { .mask = H3_EV_TX_SETTINGS,  .name = "tx_settings", .desc = "transmission of H3 SETTINGS frame" },
        { }
 };
 
@@ -699,6 +705,8 @@ static int h3_control_send(struct qcs *qcs, void *ctx)
        struct buffer pos, *res;
        size_t frm_len;
 
+       TRACE_ENTER(H3_EV_TX_SETTINGS, qcs->qcc->conn, qcs);
+
        BUG_ON_HOT(h3c->flags & H3_CF_SETTINGS_SENT);
 
        ret = 0;
@@ -740,6 +748,7 @@ static int h3_control_send(struct qcs *qcs, void *ctx)
                        tasklet_wakeup(qcs->qcc->wait_event.tasklet);
        }
 
+       TRACE_LEAVE(H3_EV_TX_SETTINGS, qcs->qcc->conn, qcs);
        return ret;
 }
 
@@ -757,6 +766,8 @@ static int h3_resp_headers_send(struct qcs *qcs, struct htx *htx)
        int hdr;
        int status = 0;
 
+       TRACE_ENTER(H3_EV_TX_HDR, qcs->qcc->conn, qcs);
+
        sl = NULL;
        hdr = 0;
        for (blk = htx_get_head_blk(htx); blk; blk = htx_get_next_blk(htx, blk)) {
@@ -842,9 +853,11 @@ static int h3_resp_headers_send(struct qcs *qcs, struct htx *htx)
                        break;
        }
 
+       TRACE_LEAVE(H3_EV_TX_HDR, qcs->qcc->conn, qcs);
        return ret;
 
  err:
+       TRACE_DEVEL("leaving on error", H3_EV_TX_HDR, qcs->qcc->conn, qcs);
        return 0;
 }
 
@@ -859,6 +872,8 @@ static int h3_resp_data_send(struct qcs *qcs, struct buffer *buf, size_t count)
        struct htx_blk *blk;
        enum htx_blk_type type;
 
+       TRACE_ENTER(H3_EV_TX_DATA, qcs->qcc->conn, qcs);
+
        htx = htx_from_buf(buf);
 
  new_frame:
@@ -918,6 +933,7 @@ static int h3_resp_data_send(struct qcs *qcs, struct buffer *buf, size_t count)
        goto new_frame;
 
  end:
+       TRACE_LEAVE(H3_EV_TX_DATA, qcs->qcc->conn, qcs);
        return total;
 }