fix(bbr): correct argument order in bbr_get_raw_target_cwnd calls#1058
Merged
jfb8856606 merged 1 commit intodevfrom Mar 27, 2026
Merged
fix(bbr): correct argument order in bbr_get_raw_target_cwnd calls#1058jfb8856606 merged 1 commit intodevfrom
jfb8856606 merged 1 commit intodevfrom
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The function
bbr_get_raw_target_cwndhas the following signature:But two call sites had
bwandgainswapped:In
bbr_get_target_cwnd(line 3469):In
bbr_get_a_state_target(line 10721):Impact
Due to the swapped arguments:
bw(uint64_t, actual bandwidth in bytes/sec) was truncated to uint32_t and used as the gain multipliergain(uint32_t, a small multiplier such as BBR_UNIT=1024) was used as the bandwidth valueThis causes the BDP (Bandwidth-Delay Product) to be computed with a wildly incorrect bandwidth value, resulting in a severely underestimated congestion window when using the BBR algorithm, which prevents BBR from achieving high throughput (as reported in #1032).
Note: this is an upstream FreeBSD bug present in all versions (releng/13.0 through releng/15.0 and main).
Fixes #1032