Skip to content

Commit

Permalink
MINOR: quic: Update K CUBIC calculation (RFC 9438)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
haproxyFred committed Feb 12, 2024
1 parent 406c63b commit 2ed53ae
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/quic_cc_cubic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2ed53ae

Please sign in to comment.