]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Add traces about stream TX buffer consumption
authorFrédéric Lécaille <flecaille@haproxy.com>
Tue, 22 Mar 2022 11:45:33 +0000 (12:45 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 23 Mar 2022 08:01:45 +0000 (09:01 +0100)
This will be helpful to diagnose STREAM blocking states.

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

index 8be3fe609e86d2074974dc1802cd26f859e6375b..4e31f1c40470499a4bdc968ff11827d6d7d22d7c 100644 (file)
@@ -225,6 +225,7 @@ enum quic_pkt_type {
 #define           QUIC_EV_CONN_XPRTRECV  (1ULL << 38)
 #define           QUIC_EV_CONN_FREED     (1ULL << 39)
 #define           QUIC_EV_CONN_CLOSE     (1ULL << 40)
+#define           QUIC_EV_CONN_ACKSTRM   (1ULL << 41)
 
 /* Similar to kernel min()/max() definitions. */
 #define QUIC_MIN(a, b) ({ \
index b9aaeabaf1110f8a8ee699debd54b07da86ec35f..2aba3f628166b394ec0f504a45f04fc01acf42c9 100644 (file)
@@ -120,6 +120,7 @@ static const struct trace_event quic_trace_events[] = {
        { .mask = QUIC_EV_CONN_XPRTRECV, .name = "xprt_recv",        .desc = "receiving XRPT subscription" },
        { .mask = QUIC_EV_CONN_FREED,    .name = "conn_freed",       .desc = "releasing conn. memory" },
        { .mask = QUIC_EV_CONN_CLOSE,    .name = "conn_close",       .desc = "closing conn." },
+       { .mask = QUIC_EV_CONN_ACKSTRM,  .name = "ack_strm",         .desc = "STREAM ack."},
        { /* end */ }
 };
 
@@ -443,6 +444,16 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace
                                chunk_appendf(&trace_buf, "..%lu", *val2);
                }
 
+               if (mask & QUIC_EV_CONN_ACKSTRM) {
+                       const struct quic_stream *s = a2;
+                       const struct qcs *qcs = a3;
+
+                       if (s)
+                               chunk_appendf(&trace_buf, " off=%llu len=%llu", (ull)s->offset.key, (ull)s->len);
+                       if (qcs)
+                               chunk_appendf(&trace_buf, " ack_offset=%llu", (ull)qcs->tx.ack_offset);
+               }
+
                if (mask & QUIC_EV_CONN_RTTUPDT) {
                        const unsigned int *rtt_sample = a2;
                        const unsigned int *ack_delay = a3;
@@ -1402,6 +1413,8 @@ static int qcs_try_to_consume(struct qcs *qcs)
                if (strm->offset.key > qcs->tx.ack_offset)
                        break;
 
+               TRACE_PROTO("stream consumed", QUIC_EV_CONN_ACKSTRM,
+                           qcs->qcc->conn->qc, strm, qcs);
                if (strm->offset.key + strm->len > qcs->tx.ack_offset) {
                        const size_t diff = strm->offset.key + strm->len -
                                            qcs->tx.ack_offset;
@@ -1441,6 +1454,7 @@ static inline void qc_treat_acked_tx_frm(struct quic_conn *qc,
                struct qcs *qcs = frm->stream.qcs;
                struct quic_stream *strm = &frm->stream;
 
+               TRACE_PROTO("acked stream", QUIC_EV_CONN_ACKSTRM, qc, strm, qcs);
                if (strm->offset.key <= qcs->tx.ack_offset) {
                        if (strm->offset.key + strm->len > qcs->tx.ack_offset) {
                                const size_t diff = strm->offset.key + strm->len -
@@ -1455,6 +1469,8 @@ static inline void qc_treat_acked_tx_frm(struct quic_conn *qc,
                                }
                        }
 
+                       TRACE_PROTO("stream consumed", QUIC_EV_CONN_ACKSTRM,
+                                   qcs->qcc->conn->qc, strm, qcs);
                        LIST_DELETE(&frm->list);
                        quic_tx_packet_refdec(frm->pkt);
                        pool_free(pool_head_quic_frame, frm);