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.
* 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;