]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Add a "slow start" callback to congestion controller
authorFrédéric Lécaille <flecaille@haproxy.com>
Wed, 2 Mar 2022 10:18:33 +0000 (11:18 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 4 Mar 2022 16:47:32 +0000 (17:47 +0100)
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
src/quic_cc_newreno.c

index 1efea048d57b8bb3579ea26d6888cce00560f850..e66fc726c3c560db2bce4649ddd63693df3f447a 100644 (file)
@@ -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);
 };
 
index f11a2fee038b9cb096a78834f03b5d8dea3b2a47..6ed5f06fb7bb17cb6fa05c6f8cf5ef921b122b35 100644 (file)
@@ -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,
 };