The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=23c4f232478aa022cad45f2cde349ff56bb2a094
commit 23c4f232478aa022cad45f2cde349ff56bb2a094 Author: Richard Scheffenegger <rsch...@freebsd.org> AuthorDate: 2024-02-08 18:56:27 +0000 Commit: Richard Scheffenegger <rsch...@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;