From nobody Sat Jan 06 19:44:06 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4T6rP31XQKz572p8; Sat, 6 Jan 2024 19:44:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T6rP30BBYz42CR; Sat, 6 Jan 2024 19:44:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704570247; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m8gu6L29eKQ+NHLO+ceFcz5iY3qIoehtJWZGu/egChY=; b=bPHZxuPZh5uuZG/6fBG4njltK4pSOf1pdIoIFJmJ3DDc6o179bsmALq3SJ5c9efK9jgsH3 Rl6AmLXh4cSLDmeBiKKnoMLHuEaBbxM8ckYg2m5l/KIGk7quAuDunda95KG1ISekh/vh3E iEweCQPV1lAZrxpCxzv8kj13gG3IIUV53ghxBp3RF8lhC24fCYB166Mv4pIVKx7nOD8Nla j8oUena79qcQ90A11rkCcvYkLBWTTHket4cTEuNeALFL4o9kfm9zJefw0HKlVxFjpe2gnk o9dtmV/t6uZqo1M3Lm6D3ZVTTkbtq4R3z4Fvh5z+ye7WczOUIuC10esZh9ehHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704570247; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m8gu6L29eKQ+NHLO+ceFcz5iY3qIoehtJWZGu/egChY=; b=EYVF4ejv9LWUpxWsmSKU+Dtt1qS+m13zoMHhqd6zrZbGrwqond+HbiW4u0fcDUYKIlbssT euuAhyKqFlN1nVs83hYv1ESlVj7sIr+h611WIGSFb/1J6HUaDMMvDcPPU9MTfWonSYOp6X a5GUedjZa6sv/Kx2DuDzfa3M5rtNMtvLjsD5JeIHwmPAGcy5STCQL66kErRJrw+NCuHSgV jINMZHhHYgX7+OVbhI6X4sQvM84PJuj98YMYVkDOQUPOST93DENBg3ix54TCB/oSCCkqiu MqUVZI/x61lC3tplAYt7lALKVz+4Wjll+/QzX31F/IFbkg6kivbd8aVX0YHfbQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704570247; a=rsa-sha256; cv=none; b=jeb0zSSUqLNqCfYImKFKgiFtCPJz40DJ4zLyY9DlEn9Aa01gAKjhF4pGywHcH4ShOWGpKH nqAFk9okvW/SymFMgRl4uc1sV5+UlmQZYh0L9UJbRbRTvmss4CNTFzDdqjrbWccXzpZ4K4 uFohM1xFv71QLlsCeDf3Ggu+IIdR5NhW9nvxvAhB0jCmG4c2mDGGG3Hqqzx0U+z4kwY/Ob gbUyDmgVSub6HP+Hc+gyDaaae+aJE5R4ybY0TD4+MgclOj4ZG5twMcApwBPhI1Xiy2BsgK w5GsZc+8PYefGfBKxhufWL/ATTRl5jfwhAH++WSc9fHQi53iH0SUrGpnKXxx8g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T6rP26MT2zvBJ; Sat, 6 Jan 2024 19:44:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 406Ji6cf098444; Sat, 6 Jan 2024 19:44:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 406Ji6wO098441; Sat, 6 Jan 2024 19:44:06 GMT (envelope-from git) Date: Sat, 6 Jan 2024 19:44:06 GMT Message-Id: <202401061944.406Ji6wO098441@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: 30409ecdb648 - main - tcp: do not purge SACK scoreboard on first RTO List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 30409ecdb648901223f4e02e4a575d79c447acab Auto-Submitted: auto-generated The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=30409ecdb648901223f4e02e4a575d79c447acab commit 30409ecdb648901223f4e02e4a575d79c447acab Author: Richard Scheffenegger AuthorDate: 2024-01-06 19:25:17 +0000 Commit: Richard Scheffenegger CommitDate: 2024-01-06 19:25:38 +0000 tcp: do not purge SACK scoreboard on first RTO Keeping the SACK scoreboard intact after the first RTO and retransmitting all data anew only on subsequent RTOs allows a more timely and efficient loss recovery under many adverse cirumstances. Reviewed By: tuexen, #transport MFC after: 10 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D42906 --- sys/netinet/tcp_input.c | 5 ++++- sys/netinet/tcp_sack.c | 19 +++++++++++++++++++ sys/netinet/tcp_timer.c | 6 ++++-- sys/netinet/tcp_var.h | 1 + 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 1d6430f6ef20..4a6100fc969b 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -439,7 +439,10 @@ cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type) case CC_RTO: tp->t_dupacks = 0; tp->t_bytes_acked = 0; - EXIT_RECOVERY(tp->t_flags); + if ((tp->t_rxtshift > 1) || + !((tp->t_flags & TF_SACK_PERMIT) && + (!TAILQ_EMPTY(&tp->snd_holes)))) + EXIT_RECOVERY(tp->t_flags); if (tp->t_flags2 & TF2_ECN_PERMIT) tp->t_flags2 |= TF2_ECN_SND_CWR; break; diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index e8ed3c52fd67..48efe855f689 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -908,6 +908,25 @@ tcp_free_sackholes(struct tcpcb *tp) ("tp->sackhint.nexthole == NULL")); } +/* + * Resend all the currently existing SACK holes of + * the scoreboard. This is in line with the Errata to + * RFC 2018, which allows the use of SACK data past + * an RTO to good effect typically. + */ +void +tcp_resend_sackholes(struct tcpcb *tp) +{ + struct sackhole *p; + + INP_WLOCK_ASSERT(tptoinpcb(tp)); + TAILQ_FOREACH(p, &tp->snd_holes, scblink) { + p->rxmit = p->start; + } + tp->sackhint.nexthole = TAILQ_FIRST(&tp->snd_holes); + tp->sackhint.sack_bytes_rexmit = 0; +} + /* * Partial ack handling within a sack recovery episode. Keeping this very * simple for now. When a partial ack is received, force snd_cwnd to a value diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index 952fa53e0275..125e28134c01 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -559,7 +559,6 @@ tcp_timer_rexmt(struct tcpcb *tp) TCP_PROBE2(debug__user, tp, PRU_SLOWTIMO); CURVNET_SET(inp->inp_vnet); - tcp_free_sackholes(tp); if (tp->t_fb->tfb_tcp_rexmit_tmr) { /* The stack has a timer action too. */ (*tp->t_fb->tfb_tcp_rexmit_tmr)(tp); @@ -619,8 +618,11 @@ tcp_timer_rexmt(struct tcpcb *tp) * the retransmitted packet's to_tsval to by tcp_output */ tp->t_flags |= TF_PREVVALID; - } else + tcp_resend_sackholes(tp); + } else { tp->t_flags &= ~TF_PREVVALID; + tcp_free_sackholes(tp); + } TCPSTAT_INC(tcps_rexmttimeo); if ((tp->t_state == TCPS_SYN_SENT) || (tp->t_state == TCPS_SYN_RECEIVED)) diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index c2b15526c15b..5f064ead7f64 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1499,6 +1499,7 @@ struct sackhole *tcp_sack_output(struct tcpcb *tp, int *sack_bytes_rexmt); void tcp_do_prr_ack(struct tcpcb *, struct tcphdr *, struct tcpopt *, sackstatus_t); void tcp_lost_retransmission(struct tcpcb *, struct tcphdr *); void tcp_sack_partialack(struct tcpcb *, struct tcphdr *); +void tcp_resend_sackholes(struct tcpcb *tp); void tcp_free_sackholes(struct tcpcb *tp); void tcp_sack_lost_retransmission(struct tcpcb *, struct tcphdr *); int tcp_newreno(struct tcpcb *, struct tcphdr *);