MINOR: quic: Add recovery related information to "show quic"
authorFrédéric Lécaille <flecaille@haproxy.com>
Tue, 21 Mar 2023 12:42:43 +0000 (13:42 +0100)
committerFrédéric Lécaille <flecaille@haproxy.com>
Fri, 31 Mar 2023 07:54:59 +0000 (09:54 +0200)
Add ->srtt, ->rtt_var, ->rtt_min and ->pto_count values from ->path->loss
struct to "show quic". Same thing for ->cwnd from ->path struct.

Also take the opportunity of this patch to dump the packet number
space information directly from ->pktns[] array in place of ->els[]
array. Indeed, ->els[QUIC_TLS_ENC_LEVEL_EARLY_DATA] and ->els[QUIC_TLS_ENC_LEVEL_APP]
have the same packet number space.

Must be backported to 2.7 where "show quic" implementation has alredy been
backported.

src/quic_conn.c

index e512490..60c8f7c 100644 (file)
@@ -8179,7 +8179,7 @@ static int cli_io_handler_dump_quic(struct appctx *appctx)
        struct show_quic_ctx *ctx = appctx->svcctx;
        struct stconn *sc = appctx_sc(appctx);
        struct quic_conn *qc;
-       struct quic_enc_level *qel;
+       struct quic_pktns *pktns;
        struct eb64_node *node;
        struct qc_stream_desc *stream;
        char bufaddr[INET6_ADDRSTRLEN], bufport[6];
@@ -8307,21 +8307,21 @@ static int cli_io_handler_dump_quic(struct appctx *appctx)
 
                chunk_appendf(&trash, "\n");
 
-               /* Encryption levels */
-               qel = &qc->els[QUIC_TLS_ENC_LEVEL_INITIAL];
+               /* Packet number spaces information */
+               pktns = &qc->pktns[QUIC_TLS_PKTNS_INITIAL];
                chunk_appendf(&trash, "  [initl]             rx.ackrng=%-6zu tx.inflight=%-6zu",
-                             qel->pktns->rx.arngs.sz, qel->pktns->tx.in_flight);
-               qel = &qc->els[QUIC_TLS_ENC_LEVEL_HANDSHAKE];
+                             pktns->rx.arngs.sz, pktns->tx.in_flight);
+               pktns = &qc->pktns[QUIC_TLS_PKTNS_HANDSHAKE];
                chunk_appendf(&trash, "           [hndshk] rx.ackrng=%-6zu tx.inflight=%-6zu\n",
-                             qel->pktns->rx.arngs.sz, qel->pktns->tx.in_flight);
-               qel = &qc->els[QUIC_TLS_ENC_LEVEL_EARLY_DATA];
-               chunk_appendf(&trash, "  [0-rtt]             rx.ackrng=%-6zu tx.inflight=%-6zu",
-                             qel->pktns->rx.arngs.sz, qel->pktns->tx.in_flight);
-               qel = &qc->els[QUIC_TLS_ENC_LEVEL_APP];
-               chunk_appendf(&trash, "           [1-rtt]  rx.ackrng=%-6zu tx.inflight=%-6zu",
-                             qel->pktns->rx.arngs.sz, qel->pktns->tx.in_flight);
+                             pktns->rx.arngs.sz, pktns->tx.in_flight);
+               pktns = &qc->pktns[QUIC_TLS_PKTNS_01RTT];
+               chunk_appendf(&trash, "  [01rtt]             rx.ackrng=%-6zu tx.inflight=%-6zu\n",
+                             pktns->rx.arngs.sz, pktns->tx.in_flight);
+
+               chunk_appendf(&trash, "  srtt=%-4u rttvar=%-4u rttmin=%-4u ptoc=%-4u cwnd=%-6zu\n",
+                             qc->path->loss.srtt >> 3, qc->path->loss.rtt_var >> 2,
+                             qc->path->loss.rtt_min, qc->path->loss.pto_count, qc->path->cwnd);
 
-               chunk_appendf(&trash, "\n");
 
                /* Streams */
                node = eb64_first(&qc->streams_by_id);