git: 1043b36b2054 - main - tcp: don't send beyond receivers advertised window
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 13 Jan 2025 18:15:23 UTC
The branch main has been updated by glebius:
URL: https://cgit.FreeBSD.org/src/commit/?id=1043b36b2054ffb32aadfe1c276684bf463db59a
commit 1043b36b2054ffb32aadfe1c276684bf463db59a
Author: Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2025-01-13 18:13:54 +0000
Commit: Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2025-01-13 18:13:54 +0000
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
---
sys/netinet/tcp_output.c | 5 +++--
1 file 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);
}
}