Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Feb 2024 19:41:25 GMT
From:      Richard Scheffenegger <rscheff@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 23c4f232478a - main - tcp: ensure tcp_sack_partialack does not inflate cwnd after RTO
Message-ID:  <202402081941.418JfPkt036901@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by rscheff:

URL: https://cgit.FreeBSD.org/src/commit/?id=23c4f232478aa022cad45f2cde349ff56bb2a094

commit 23c4f232478aa022cad45f2cde349ff56bb2a094
Author:     Richard Scheffenegger <rscheff@FreeBSD.org>
AuthorDate: 2024-02-08 18:56:27 +0000
Commit:     Richard Scheffenegger <rscheff@FreeBSD.org>
CommitDate: 2024-02-08 19:40:25 +0000

    tcp: ensure tcp_sack_partialack does not inflate cwnd after RTO
    
    The implicit assumption of snd_nxt always being larger than
    snd_recover is not true after RTO. In that case, cwnd
    would get inflated to ssthresh, which may be much larger
    than the current pipe (data in flight).
    
    Reviewed By:           tuexen, #transport
    Sponsored by:          NetApp, Inc.
    Differential Revision: https://reviews.freebsd.org/D43653
---
 sys/netinet/tcp_sack.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c
index 0c557dc4579d..f59cc5fe0d0b 100644
--- a/sys/netinet/tcp_sack.c
+++ b/sys/netinet/tcp_sack.c
@@ -953,8 +953,17 @@ tcp_sack_partialack(struct tcpcb *tp, struct tcphdr *th, u_int *maxsegp)
 	/* Send one or 2 segments based on how much new data was acked. */
 	if ((BYTES_THIS_ACK(tp, th) / maxseg) >= 2)
 		num_segs = 2;
-	tp->snd_cwnd = (tp->sackhint.sack_bytes_rexmit +
-	    (tp->snd_nxt - tp->snd_recover) + num_segs * maxseg);
+	if (V_tcp_do_newsack) {
+		tp->snd_cwnd = imax(tp->snd_nxt - th->th_ack +
+				tp->sackhint.sack_bytes_rexmit -
+				tp->sackhint.sacked_bytes -
+				tp->sackhint.lost_bytes, maxseg) +
+				num_segs * maxseg;
+	} else {
+		tp->snd_cwnd = (tp->sackhint.sack_bytes_rexmit +
+		    imax(0, tp->snd_nxt - tp->snd_recover) +
+		    num_segs * maxseg);
+	}
 	if (tp->snd_cwnd > tp->snd_ssthresh)
 		tp->snd_cwnd = tp->snd_ssthresh;
 	tp->t_flags |= TF_ACKNOW;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202402081941.418JfPkt036901>