Bug 127928

Summary: [tcp] [patch] TCP bandwidth gets squeezed every time tcp_xmit_bandwidth_limit() kicks in
Product: Base System Reporter: Renaud Lienhart <renaud>
Component: kernAssignee: Andre Oppermann <andre>
Status: Closed FIXED    
Severity: Affects Only Me CC: hiren
Priority: Normal Flags: bugmeister: mfc-stable10?
bugmeister: mfc-stable9?
bugmeister: mfc-stable8?
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Renaud Lienhart 2008-10-07 19:20:01 UTC
FreeBSD 6,7 & 8 have a bug in their tcp_xmit_bandwidth_limit() function.

The problem is that the bandwidth calculation is a 1/16th weigthed
average and that the saved bandwidth gets reset every time the RTT
threshold is crossed over.  This means that the bandwidth (and thus the
B-D product, and thus the sending window) is briefly squeezed whenever
the mechanism kicks in and it takes a bit of time to reach sane values again.

The threshold by default is 10ms.  With HZ=100, this means that a RTT of
0 tick disables the mechanism and a RTT of 1 tick activates it.  Because
of the poor tick granularity, the RTT is of 1 tick every 10ms and the
mechanism kicks in, brutally squeezing the sending window because
tp->snd_bandwidth is 0.  The problem also appears with HZ=1000, when
the RTT fluctuates in the bad spot of ~10ms.

Fix: To fix this, kickstart tp->snd_bandwidth without the weighted average
smoothing when it is 0.

Patch attached with submission follows:
How-To-Repeat: Run a kernel with HZ=100 (or HZ=1000 and a latency around ~10ms, which
is harder) and any TCP load with tcp_inflight_debug = 1.  Notice the
bandwidth reported by the log is inconsistent with the link capacity
and that the tp->snd_bwnd is incorrectly low.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2008-10-07 21:55:46 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-net

Over to maintainer(s).
Comment 2 Andre Oppermann freebsd_committer freebsd_triage 2010-08-10 23:25:14 UTC
Responsible Changed
From-To: freebsd-net->andre

Take over.
Comment 3 Andre Oppermann freebsd_committer freebsd_triage 2010-08-14 23:52:14 UTC
State Changed
From-To: open->patched

Inflight limiter disabled and scheduled for removal. 
See SNV r211315.
Comment 4 Hiren Panchasara freebsd_committer freebsd_triage 2016-02-12 19:56:39 UTC
I believe this is not a problem anymore. Reopen if it is.