]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Add information to "show quic" for CUBIC cc.
authorFrederic Lecaille <flecaille@haproxy.com>
Fri, 26 Jul 2024 14:06:27 +0000 (16:06 +0200)
committerFrederic Lecaille <flecaille@haproxy.com>
Fri, 26 Jul 2024 14:42:44 +0000 (16:42 +0200)
Add ->state_cli() new callback to quic_cc_algo struct to define a
function called by the "show quic (cc|full)" commands to dump some information
about the congestion algorithm internal state currently in use by the QUIC
connections.

Implement this callback for CUBIC algorithm to dump its internal variables:
   - K: (the time to reach the cubic curve inflexion point),
   - last_w_max: the last maximum window value reached before intering
     the last recovery period. This is also the window value at the
     inflexion point of the cubic curve,
   - wdiff: the difference between the current window value and last_w_max.
     So negative before the inflexion point, and positive after.

include/haproxy/quic_cc-t.h
src/quic_cc_cubic.c
src/quic_cli.c

index 39699e450509d646e17c9b8a4ee88e73714f50d4..d6fa46d654d94d940eb2c03f2f3ecf909f85d5d2 100644 (file)
@@ -120,6 +120,7 @@ struct quic_cc_algo {
        void (*event)(struct quic_cc *cc, struct quic_cc_event *ev);
        void (*slow_start)(struct quic_cc *cc);
        void (*state_trace)(struct buffer *buf, const struct quic_cc *cc);
+       void (*state_cli)(struct buffer *buf, const struct quic_cc_path *path);
        void (*hystart_start_round)(struct quic_cc *cc, uint64_t pn);
 };
 
index fc21aa0f530fb55662b500c96d5405636bb770b0..245917d8c13a9b6c60bcb66196c3f4c210695e74 100644 (file)
@@ -643,6 +643,15 @@ static void quic_cc_cubic_state_trace(struct buffer *buf, const struct quic_cc *
                      TICKS_TO_MS(tick_remain(c->recovery_start_time, now_ms)));
 }
 
+static void quic_cc_cubic_state_cli(struct buffer *buf, const struct quic_cc_path *path)
+{
+       struct cubic *c = quic_cc_priv(&path->cc);
+
+       chunk_appendf(buf, "  cc: state=%s ssthresh=%u K=%u last_w_max=%u wdiff=%ld\n",
+                     quic_cc_state_str(c->state), c->ssthresh, c->K, c->last_w_max,
+                     (int64_t)(path->cwnd - c->last_w_max));
+}
+
 struct quic_cc_algo quic_cc_algo_cubic = {
        .type        = QUIC_CC_ALGO_TP_CUBIC,
        .init        = quic_cc_cubic_init,
@@ -650,6 +659,7 @@ struct quic_cc_algo quic_cc_algo_cubic = {
        .slow_start  = quic_cc_cubic_slow_start,
        .hystart_start_round = quic_cc_cubic_hystart_start_round,
        .state_trace = quic_cc_cubic_state_trace,
+       .state_cli   = quic_cc_cubic_state_cli,
 };
 
 void quic_cc_cubic_check(void)
index 6e9ee0c268e83e3a6a5bb544dd4e9ab32d9656ec..d5eda2e6a04a6dac9a4e73c3a7ec1163bd4e26ba 100644 (file)
@@ -300,6 +300,9 @@ static void dump_quic_full(struct show_quic_ctx *ctx, struct quic_conn *qc)
        }
 
        if (ctx->fields & QUIC_DUMP_FLD_CC) {
+               if (qc->path->cc.algo->state_cli)
+                       qc->path->cc.algo->state_cli(&trash, qc->path);
+
                chunk_appendf(&trash, "  srtt=%-4u  rttvar=%-4u rttmin=%-4u ptoc=%-4u\n"
                                      "  cwnd=%-6llu            mcwnd=%-6llu\n"
                                      "  sentbytes=%-12llu sentbytesgso=%-12llu sentpkts=%-6llu\n"