From b823bb7f7fe42b9080e35ba7f859a807a626a9b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Thu, 31 Mar 2022 20:26:18 +0200 Subject: [PATCH] MINOR: quic: Add traces about list of frames This should be useful to have an idea of the list of frames which could be built towards the list of available frames when building packets. Same thing about the frames which could not be built because of a lack of room in the TX buffer. --- include/haproxy/xprt_quic-t.h | 1 + src/xprt_quic.c | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/include/haproxy/xprt_quic-t.h b/include/haproxy/xprt_quic-t.h index 9cb163ae9..e72ad6a74 100644 --- a/include/haproxy/xprt_quic-t.h +++ b/include/haproxy/xprt_quic-t.h @@ -226,6 +226,7 @@ enum quic_pkt_type { #define QUIC_EV_CONN_FREED (1ULL << 39) #define QUIC_EV_CONN_CLOSE (1ULL << 40) #define QUIC_EV_CONN_ACKSTRM (1ULL << 41) +#define QUIC_EV_CONN_FRMLIST (1ULL << 42) /* Similar to kernel min()/max() definitions. */ #define QUIC_MIN(a, b) ({ \ diff --git a/src/xprt_quic.c b/src/xprt_quic.c index bc96b3c57..37d6d15f8 100644 --- a/src/xprt_quic.c +++ b/src/xprt_quic.c @@ -121,6 +121,7 @@ static const struct trace_event quic_trace_events[] = { { .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."}, + { .mask = QUIC_EV_CONN_FRMLIST, .name = "frm_list", .desc = "frame list"}, { /* end */ } }; @@ -286,6 +287,16 @@ static void quic_trace(enum trace_level level, uint64_t mask, const struct trace } + if (mask & QUIC_EV_CONN_FRMLIST) { + const struct list *l = a2; + + if (l) { + const struct quic_frame *frm; + list_for_each_entry(frm, l, list) + chunk_frm_appendf(&trace_buf, frm); + } + } + if (mask & (QUIC_EV_CONN_HPKT|QUIC_EV_CONN_PAPKT)) { const struct quic_tx_packet *pkt = a2; const struct quic_enc_level *qel = a3; @@ -5293,6 +5304,7 @@ static int qc_do_build_pkt(unsigned char *pos, const unsigned char *end, if (!cc && !LIST_ISEMPTY(frms)) { ssize_t room = end - pos; + TRACE_PROTO("Avail. ack eliciting frames", QUIC_EV_CONN_FRMLIST, qc, frms); /* Initialize the length of the frames built below to . * If any frame could be successfully built by qc_build_frms(), * we will have len_frms > len. @@ -5419,14 +5431,15 @@ static int qc_do_build_pkt(unsigned char *pos, const unsigned char *end, pkt->len = pos - beg; LIST_SPLICE(&pkt->frms, &frm_list); - TRACE_PROTO("Ack eliciting frame", QUIC_EV_CONN_HPKT, qc, pkt); + TRACE_PROTO("Packet ack-eliciting frames", QUIC_EV_CONN_HPKT, qc, pkt); return 1; no_room: /* Replace the pre-built frames which could not be add to this packet */ LIST_SPLICE(frms, &frm_list); - TRACE_PROTO("Not enough room", QUIC_EV_CONN_HPKT, qc); + TRACE_PROTO("Remaining ack-eliciting frames", QUIC_EV_CONN_HPKT, qc, pkt); + return 0; }