]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: quic: Update K CUBIC calculation (RFC 9438)
authorFrederic Lecaille <flecaille@haproxy.com>
Mon, 12 Feb 2024 10:37:17 +0000 (11:37 +0100)
committerFrederic Lecaille <flecaille@haproxy.com>
Mon, 12 Feb 2024 12:44:42 +0000 (13:44 +0100)
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.

src/quic_cc_cubic.c

index 7c478c63400e572a63f2e2a696a9e4a3d9365872..76a62acd0653d2a0686f4e9da79ab7c3e3f51e6a 100644 (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)
                         * 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;