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.
diff --git a/include/haproxy/quic_cc-t.h b/include/haproxy/quic_cc-t.h
index 1efea04..e66fc72 100644
--- a/include/haproxy/quic_cc-t.h
+++ b/include/haproxy/quic_cc-t.h
@@ -94,6 +94,7 @@
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 f11a2fe..6ed5f06 100644
--- a/src/quic_cc_newreno.c
+++ b/src/quic_cc_newreno.c
@@ -39,6 +39,19 @@
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 @@
.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,
};