Wrong cwnd calculation in cubic when blackhole detection is on
hiren panchasara
hiren at strugglingcoder.info
Thu Sep 10 00:18:13 UTC 2015
When blackhole detection is turned on with FreeBSD 10.2, I see really
large (overflowed) values close to ulong max returning from cubic_cwnd()
in netinet/cc/cc_cubic.h
The culprit is this equation at the end of the function:
cwnd = ((cwnd * CUBIC_C_FACTOR * smss) >> CUBIC_SHIFT_4) + wmax;
wmax is the cwnd when we entered congestion. In case of blackhole
detection on, it can go down to 524. And when that happens, the equation
above returns -ve value. Now, right before returning from that function,
we cast it to ulong:
return ((unsigned long)cwnd);
That gives a really large value.
In one particular example, we enter the function with following values:
ticks:140 wmax=524 smss=524 K=430 and return with cwnd =
18446744073709551378.
I still need to read the cubic draft [1] and see how this is supposed to
work but if someone has any ideas, please let me know.
I've thought about setting cwnd to 0 when cwnd < 0 but that's not fair
and it'll hurt connection as it won't recover fast enough.
Cheers,
Hiren
[1] https://tools.ietf.org/html/draft-rhee-tcpm-cubic-02
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 603 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20150909/ee8d8d57/attachment.bin>
More information about the freebsd-net
mailing list