[Cake] Long-RTT broken again
Jonathan Morton
chromatix99 at gmail.com
Sat Nov 7 05:51:23 EST 2015
Okay, I’ve tracked down the problem. Turns out to be one of C’s more subtle misfeatures.
I calculate the desired buffer size as rate * interval * 4. Since interval is in µs, rate * interval is a 64-bit temporary. However, I forgot to cast either of these operands to the new width first, so the upper half of the product was never calculated. After dividing by 250000, the resulting buffer size was 8918 bytes - which was clamped up to 64KB by a sanity check immediately afterwards.
It’s thus remarkable that we got as much throughput as we did.
While fixing this, I’m also adding configurability of the buffer limit and statistics of how much of the buffer was actually ever used. Additionally, I’m choosing a saner default for “unlimited” mode.
- Jonathan Morton
More information about the Cake
mailing list