MINOR: quic: Add traces about stream TX buffer consumption
This will be helpful to diagnose STREAM blocking states.
diff --git a/include/haproxy/xprt_quic-t.h b/include/haproxy/xprt_quic-t.h
index 8be3fe6..4e31f1c 100644
--- a/include/haproxy/xprt_quic-t.h
+++ b/include/haproxy/xprt_quic-t.h
@@ -225,6 +225,7 @@
#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) ({ \
diff --git a/src/xprt_quic.c b/src/xprt_quic.c
index b9aaeab..2aba3f6 100644
--- a/src/xprt_quic.c
+++ b/src/xprt_quic.c
@@ -120,6 +120,7 @@
{ .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 @@
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 @@
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 @@
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 @@
}
}
+ 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);