From 83bfca6c7155fd6c26b017d504941c61d4934508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= Date: Wed, 2 Mar 2022 11:18:33 +0100 Subject: [PATCH] MINOR: quic: Add a "slow start" callback to congestion controller We want to be able to make the congestion controllers re-enter the slow start state outside of the congestion controllers themselves. So, we add a callback ->slow_start() to do so. Define this callback for NewReno algorithm. --- include/haproxy/quic_cc-t.h | 1 + src/quic_cc_newreno.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/haproxy/quic_cc-t.h b/include/haproxy/quic_cc-t.h index 1efea048d..e66fc726c 100644 --- a/include/haproxy/quic_cc-t.h +++ b/include/haproxy/quic_cc-t.h @@ -94,6 +94,7 @@ struct quic_cc_algo { enum quic_cc_algo_type type; int (*init)(struct quic_cc *cc); 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); }; diff --git a/src/quic_cc_newreno.c b/src/quic_cc_newreno.c index f11a2fee0..6ed5f06fb 100644 --- a/src/quic_cc_newreno.c +++ b/src/quic_cc_newreno.c @@ -39,6 +39,19 @@ static int quic_cc_nr_init(struct quic_cc *cc) return 1; } +/* Re-enter slow start state. */ +static void quic_cc_nr_slow_start(struct quic_cc *cc) +{ + struct quic_path *path; + + path = container_of(cc, struct quic_path, cc); + cc->algo_state.nr.cwnd = path->min_cwnd; + /* Re-entering slow start state. */ + cc->algo_state.nr.state = QUIC_CC_ST_SS; + /* Recovery start time reset */ + cc->algo_state.nr.recovery_start_time = 0; +} + /* Slow start callback. */ static void quic_cc_nr_ss_cb(struct quic_cc *cc, struct quic_cc_event *ev) { @@ -145,6 +158,7 @@ struct quic_cc_algo quic_cc_algo_nr = { .type = QUIC_CC_ALGO_TP_NEWRENO, .init = quic_cc_nr_init, .event = quic_cc_nr_event, + .slow_start = quic_cc_nr_slow_start, .state_trace = quic_cc_nr_state_trace, };