Skip to content

Commit 74301b2

Browse files
committed
fix(bbr): correct argument order in bbr_get_raw_target_cwnd calls
The function signature is: bbr_get_raw_target_cwnd(struct tcp_bbr *bbr, uint32_t gain, uint64_t bw) But two call sites had bw and gain swapped: - bbr_get_target_cwnd: bbr_get_raw_target_cwnd(bbr, bw, gain) - bbr_get_a_state_target: bbr_get_raw_target_cwnd(bbr, bbr_get_bw(bbr), gain) This caused bw (uint64_t) to be truncated to uint32_t and treated as gain, while gain was passed as bw, resulting in incorrect BDP calculation and severely underestimated cwnd when using BBR congestion control. Fix both call sites to pass arguments in the correct order (gain, bw). Fixes #1032
1 parent 22608e4 commit 74301b2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • freebsd/netinet/tcp_stacks

freebsd/netinet/tcp_stacks/bbr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3466,7 +3466,7 @@ bbr_get_target_cwnd(struct tcp_bbr *bbr, uint64_t bw, uint32_t gain)
34663466

34673467
mss = min((bbr->rc_tp->t_maxseg - bbr->rc_last_options), bbr->r_ctl.rc_pace_max_segs);
34683468
/* Get the base cwnd with gain rounded to a mss */
3469-
cwnd = roundup(bbr_get_raw_target_cwnd(bbr, bw, gain), mss);
3469+
cwnd = roundup(bbr_get_raw_target_cwnd(bbr, gain, bw), mss);
34703470
/*
34713471
* Add in N (2 default since we do not have a
34723472
* fq layer to trap packets in) quanta's per the I-D
@@ -10718,8 +10718,8 @@ bbr_get_a_state_target(struct tcp_bbr *bbr, uint32_t gain)
1071810718
mss = min((bbr->rc_tp->t_maxseg - bbr->rc_last_options),
1071910719
bbr->r_ctl.rc_pace_max_segs);
1072010720
/* Get the base cwnd with gain rounded to a mss */
10721-
tar = roundup(bbr_get_raw_target_cwnd(bbr, bbr_get_bw(bbr),
10722-
gain), mss);
10721+
tar = roundup(bbr_get_raw_target_cwnd(bbr, gain,
10722+
bbr_get_bw(bbr)), mss);
1072310723
/* Make sure it is within our min */
1072410724
if (tar < get_min_cwnd(bbr))
1072510725
return (get_min_cwnd(bbr));

0 commit comments

Comments
 (0)