Article View: linux.kernel.netdev
Article #19322Re: [PATCH net-next v4 3/4] tcp: add TCP_ECN_SEND_ECT_1 flag for congestion control
From: Eric Dumazet
Date: Thu, 19 Nov 2026 18:48
Date: Thu, 19 Nov 2026 18:48
113 lines
13438 bytes
13438 bytes
Le jeu. 19 nov. 2026 ร 19:01, <chia-yu.chang@nokia-bell-labs.com> a รฉcrit :
>
> From: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
>
> This patch introduces the new TCP_ECN_SEND_ECT_1 bit, which enables
> a congestion control module to control whether the connection
> transmits using ECT(1) (if the bit is set) or ECT(0) (otherwise),
> when congestion control is initialized after ECN negotiation.
>
> A congestion control module, such as the upcoming TCP Prague
> using L4S ECN, can set this new TCP_ECN_SEND_ECT_1 bit if it
> wants to send the ECT(1) code point in outgoing IP headers.
>
> Signed-off-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
>
> --
> v3:
> - Update commit message
> - Update flag name and helper function name to eliminate confusion
> ---
> include/net/tcp.h | 1 +
> include/net/tcp_ecn.h | 6 ++++++
> net/ipv4/tcp_cong.c | 4 +++-
> net/ipv4/tcp_output.c | 2 +-
> 4 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/include/net/tcp.h b/include/net/tcp.h
> index 4b1159e6c125..0242fd6bbb07 100644
> --- a/include/net/tcp.h
> +++ b/include/net/tcp.h
> @@ -428,6 +428,7 @@ static inline void tcp_dec_quickack_mode(struct sock *sk)
> #define TCP_ECN_DEMAND_CWR BIT(2)
> #define TCP_ECN_SEEN BIT(3)
> #define TCP_ECN_MODE_ACCECN BIT(4)
> +#define TCP_ECN_SEND_ECT_1 BIT(5)
Who clears this bit ?
The only place where tp->ecn_flags is reset is tcp_ecn_send_syn().
If a module sets the bit, and the user later switches to another
congestion control with setsockopt(TCP_CONGESTION) on an AccECN
flow, tcp_ecn_send() will keep sending ECT(1) on every packet,
with a classic congestion response.
I do not think we should rely on each module ->release() to
clear it. tcp_reinit_congestion_control() should do it.
>
> #define TCP_ECN_DISABLED 0
> #define TCP_ECN_MODE_PENDING (TCP_ECN_MODE_RFC3168 | TCP_ECN_MODE_ACCECN)
> diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h
> index 9ca016d98972..ff402cdb988d 100644
> --- a/include/net/tcp_ecn.h
> +++ b/include/net/tcp_ecn.h
> @@ -38,6 +38,12 @@ static inline void INET_ECN_xmit_negotiation_ect(struct sock *sk)
> __INET_ECN_xmit(sk, tcp_ca_ect_1_negotiation(sk));
> }
>
> +/* Apply either ECT(0) or ECT(1) based on TCP_ECN_SEND_ECT_1 flag */
> +static inline void INET_ECN_xmit_established_ect(struct sock *sk)
> +{
> + __INET_ECN_xmit(sk, tcp_sk(sk)->ecn_flags & TCP_ECN_SEND_ECT_1);
> +}
> +
> static inline void tcp_ecn_queue_cwr(struct tcp_sock *tp)
> {
> /* Do not set CWR if in AccECN mode! */
> diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
> index 3331679c81d7..43b0634f7673 100644
> --- a/net/ipv4/tcp_cong.c
> +++ b/net/ipv4/tcp_cong.c
> @@ -240,7 +240,9 @@ void tcp_init_congestion_control(struct sock *sk)
> tcp_sk(sk)->prior_ssthresh = 0;
> if (icsk->icsk_ca_ops->init)
> icsk->icsk_ca_ops->init(sk);
> - if (tcp_ca_needs_ecn(sk))
> + if (tcp_ca_needs_accecn(sk))
> + INET_ECN_xmit_established_ect(sk);
> + else if (tcp_ca_needs_ecn(sk))
> INET_ECN_xmit(sk);
This only looks at the module flag, not at what was negotiated.
If AccECN negotiation failed (RFC 3168 fallback, or no ECN at all),
we still set ECT(0)/ECT(1) here. Is the module expected to handle
all the fallbacks from its ->init(), like DCTCP does ? If so,
please add a comment, and say it in the changelog.
> else
> INET_ECN_dontxmit(sk);
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index 08d0d4a639fe..7b694479095e 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -350,7 +350,7 @@ static void tcp_ecn_send(struct sock *sk, struct sk_buff *skb,
> if (tcp_ecn_mode_accecn(tp)) {
> if (!tcp_accecn_ace_fail_recv(tp) &&
> !tcp_accecn_ace_fail_send(tp))
> - INET_ECN_xmit(sk);
> + INET_ECN_xmit_established_ect(sk);
> else
> INET_ECN_dontxmit(sk);
> tcp_accecn_set_ace(tp, skb, th);
> --
> 2.34.1
>
Technical Details
Message-ID:
<CAL4WiirxeYg37=0U0T+9jWttebQbrsTbK9GRNed0tUCw5w11sA@mail.gmail.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367254-linux-kernel-netdev=dewy.ruReferences:
<20261119180143.2912138-1-chia-yu.chang@nokia-bell-labs.com> <20261119180143.2912138-4-chia-yu.chang@nokia-bell-labs.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367254-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v4 3/4] tcp: add TCP_ECN_SEND_ECT_1 flag for
congestion control
Date: Thu, 19 Nov 2026 19:48:01 +0100
Organization: Usenet Network
Message-ID: <CAL4WiirxeYg37=0U0T+9jWttebQbrsTbK9GRNed0tUCw5w11sA@mail.gmail.com>
References: <20261119180143.2912138-1-chia-yu.chang@nokia-bell-labs.com> <20261119180143.2912138-4-chia-yu.chang@nokia-bell-labs.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
logging-data="2955135"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:CrDZIVZjX0Xa8GzSubvjLQGPGlw= sha256:HMLjxY8i9k/qNArZ9Mt5uZ59daT9hKuslVI7Or9sq6A=
sha1:6HeGGv1Vl6r9bAizmlua7Nr9cSA= sha256:MdsOX1B3goVXTDwHzli1OrEzn6Tpe7xPFGzkvcROd4o=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 6020711573F; Thu, 19 Nov 2026 21:48:32 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id ZvLc4aLUwx8q;
Thu, 19 Nov 2026 21:48:29 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-367254-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 2FB2211573C; Thu, 19 Nov 2026 21:48:21 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id C879C287FE1; Thu, 19 Nov 2026 18:48:19 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1795114098;
b=fLe6NpiG9tzI3uSEcTgelNnxW9eWy74HW1EMjIwh998HAolIBj3Wt6N6/MBvIdxTctFF
yaZHnVLOr4lydjcst2WX8/6MXN74D7Z+mOm43Tn3W8MVuIVy9Tr9laRtreFjHUKxcjXOa
zpFIfpILxB7dVdFIbyidC+8zpPYzHUBZwLZ5LSzT+KfvX9HmtW8dRAebcT/nyZ29tB7dd
is5zv3NTJLfqXalPeBTb8FeygB25ArcqNT3gMuOSnI2BuOtSpx4wLFZr4n+jH9Q7Wqaw/
q/KsxJqwKZsp+Lr7DYxN63fr9B+5bwryNyLigba+mDOTDtqoSxhKEctmg17VhqBMB4g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795114098;
h=X-Original-To:Received:Received:DKIM-Signature:Received:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:X-Mailing-List:
List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
List-Owner:Precedence:MIME-Version:References:In-Reply-To:From:Date:
X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
Content-Type:Content-Transfer-Encoding;
bh=5zHGL+QsjNpZ6g1gAKY/0i6WN3IS52QSM0gJbOkQs1I=;
b=jz00aBSrfwFTiM5RrYmfowpbcg+a9xwAMa368WSpWOxVxrvdYpJUF4CJFhN761zG1+fB
VVFMJfW4tEMcBoTLZSXxVya5ayzEahhhEtQN1eRLoU2NVxE1YMHCXq9dXq3uw4d7bq/WU
SAjr1HxYalcxWht5eXn1GN0HwQ5kYhu5dOdgqMNLsF6PGus8YdlSS2CGihtmHiy4ASXw1
0YRqqJFI277mL7cebDDgi8NNU+QbwOZOTYyiEoxf48f8uqCQ+W+6LYWqw5+GlCtB80Rls
6b4+dAu5l8v+UMhJnV35UQn0pAaQ5AGzbq5JzN5Ln3WbG4yYTa+MpOONWYHUjCclOVA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DlZB6iaf;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id CB963606A320;
Thu, 19 Nov 2026 18:48:18 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DlZB6iaf
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1795114093;
b=iI73BDELLfshfWVaoKKkEGRt1yVho3Zz+yBjyq4EUZbGvzY1/5oXhia/Qlno/V1I9fJe
vpuQ8fLegfZKRG1G+wLI//5QHjFCzaOZzGbE45mRZa27718Pe4fyUAxoegg8B4Ag7gdu5
BPyU8GhjIMLzNzN8/kDJ8GhJfKiGYL5TV4LELEFfXbvvDOLEc+ZHZzduLpCdwVuHsgDbk
ZNprele0PSBhn14x8Ci0TYB1UBmE3LLwBEpzs/ir/vyBz9tFN9g+g/RqcDfvpu+pa6rHw
ObxhN3sjz9kvYs5eo5b0jwLw2JrwGL+TfeIKE22XvR+jEMfwu+yzS1sN4auAXppWQWw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795114093;
h=Received:DKIM-Signature:Received:X-Forwarded-Encrypted:
X-Gm-Message-State:X-Received:MIME-Version:References:In-Reply-To:
From:Date:X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:
Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
bh=5zHGL+QsjNpZ6g1gAKY/0i6WN3IS52QSM0gJbOkQs1I=;
b=IUZggNIMXOvgtWWX6I0PzwkXYPxJKDPd9QacT+usO3/DhWxkpUnp+ZwfeRS5lSH5/KpR
jfvXn8OrNk51WtlNgFELfXZQOQ3TNeAk14pHlcha/tEIlLLGBTDtXUiat2AF2Mf5ZFFBQ
TBbTRNLpCstT03BsUjZSEyw3FerC9knebB3Nga4uX2X1Yq5FFeXSCMSngrYfgYExEX2f2
H7g4tuwMYevOxxggoTUD2jStRA/mugmTjba+EUc5hrxOJ3MVsQZgFWuqALcEJzDrturAH
LsRCxQRRvEQHJYLQFqO3gMvlHfTCU/LpEMohIkB3bPtoFTiPRwOBxYAR7upWZUHcOAA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DlZB6iaf;
arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (prime256v1))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id E8689606A325
for <netdev@vger.kernel.org>; Thu, 19 Nov 2026 18:48:12 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 993F11F00926
for <netdev@vger.kernel.org>; Thu, 19 Nov 2026 18:48:12 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
s=k20260515; t=1795114092;
bh=5zHGL+QsjNpZ6g1gAKY/0i6WN3IS52QSM0gJbOkQs1I=;
h=References:In-Reply-To:From:Date:Subject:To:Cc;
b=DlZB6iafTTHqNfF0jjyLynONL0l7eKh7UMFJTFViFIcNdS2ZS9zcbCKp7OHgTiWV/
bKrOInSEmEQ/erWZpeCTAiSyi9ng6Az2BedkMdxG8pUU0feqR9SUt3vfrVqwF6Vz8p
mCK0Ag84m8gpoCdG6A6VD2BBiZLpaSFST77T86P+rlawHoXh5apcyR9dStbOSAA+no
KCMPm9JEUg+4DWGTO7ZMopbR4Zg5vCsNASXRhXgRuQpTmqyFvIKqm2T6GpFVIHCd3t
VTMBrQlUWUkLjgNLjOTz7M8rdqywdt7aC7otiKK/ChDZu+RybeiK0d4k3AB0506z/1
itR9LNqS/oq6w==
X-Received: by mail-oo1-f45.google.com with SMTP id 006d021491bc7-71ad047710aso35191eaf.3
for <netdev@vger.kernel.org>; Thu, 19 Nov 2026 10:48:12 -0800 (PST)
X-Forwarded-Encrypted: i=1; AL+hErG9oVQ6n7GZdhoXIVHE1JQneU/gAfb5uW2Gxi6GXlw9OmeVXiPTdff50dU6I07WKw42odlkrM4=@vger.kernel.org
X-Gm-Message-State: APuU4Z+4F/yRQY0/w6df0wPjRXkNgdXsIBATJVYsAgodHxHsdWaq5+JH
4CuLxHAlbtfbCGwrerIMzVnKXAP0nAeQelBuZvjPYkm5vVk2+oBdZKB83gV41ZBSQ4sVnhV+NK8
HRkpS2qC1Pn4DQ6Rkyz4FQ+s4IjABCxY=
X-Received: by 2002:a05:6820:4109:b0:71a:ead6:faf3 with SMTP id
006d021491bc7-71b392612d2mr518409eaf.10.1795114091815; Thu, 19 Nov 2026
10:48:11 -0800 (PST)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261119180143.2912138-4-chia-yu.chang@nokia-bell-labs.com>
X-Gmail-Original-Message-ID: <CAL4WiirxeYg37=0U0T+9jWttebQbrsTbK9GRNed0tUCw5w11sA@mail.gmail.com>
X-Gm-Features: AclHuK_PK17MlM2BR4u8Zz7NWIc0XbygF6Uc-yorGsvP9IEIFlia9wqte8JQigQ
X-Cc: linux-kernel@vger.kernel.org, kuba@kernel.org, netdev@vger.kernel.org,
pabeni@redhat.com, davem@davemloft.net, kuniyu@google.com, ij@kernel.org,
ncardwell@google.com, koen0607@gmail.com, g.white@cablelabs.com,
ingemar.s.johansson@ericsson.com, mirja.kuehlewind@ericsson.com,
cheshire@apple.com, rs.ietf@gmx.at, Jason_Livingood@comcast.com,
vidhi_goel@apple.com, Mike_Rudolph@comcast.com, Jeff_Howe@comcast.com,
srichard@netapp.com