From: Frederic Lecaille Date: Mon, 12 Feb 2024 10:37:17 +0000 (+0100) Subject: MINOR: quic: Update K CUBIC calculation (RFC 9438) X-Git-Tag: v3.0-dev4~61 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2ed53ae4a02ba49f529addb9003b747c8ab281b1;p=thirdparty%2Fhaproxy.git MINOR: quic: Update K CUBIC calculation (RFC 9438) The new formula for K CUBIC which arrives with RFC 9438 is as follows: K = cubic_root((W_max - cwnd_epoch) / C) Note that W_max is c->last_w_max, and cwnd_epoch is c->cwnd when entering quic_cubic_update() just after a congestion event. Must be backported as far as 2.6. --- diff --git a/src/quic_cc_cubic.c b/src/quic_cc_cubic.c index 7c478c6340..76a62acd06 100644 --- a/src/quic_cc_cubic.c +++ b/src/quic_cc_cubic.c @@ -241,8 +241,7 @@ static inline void quic_cubic_update(struct quic_cc *cc, uint32_t acked) * K = cubic_root((W_max - cwnd_epoch)/C) (Figure 2) * Note that K is stored in milliseconds. */ - c->K = cubic_root((c->last_w_max - path->cwnd) * - (CUBIC_ONE_SCALED - CUBIC_BETA_SCALED) / (CUBIC_C_SCALED * path->mtu)); + c->K = cubic_root(((c->last_w_max - path->cwnd) << CUBIC_SCALE_FACTOR_SHIFT) / (CUBIC_C_SCALED * path->mtu)); /* Convert to miliseconds. */ c->K *= 1000; c->W_target = c->last_w_max;