diff options
author | Gleb Smirnoff <glebius@FreeBSD.org> | 2025-01-13 18:13:54 +0000 |
---|---|---|
committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2025-01-13 18:13:54 +0000 |
commit | 1043b36b2054ffb32aadfe1c276684bf463db59a (patch) | |
tree | ca8c71e641782804aac35a3f28d2e304cb253dea | |
parent | b84f41b4e82df373f8e682d45791b6ab636cd94e (diff) |
tcp: don't send beyond receivers advertised window
When calculating length of data to be sent, we may do some congestion
calculations, but we shall never send a byte beyond (snd_una + snd_wnd).
In 7dc78150c730e we started to use tcp_compute_pipe() instead of (snd_wnd
- off). This function makes an estimate of how much data is in flight. It
can return a value smaller and larger than (snd_nxt - snd_una). It will
return a value larger when we have retransmitted some data from SACK
holes, and smaller once those retransmitted SACK holes are acked.
We may use tcp_compute_pipe() for length calculation, but always capped
by the send offset 'off', which (snd_nxt - snd_una).
PR: 283649
Reviewed by: rscheff
Differential Revision: https://reviews.freebsd.org/D48237
Fixes: 7dc78150c730e90fa2afdaba3aa645932b30c429
-rw-r--r-- | sys/netinet/tcp_output.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 74a229012508..135e7d8493e2 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -421,8 +421,9 @@ after_sack_rexmit: * sending new data, having retransmitted all the * data possible in the scoreboard. */ - len = imin(sbavail(&so->so_snd) - off, - sendwin - tcp_compute_pipe(tp)); + len = imax( + imin(sbavail(&so->so_snd), sendwin) - + imax(tcp_compute_pipe(tp), off), 0); } } |