From nobody Mon Jan 13 18:15:21 2025 X-Original-To: dev-commits-src-all@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 4YX0mW2JT6z5kcZq; Mon, 13 Jan 2025 18:15:23 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YX0mV1jDyz3LHn; Mon, 13 Jan 2025 18:15:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736792122; 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=vtj6H/CGN56bg7efba1PJ01yM8nse4jpEAHR1jL94+Q=; b=DEcpeoSs2tOa/uZqVK326m2d9LJtHYAB3w1m/IcExRPywWa12RklKyizZ1Z7D2q10u+Zyo 72byfI6xzLg77HwMgR6J+5w1wlhnENgyfdbjOUb9uprX3+75080c73dyRSHJeSp0RZYXh8 /KVpQKpGN8KXFk1X9KxuJA2cm0HmBs0B7h5G2YkM1gDrjQmgLJy//QjCnDU0zFFf52dQhP Vnuzmy3zomMKAmIRbVmBkrMtynetgvQtwdX6GcZ4FivEPdSl8G4slvltIbI5YAGgxKml1P c8EX52nmDcGRVpoHTT0ZB8A8kOhCmBPIGaGQMAwGBq0X9q5S0hwY9QisapPmyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736792122; 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=vtj6H/CGN56bg7efba1PJ01yM8nse4jpEAHR1jL94+Q=; b=dtlmM9aHQtE5NC8bauSs0u8f/+Jg4vEsYewyUE66uoDHJMkT8n7Nqm+0JH1reYZQ5dJxrD NA7U1bFYmppz7dxDQYSrFV9GYOjHFdusqOGNDxxTOYL8GbptoKPr2Y36i/sPPuB86FbmlF I3fXJySRYu3OyRuuUzwJ8Qb4+4l4p05fB/X4CRTtvkEBxWKCvOBtBjm2z2JU/MIiOdszux Ih+wFzUqPZ+Y1cRN9Nd/gczvJQ0vjvt7oC9NsJZ3xFN58gFNAWIkpbfCy9l0TfW4tS/YAo zwKAUuRVTv6Td+DNJs2X2yWgNYZkQgRPsNJ7jHtTTfuhseU9oMzuMZlcaXKqFA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736792122; a=rsa-sha256; cv=none; b=WJHFQxqf6t/BZWQaKxJtV3u2q2Q4R8Tq6wbU2MKPb/AgrV4fYnKGYtHvE4bApLdIXxlefF pwBex00LaiO3O41H+uXrgR6/x5ze5+yJL81kS18VZux6gXhtqjnoaf8V5lBoI6Xeeu1g7l abbmaRE3I1xgXjdRvjIFUVeLOBVw3hWZZa1+QrGFiQZSxMFZCRkZ9pk8RhU+LXD/KlUrAE tpsg6BAk5dwoj6E4TE8t3lhm5OEI9yM39EEF/QIJcfOuiL/lKbKt6Q/ymiYX/sruiiLtPQ DTFr8LaZuqaJ3xQuxZ3Y+K1g6SlSRJUKDoYEm/3VO3aJ7HjvSdT2is6oBHg+8Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YX0mV0SfWzj26; Mon, 13 Jan 2025 18:15:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50DIFLqF008091; Mon, 13 Jan 2025 18:15:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50DIFLpj008089; Mon, 13 Jan 2025 18:15:21 GMT (envelope-from git) Date: Mon, 13 Jan 2025 18:15:21 GMT Message-Id: <202501131815.50DIFLpj008089@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: b84f41b4e82d - main - tcp: properly reset sackhint values when SACK recovery is done List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b84f41b4e82df373f8e682d45791b6ab636cd94e Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=b84f41b4e82df373f8e682d45791b6ab636cd94e commit b84f41b4e82df373f8e682d45791b6ab636cd94e Author: Gleb Smirnoff AuthorDate: 2025-01-13 18:13:45 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-13 18:13:45 +0000 tcp: properly reset sackhint values when SACK recovery is done When the SACK scoreboard collapses, properly clear all the counters. The counters are used in tcp_compute_pipe(), which can be called anytime later after the SACK recovery. The returned result can be totally bogus, including both too large and too small values. PR: 283649 Reviewed by: rscheff Differential Revision: https://reviews.freebsd.org/D48236 --- sys/netinet/tcp_sack.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index f642acd4c46a..90d789f0e224 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -653,8 +653,6 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack) * scoreboard). */ tp->snd_fack = SEQ_MAX(tp->snd_una, th_ack); - tp->sackhint.sacked_bytes = 0; /* reset */ - tp->sackhint.hole_bytes = 0; } /* * In the while-loop below, incoming SACK blocks (sack_blocks[]) and @@ -870,12 +868,26 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack) } } - KASSERT(!(TAILQ_EMPTY(&tp->snd_holes) && (tp->sackhint.hole_bytes != 0)), - ("SACK scoreboard empty, but accounting non-zero\n")); - + KASSERT(delivered_data >= 0, ("delivered_data < 0")); KASSERT(notlost_bytes <= tp->sackhint.hole_bytes, ("SACK: more bytes marked notlost than in scoreboard holes")); + if (TAILQ_EMPTY(&tp->snd_holes)) { + KASSERT(tp->sackhint.hole_bytes == 0, + ("SACK scoreboard empty, but accounting non-zero\n")); + tp->sackhint.sack_bytes_rexmit = 0; + tp->sackhint.sacked_bytes = 0; + tp->sackhint.lost_bytes = 0; + } else { + KASSERT(tp->sackhint.hole_bytes > 0, + ("SACK scoreboard not empty, but has no bytes\n")); + tp->sackhint.delivered_data = delivered_data; + tp->sackhint.sacked_bytes += delivered_data - left_edge_delta; + KASSERT((tp->sackhint.sacked_bytes >= 0), ("sacked_bytes < 0")); + tp->sackhint.lost_bytes = tp->sackhint.hole_bytes - + notlost_bytes; + } + if (!(to->to_flags & TOF_SACK)) /* * If this ACK did not contain any @@ -886,11 +898,6 @@ tcp_sack_doack(struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack) * for RFC6675 rescue retransmission. */ sack_changed = SACK_NOCHANGE; - tp->sackhint.delivered_data = delivered_data; - tp->sackhint.sacked_bytes += delivered_data - left_edge_delta; - tp->sackhint.lost_bytes = tp->sackhint.hole_bytes - notlost_bytes; - KASSERT((delivered_data >= 0), ("delivered_data < 0")); - KASSERT((tp->sackhint.sacked_bytes >= 0), ("sacked_bytes < 0")); return (sack_changed); }