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.
This commit is contained in:
Frédéric Lécaille 2022-03-02 11:18:33 +01:00 committed by Amaury Denoyelle
parent ba9db40b07
commit 83bfca6c71
2 changed files with 15 additions and 0 deletions

View 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);
};

View 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,
};