aboutgitcodebugslistschat
path: root/test/tcp
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2026-01-09 13:52:00 +0100
committerStefano Brivio <sbrivio@redhat.com>2026-01-14 01:07:51 +0100
commit2be0e790804f99580b1c8a1781c49913440607f2 (patch)
treef1d23fe253c8bb67e6630dcae15f5c4358a594b9 /test/tcp
parentb973f4a6cc50571f8375c60a7e511a77bcf5c202 (diff)
downloadpasst-2be0e790804f99580b1c8a1781c49913440607f2.tar
passt-2be0e790804f99580b1c8a1781c49913440607f2.tar.gz
passt-2be0e790804f99580b1c8a1781c49913440607f2.tar.bz2
passt-2be0e790804f99580b1c8a1781c49913440607f2.tar.lz
passt-2be0e790804f99580b1c8a1781c49913440607f2.tar.xz
passt-2be0e790804f99580b1c8a1781c49913440607f2.tar.zst
passt-2be0e790804f99580b1c8a1781c49913440607f2.zip
tcp: Fix rounding issue in check for approximating window to zero
In general, we approximate the advertised window to zero if we would otherwise advertise less than a MSS worth, and the reasoning behind that is explained in cf1925fb7b77 ("tcp: Don't limit window to less-than-MSS values, use zero instead"). Then, in commit b40f5cd8c8e1 ("tcp: Use less-than-MSS window on no queued data, or no data sent recently"), I introduced some conditions under which we won't do that, including a check on whether any data was sent recently. As an arbitrary but probably reasonable threshold, we consider data to have recently been sent if that occurred less than ten times the round-trip time (RTT) ago. The time elapsed since the last data transmission is reported by the kernel in milliseconds, in the tcpi_last_data_sent field of struct tcp_info, and the RTT is reported in microseconds instead, in tcpi_rtt. To avoid the risk of overflow in a simple way, for the purpose of this comparison, I converted tcpi_rtt to milliseconds first, but this means that the check will always be false (and we'll never approximate the window to zero) if the RTT is below one millisecond. This, in turn, reintroduces nasty delay issues in transfers in non-local connections which have however almost-local (low) latency. Given that we want to use ten times the RTT as an arbitrary "long enough" upper bound, round the RTT up while converting it to milliseconds. As an alternative, we could perform the comparison in microseconds, but we would need a slightly more complicated implementation to exclude overflows, and it's definitely not worth it given the nature of this threshold. Fixes: b40f5cd8c8e1 ("tcp: Use less-than-MSS window on no queued data, or no data sent recently") Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'test/tcp')
0 files changed, 0 insertions, 0 deletions