BUG/MINOR: quic: fix bbr_inflight() calls with wrong gain value
authorFrederic Lecaille <flecaille@haproxy.com>
Wed, 4 Dec 2024 17:47:15 +0000 (18:47 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 5 Dec 2024 14:35:44 +0000 (15:35 +0100)
This patch fixes two wrong calls to bbr_inflight().

bbr_target_inflight() aim is to compute the number of bytes BBR has to put on
the network as bytes in flight (sent but not acked bytes). It must call
bbr_inflight() with the current window gain value (in place of a wrong fixed 100
gain value here, in percents).

bbr_is_time_to_cruise() also called bbr_inflight() with a wrong gain value
as parameter due to a confusion between the value mentioned by the RFC (1
meaning 100% of the current window) and our implementation which needs value in
percents (so 100 in place of 1 here). Note that bbr_is_time_to_cruise() aim is to
make BBR the decision to leave the probing_bw down state. The bug had as side
effect to make BBR stay in this state during too long periods of time during
which the bottleneck bandwidth is decreasing, leading to big oscillations
between the mininum and maximum bottleneck bandwidth estimations.

This patch must be backported to 3.1 where BBR was first implemented.

(cherry picked from commit 6404b7a18a518e04bf934c1635e8a0b34628149a)
Signed-off-by: Willy Tarreau <w@1wt.eu>

src/quic_cc_bbr.c

index 8f6e039..39fd673 100644 (file)
@@ -850,7 +850,7 @@ static void bbr_advance_max_bw_filter(struct bbr *bbr)
 
 static uint64_t bbr_target_inflight(struct bbr *bbr, struct quic_cc_path *p)
 {
-       uint64_t bdp = bbr_inflight(bbr, p, bbr->bw, 100);
+       uint64_t bdp = bbr_inflight(bbr, p, bbr->bw, bbr->cwnd_gain);
        return MIN(bdp, p->cwnd);
 }
 
@@ -982,7 +982,7 @@ static int bbr_is_time_to_cruise(struct bbr *bbr, struct quic_cc_path *p)
        if (p->in_flight > bbr_inflight_with_headroom(bbr, p))
                return 0; /* not enough headroom */
 
-       if (p->in_flight <= bbr_inflight(bbr, p, bbr->max_bw, 1))
+       if (p->in_flight <= bbr_inflight(bbr, p, bbr->max_bw, 100))
                return 1; /* inflight <= estimated BDP */
 
        return 0;