Skip to content

Commit 1247c7a

Browse files
yydcooltechyminati
authored andcommitted
BACKPORT: tcp_bbr: fix quantization code to not raise cwnd if not probing bandwidth
There was a bug in the previous logic that attempted to ensure gain cycling gets inflight above BDP even for small BDPs. This code correctly raised and lowered target inflight values during the gain cycle. And this code correctly ensured that cwnd was raised when probing bandwidth. However, it did not correspondingly ensure that cwnd was *not* raised in this way when *not* probing for bandwidth. The result was that small-BDP flows that were always cwnd-bound could go for many cycles with a fixed cwnd, and not probe or yield bandwidth at all. This meant that multiple small-BDP flows could fail to converge in their bandwidth allocations. Fixes: 3c346b233c68 ("tcp_bbr: fix bw probing to raise in-flight data for very small BDPs") Signed-off-by: Kevin(Yudong) Yang <yyd@google.com> Acked-by: Neal Cardwell <ncardwell@google.com> Acked-by: Yuchung Cheng <ycheng@google.com> Acked-by: Soheil Hassas Yeganeh <soheil@google.com> Acked-by: Priyaranjan Jha <priyarjha@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Albert I <kras@raphielgang.org> Signed-off-by: Rapherion Rollerscaperers <rapherion@raphielgang.org> Signed-off-by: Aryan Sinha <sinha.aryan03@gmail.com>
1 parent 6f058f0 commit 1247c7a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/ipv4/tcp_bbr.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ static u32 bbr_bdp(struct sock *sk, u32 bw, int gain)
329329
* which allows 2 outstanding 2-packet sequences, to try to keep pipe
330330
* full even with ACK-every-other-packet delayed ACKs.
331331
*/
332-
static u32 bbr_quantization_budget(struct sock *sk, u32 cwnd, int gain)
332+
static u32 bbr_quantization_budget(struct sock *sk, u32 cwnd)
333333
{
334334
struct bbr *bbr = inet_csk_ca(sk);
335335

@@ -340,7 +340,7 @@ static u32 bbr_quantization_budget(struct sock *sk, u32 cwnd, int gain)
340340
cwnd = (cwnd + 1) & ~1U;
341341

342342
/* Ensure gain cycling gets inflight above BDP even for small BDPs. */
343-
if (bbr->mode == BBR_PROBE_BW && gain > BBR_UNIT)
343+
if (bbr->mode == BBR_PROBE_BW && bbr->cycle_idx == 0)
344344
cwnd += 2;
345345

346346
return cwnd;
@@ -352,7 +352,7 @@ static u32 bbr_inflight(struct sock *sk, u32 bw, int gain)
352352
u32 inflight;
353353

354354
inflight = bbr_bdp(sk, bw, gain);
355-
inflight = bbr_quantization_budget(sk, inflight, gain);
355+
inflight = bbr_quantization_budget(sk, inflight);
356356

357357
return inflight;
358358
}
@@ -419,7 +419,7 @@ static void bbr_set_cwnd(struct sock *sk, const struct rate_sample *rs,
419419

420420
/* If we're below target cwnd, slow start cwnd toward target cwnd. */
421421
target_cwnd = bbr_bdp(sk, bw, gain);
422-
target_cwnd = bbr_quantization_budget(sk, target_cwnd, gain);
422+
target_cwnd = bbr_quantization_budget(sk, target_cwnd);
423423
if (bbr_full_bw_reached(sk)) /* only cut cwnd if we filled the pipe */
424424
cwnd = min(cwnd + acked, target_cwnd);
425425
else if (cwnd < target_cwnd || tp->delivered < TCP_INIT_CWND)

0 commit comments

Comments
 (0)