Skip to content

Commit

Permalink
net-tcp_bbr: v2: don't assume prior_cwnd was set entering CA_Loss
Browse files Browse the repository at this point in the history
Fix WARN_ON_ONCE() warnings that were firing and pointing to a
bbr->prior_cwnd of 0 when exiting CA_Loss and transitioning to
CA_Open.

The issue was that tcp_simple_retransmit() calls:

  tcp_set_ca_state(sk, TCP_CA_Loss);

without first calling icsk_ca_ops->ssthresh(sk) (because
tcp_simple_retransmit() is dealing with losses due to MTU issues and
not congestion). The lack of this callback means that BBR did not get
a chance to set bbr->prior_cwnd, and thus upon exiting CA_Loss in such
cases the WARN_ON_ONCE() would fire due to a zero bbr->prior_cwnd.

This commit removes that warning, since a bbr->prior_cwnd of 0 is a
valid situation in this state transition.

For setting inflight_lo upon entering CA_Loss, to avoid setting an
inflight_lo of 0 in this case, this commit switches to taking the max
of cwnd and prior_cwnd. We plan to remove that line of code when we
switch to cautious (PRR-style) recovery, so that awkwardness will go
away.

Change-Id: I575dce871c2f20e91e3e9449e1706f42a07b8118
  • Loading branch information
nealcardwell authored and xanmod committed Mar 21, 2022
1 parent 4d164de commit a46b12b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions net/ipv4/tcp_bbr2.c
Expand Up @@ -2617,15 +2617,12 @@ static void bbr2_set_state(struct sock *sk, u8 new_state)
/* bbr_adapt_lower_bounds() needs cwnd before
* we suffered an RTO, to update inflight_lo:
*/
WARN_ON_ONCE(bbr->prior_cwnd == 0);
WARN_ON_ONCE(bbr->prior_cwnd == ~0U);
bbr->inflight_lo = bbr->prior_cwnd;
bbr->inflight_lo =
max(tp->snd_cwnd, bbr->prior_cwnd);
}
bbr_debug(sk, 0, &rs, &ctx);
} else if (bbr->prev_ca_state == TCP_CA_Loss &&
new_state != TCP_CA_Loss) {
WARN_ON_ONCE(bbr->prior_cwnd == 0);
WARN_ON_ONCE(bbr->prior_cwnd == ~0U);
tp->snd_cwnd = max(tp->snd_cwnd, bbr->prior_cwnd);
bbr->try_fast_path = 0; /* bound cwnd using latest model */
}
Expand Down

0 comments on commit a46b12b

Please sign in to comment.