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.
This commit is contained in:
Frederic Lecaille 2024-02-12 11:37:17 +01:00
parent 406c63ba44
commit 2ed53ae4a0

View File

@ -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) * K = cubic_root((W_max - cwnd_epoch)/C) (Figure 2)
* Note that K is stored in milliseconds. * Note that K is stored in milliseconds.
*/ */
c->K = cubic_root((c->last_w_max - path->cwnd) * c->K = cubic_root(((c->last_w_max - path->cwnd) << CUBIC_SCALE_FACTOR_SHIFT) / (CUBIC_C_SCALED * path->mtu));
(CUBIC_ONE_SCALED - CUBIC_BETA_SCALED) / (CUBIC_C_SCALED * path->mtu));
/* Convert to miliseconds. */ /* Convert to miliseconds. */
c->K *= 1000; c->K *= 1000;
c->W_target = c->last_w_max; c->W_target = c->last_w_max;