From nobody Fri Feb 28 20:55:16 2025 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 4Z4L7m32Vrz5p6K6; Fri, 28 Feb 2025 20:55:16 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Z4L7m2LRcz3kjq; Fri, 28 Feb 2025 20:55:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740776116; 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=jT20TBx7XZOb+11N8AXIKOTqGIcHkNfZ+YMpspta+Pc=; b=OlTZSKopedAbVoonh8GUyxrHKPfP14lu6NnJrLlQDmOZp8kTtdjShTJovDzwTu40li0HrZ G28bAX2jiMbe7Zqp8Bj/nLReV3NQPh8qWEZz8wTikZh0n5cK/pQhx8zVoj0RuunT+njLSo 07j5IdbMSdATGGTFCEqx5bd7fMkiZVErSTV9A76htfpft+/32ANDbVCPcIZ1Kyc9MczSsX XGkErR/aY/0Rx9EMEznC87zIDKB4jlhSBmFV9zXGiKnLE3HSgf4eY0YHdptbTS1NU8N3NT MFpI6V2VHuVP8fmvbdU14k9CVe9RFv3YaWXQbLOXtLR2Egd/6aAzyvHdKhLBFg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1740776116; a=rsa-sha256; cv=none; b=WumGLJefqaC5Z5la3r44oxM2AiqpEut2zFt56RmU7S3m765KkFbPG+pp/eBQsOMifn8P7e gQVSdN/Dh5Z/EeRbWQITAwf9b9Ugnvzs0nKdAfPRQx/Z9zABcF0rVw0738V9Y6siLWUAyk 0UGpw236348amxW4Oo9FQ6Fo9W9rYLHsv9pEj5L1xHlh6PX/Sbnw5tKARYHu2QHxc6vzHQ wTWhUyBeu+Vx98O2xlouK7CMTyObHdlxuD22CIpT9cV/CPtYg1XJg9F6IzwiQEYVYwH6nx reI2mxfYbHHxKx/bGuoIlXrkid2os7oA5GhkFDhO2wat6oE3XdLYpv8Xo1x3vQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1740776116; 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=jT20TBx7XZOb+11N8AXIKOTqGIcHkNfZ+YMpspta+Pc=; b=mU5WV6pJDe7XfmW39HQruaMpYxhDIOoKDpH3tShXBF+f2xlhawuYJrqWVPaSmPRO9ayl0S ehgzkhZZ0ijJINnemsgCdvvtNbXqV50X08wvtKVYCaiXrriHfCzd8T93wkQkoQka+FXzBa H8KMAVbrBxXwlWcIXRxbQsMWpI1tdG2bHi0rH5/E7dko1Bg80whvtzdfeXGVyCW5ywqWuk zBv2Op4nUBEH7HRsamjSJQEI6OOutAIYeqEL0Rls2y8x9ohZsFOtoj0Vj/1/bDOwVRKbag pWC7QAIBdp5Y8KRBy/5FhwpAhiv7v/ifmKCghdkBxcE1rajsurqpkHuXpkXOZA== 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 4Z4L7m1HQRzlC2; Fri, 28 Feb 2025 20:55:16 +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 51SKtGfX061191; Fri, 28 Feb 2025 20:55:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 51SKtGiE061188; Fri, 28 Feb 2025 20:55:16 GMT (envelope-from git) Date: Fri, 28 Feb 2025 20:55:16 GMT Message-Id: <202502282055.51SKtGiE061188@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cheng Cui Subject: git: 67787d200488 - main - tcp: make inflight data (pipe) calculation consistent 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cc X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 67787d200488f0d838b20b0f483d1ca08ff6c014 Auto-Submitted: auto-generated The branch main has been updated by cc: URL: https://cgit.FreeBSD.org/src/commit/?id=67787d200488f0d838b20b0f483d1ca08ff6c014 commit 67787d200488f0d838b20b0f483d1ca08ff6c014 Author: Cheng Cui AuthorDate: 2025-02-21 20:53:06 +0000 Commit: Cheng Cui CommitDate: 2025-02-28 20:53:12 +0000 tcp: make inflight data (pipe) calculation consistent Reviewed by: glebius, rrs, tuexen Differential Revision: https://reviews.freebsd.org/D49047 --- sys/netinet/cc/cc.c | 8 +------- sys/netinet/cc/cc_cubic.c | 8 +------- sys/netinet/cc/cc_dctcp.c | 8 +------- sys/netinet/cc/cc_htcp.c | 8 +------- sys/netinet/cc/cc_newreno.c | 8 +------- sys/netinet/tcp_input.c | 26 +++++++++++--------------- 6 files changed, 16 insertions(+), 50 deletions(-) diff --git a/sys/netinet/cc/cc.c b/sys/netinet/cc/cc.c index eae5b7bca4d9..a34eefcf0066 100644 --- a/sys/netinet/cc/cc.c +++ b/sys/netinet/cc/cc.c @@ -500,13 +500,7 @@ newreno_cc_cong_signal(struct cc_var *ccv, ccsignal_t type) break; case CC_RTO: if (CCV(ccv, t_rxtshift) == 1) { - if (V_tcp_do_newsack) { - pipe = tcp_compute_pipe(ccv->tp); - } else { - pipe = CCV(ccv, snd_max) - - CCV(ccv, snd_fack) + - CCV(ccv, sackhint.sack_bytes_rexmit); - } + pipe = tcp_compute_pipe(ccv->tp); CCV(ccv, snd_ssthresh) = max(2, min(CCV(ccv, snd_wnd), pipe) / 2 / mss) * mss; } diff --git a/sys/netinet/cc/cc_cubic.c b/sys/netinet/cc/cc_cubic.c index 91d6642eb08d..82b0d9b7fa99 100644 --- a/sys/netinet/cc/cc_cubic.c +++ b/sys/netinet/cc/cc_cubic.c @@ -470,13 +470,7 @@ cubic_cong_signal(struct cc_var *ccv, ccsignal_t type) cubic_data->undo_cwnd_epoch = cubic_data->cwnd_epoch; cubic_data->undo_W_max = cubic_data->W_max; cubic_data->undo_K = cubic_data->K; - if (V_tcp_do_newsack) { - pipe = tcp_compute_pipe(ccv->tp); - } else { - pipe = CCV(ccv, snd_max) - - CCV(ccv, snd_fack) + - CCV(ccv, sackhint.sack_bytes_rexmit); - } + pipe = tcp_compute_pipe(ccv->tp); CCV(ccv, snd_ssthresh) = max(2, (((uint64_t)min(CCV(ccv, snd_wnd), pipe) * CUBIC_BETA) >> CUBIC_SHIFT) / mss) * mss; diff --git a/sys/netinet/cc/cc_dctcp.c b/sys/netinet/cc/cc_dctcp.c index f43efe0e27c7..757bc005edb4 100644 --- a/sys/netinet/cc/cc_dctcp.c +++ b/sys/netinet/cc/cc_dctcp.c @@ -294,13 +294,7 @@ dctcp_cong_signal(struct cc_var *ccv, ccsignal_t type) break; case CC_RTO: if (CCV(ccv, t_rxtshift) == 1) { - if (V_tcp_do_newsack) { - pipe = tcp_compute_pipe(ccv->tp); - } else { - pipe = CCV(ccv, snd_max) - - CCV(ccv, snd_fack) + - CCV(ccv, sackhint.sack_bytes_rexmit); - } + pipe = tcp_compute_pipe(ccv->tp); CCV(ccv, snd_ssthresh) = max(2, min(CCV(ccv, snd_wnd), pipe) / 2 / mss) * mss; } diff --git a/sys/netinet/cc/cc_htcp.c b/sys/netinet/cc/cc_htcp.c index 13441bb49190..ab6165f2e720 100644 --- a/sys/netinet/cc/cc_htcp.c +++ b/sys/netinet/cc/cc_htcp.c @@ -325,13 +325,7 @@ htcp_cong_signal(struct cc_var *ccv, ccsignal_t type) case CC_RTO: if (CCV(ccv, t_rxtshift) == 1) { - if (V_tcp_do_newsack) { - pipe = tcp_compute_pipe(ccv->tp); - } else { - pipe = CCV(ccv, snd_max) - - CCV(ccv, snd_fack) + - CCV(ccv, sackhint.sack_bytes_rexmit); - } + pipe = tcp_compute_pipe(ccv->tp); CCV(ccv, snd_ssthresh) = max(2, min(CCV(ccv, snd_wnd), pipe) / 2 / mss) * mss; } diff --git a/sys/netinet/cc/cc_newreno.c b/sys/netinet/cc/cc_newreno.c index d7172fa78bc4..de7b878152b0 100644 --- a/sys/netinet/cc/cc_newreno.c +++ b/sys/netinet/cc/cc_newreno.c @@ -428,13 +428,7 @@ newreno_cong_signal(struct cc_var *ccv, ccsignal_t type) break; case CC_RTO: if (CCV(ccv, t_rxtshift) == 1) { - if (V_tcp_do_newsack) { - pipe = tcp_compute_pipe(ccv->tp); - } else { - pipe = CCV(ccv, snd_max) - - CCV(ccv, snd_fack) + - CCV(ccv, sackhint.sack_bytes_rexmit); - } + pipe = tcp_compute_pipe(ccv->tp); CCV(ccv, snd_ssthresh) = max(2, ((uint64_t)min(CCV(ccv, snd_wnd), pipe) * (uint64_t)factor) / diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index e21043fac0cf..cf480ccf9772 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -2660,12 +2660,7 @@ tcp_do_segment(struct tcpcb *tp, struct mbuf *m, struct tcphdr *th, * we have less than ssthresh * worth of data in flight. */ - if (V_tcp_do_newsack) { - awnd = tcp_compute_pipe(tp); - } else { - awnd = (tp->snd_nxt - tp->snd_fack) + - tp->sackhint.sack_bytes_rexmit; - } + awnd = tcp_compute_pipe(tp); if (awnd < tp->snd_ssthresh) { tp->snd_cwnd += imax(maxseg, imin(2 * maxseg, @@ -4098,11 +4093,7 @@ tcp_do_prr_ack(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to, (IN_CONGRECOVERY(tp->t_flags) && !IN_FASTRECOVERY(tp->t_flags))) { del_data = tp->sackhint.delivered_data; - if (V_tcp_do_newsack) - pipe = tcp_compute_pipe(tp); - else - pipe = (tp->snd_nxt - tp->snd_fack) + - tp->sackhint.sack_bytes_rexmit; + pipe = tcp_compute_pipe(tp); } else { if (tp->sackhint.prr_delivered < (tcprexmtthresh * maxseg + tp->snd_recover - tp->snd_una)) { @@ -4206,14 +4197,19 @@ tcp_newreno_partial_ack(struct tcpcb *tp, struct tcphdr *th) int tcp_compute_pipe(struct tcpcb *tp) { - if (tp->t_fb->tfb_compute_pipe == NULL) { - return (tp->snd_max - tp->snd_una + + int pipe; + + if (tp->t_fb->tfb_compute_pipe != NULL) { + pipe = (*tp->t_fb->tfb_compute_pipe)(tp); + } else if (V_tcp_do_newsack) { + pipe = tp->snd_max - tp->snd_una + tp->sackhint.sack_bytes_rexmit - tp->sackhint.sacked_bytes - - tp->sackhint.lost_bytes); + tp->sackhint.lost_bytes; } else { - return((*tp->t_fb->tfb_compute_pipe)(tp)); + pipe = tp->snd_nxt - tp->snd_fack + tp->sackhint.sack_bytes_rexmit; } + return (imax(pipe, 0)); } uint32_t