Calculation of SendAllowance in BBR is Wrong
Describe the bug
In the BbrCongestionControlGetSendAllowance function,we expect a result in BYTES to indicate that how many bytes can be sent next time. And in this function, "SendAllowance = (uint32_t)(BandwidthEst * Bbr->PacingGain * TimeSinceLastSend / GAIN_UNIT);" is used to calculate the value of SendAllowance.
However, from the codes, we know that,BandwidthEst is in bps (bit per second), TimeSinceLastSend is in us(micro second),PacingGain/GAIN_UNIT will be 1 or 1.25 or 0.75,we can ignore its unit.
Obiviously, when pacing is executing, we cannot get a value in BYTES in this function, we have to use a formula "bit per micro sec * micro sec / 8" to get a value in bytes.
Affected OS
- [ ] Windows
- [ ] Linux
- [ ] macOS
- [ ] Other (specify below)
Additional OS information
No response
MsQuic version
main
Steps taken to reproduce bug
it can easily be seen in the codes. I found it in the following case.When I manually set the BandwidthEst to 6Gbps, i found that the actual throughput is too low and it is limited by the SendAllowance value. So I found that the SendAllowance calculation is wrong. this is because that 32-bit SendAllowance is not enough is this case (6G bps * 1 * several micro seconds), so when the 64-bit result is cut to 32-bit, the SendAllowacne result turns too small.
Expected behavior
a right value of SendAllowance
Actual outcome
a wrong value of SendAllowance
Additional details
No response
@anrossi Hi, May I ask if this is indeed a Bug?
It sounds like a bug from your description, but I haven't had time to dig in and investigate it further
Feel free to suggest a PR, @lrfeng1.
Copilot: elevate the type of SendAllowance to 64-bit