Linux Documentation
 help / color / mirror / Atom feed
* [PATCH v4 net-next 1/1] net: update comments for SKB_GSO_TCP_ECN and SKB_GSO_TCP_ACCECN
@ 2026-07-28 16:10 chia-yu.chang
  2026-08-04  0:47 ` Jakub Kicinski
  0 siblings, 1 reply; 3+ messages in thread
From: chia-yu.chang @ 2026-07-28 16:10 UTC (permalink / raw)
  To: linux-rdma, eperezma, jasowang, virtualization, mst, xuanzhuo,
	pabeni, edumazet, linux-doc, corbet, horms, dsahern, kuniyu, bpf,
	netdev, dave.taht, jhs, kuba, stephen, xiyou.wangcong, jiri,
	davem, andrew+netdev, donald.hunter, ast, liuhangbin, shuah,
	linux-kselftest, ij, ncardwell, koen.de_schepper, g.white,
	ingemar.s.johansson, mirja.kuehlewind, cheshire, rs.ietf,
	Jason_Livingood, vidhi_goel
  Cc: Chia-Yu Chang, Parav Pandit

From: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>

This patch updates the documentation of ECN‑related GSO flags, it
clarifies the limitations of SKB_GSO_TCP_ECN and explains how to preserve
the CWR flag (part of the ACE signal) in the Rx path.

For Tx, SKB_GSO_TCP_ECN and SKB_GSO_TCP_ACCECN are used respectively for
RFC3168 ECN and AccECN (RFC9768). SKB_GSO_TCP_ECN indicates that the
first segment has CWR set, while subsequent segments have CWR cleared.
In contrast, SKB_GSO_TCP_ACCECN means that the segment uses AccECN and
therefore its CWR flag must not be modified during segmentation.

For RX, SKB_GSO_TCP_ECN shall NOT be used, because the stack cannot know
whether the connection uses RFC3168 ECN or AccECN, whereas RFC3168 ECN
offload may clear CWR flag and thus corrupts the ACE signal. Instead, any
segment that arrives with CWR set must use the SKB_GSO_TCP_ACCECN flag
to prevent RFC3168 ECN offload logic from clearing the CWR flag.

This corresponds to discussions in virtio mailing list:
https://lore.kernel.org/all/20250814120118.81787-1-chia-yu.chang@nokia-bell-labs.com/
And it was suggested to clarify SKB_GSO_TCP_ECN and SKB_GSO_TCP_ACCECN.

Co-developed-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Ilpo Järvinen <ij@kernel.org>
Signed-off-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
Cc: Parav Pandit <parav@nvidia.com>

---
v4:
- Update commit message

v3:
- Update commit messages and documentation for clarity
---
 include/linux/skbuff.h | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 22eda1d54a0e..6c0d725facf0 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -671,7 +671,13 @@ enum {
 	/* This indicates the skb is from an untrusted source. */
 	SKB_GSO_DODGY = 1 << 1,
 
-	/* This indicates the tcp segment has CWR set. */
+	/* For TX, this indicates that the first TCP segment has CWR set, and
+	 * any subsequent segment in the same skb has CWR cleared. This flag
+	 * must not be used in RX, because the connection to which the segment
+	 * belongs is not tracked to use RFC3168 or AccECN. Using RFC3168 ECN
+	 * offload may clear CWR and corrupt ACE signal (CWR is part of it).
+	 * Instead, SKB_GSO_TCP_ACCECN shall be used to avoid CWR corruption.
+	 */
 	SKB_GSO_TCP_ECN = 1 << 2,
 
 	__SKB_GSO_TCP_FIXEDID = 1 << 3,
@@ -706,6 +712,13 @@ enum {
 
 	SKB_GSO_FRAGLIST = 1 << 18,
 
+	/* For TX, this indicates that the TCP segment uses the CWR flag as part
+	 * of the ACE signal, and the CWR flag must not be modified in the skb.
+	 * For RX, any incoming segment with CWR set must use this flag so that
+	 * no RFC3168 ECN offload can clear the CWR flag. This is required to
+	 * preserve ACE signal correctness (CWR is part of it) in a forwarding
+	 * scenario, e.g., from one netdevice RX to other netdevice TX
+	 */
 	SKB_GSO_TCP_ACCECN = 1 << 19,
 
 	/* These indirectly map onto the same netdev feature.
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v4 net-next 1/1] net: update comments for SKB_GSO_TCP_ECN and SKB_GSO_TCP_ACCECN
  2026-07-28 16:10 [PATCH v4 net-next 1/1] net: update comments for SKB_GSO_TCP_ECN and SKB_GSO_TCP_ACCECN chia-yu.chang
@ 2026-08-04  0:47 ` Jakub Kicinski
  2026-08-04 12:38   ` Chia-Yu Chang (Nokia)
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Kicinski @ 2026-08-04  0:47 UTC (permalink / raw)
  To: chia-yu.chang
  Cc: linux-rdma, eperezma, jasowang, virtualization, mst, xuanzhuo,
	pabeni, edumazet, linux-doc, corbet, horms, dsahern, kuniyu, bpf,
	netdev, dave.taht, jhs, stephen, xiyou.wangcong, jiri, davem,
	andrew+netdev, donald.hunter, ast, liuhangbin, shuah,
	linux-kselftest, ij, ncardwell, koen.de_schepper, g.white,
	ingemar.s.johansson, mirja.kuehlewind, cheshire, rs.ietf,
	Jason_Livingood, vidhi_goel, Parav Pandit

On Tue, 28 Jul 2026 18:10:07 +0200 chia-yu.chang@nokia-bell-labs.com
wrote:
> For RX, SKB_GSO_TCP_ECN shall NOT be used

but it _is_ still used in hns3, what's your plan there?
Documenting something we adhere to at the outset seems like a red flag.
-- 
I'm expecting at least a commit msg update at the of the discussion so:
pw-bot: cr

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH v4 net-next 1/1] net: update comments for SKB_GSO_TCP_ECN and SKB_GSO_TCP_ACCECN
  2026-08-04  0:47 ` Jakub Kicinski
@ 2026-08-04 12:38   ` Chia-Yu Chang (Nokia)
  0 siblings, 0 replies; 3+ messages in thread
From: Chia-Yu Chang (Nokia) @ 2026-08-04 12:38 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: linux-rdma@vger.kernel.org, eperezma@redhat.com,
	jasowang@redhat.com, virtualization@lists.linux.dev,
	mst@redhat.com, xuanzhuo@linux.alibaba.com, pabeni@redhat.com,
	edumazet@google.com, linux-doc@vger.kernel.org, corbet@lwn.net,
	horms@kernel.org, dsahern@kernel.org, kuniyu@google.com,
	bpf@vger.kernel.org, netdev@vger.kernel.org, dave.taht@gmail.com,
	jhs@mojatatu.com, stephen@networkplumber.org,
	xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net,
	andrew+netdev@lunn.ch, donald.hunter@gmail.com, ast@fiberby.net,
	liuhangbin@gmail.com, shuah@kernel.org,
	linux-kselftest@vger.kernel.org, ij@kernel.org,
	ncardwell@google.com, Koen De Schepper (Nokia),
	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, Parav Pandit

> -----Original Message-----
> From: Jakub Kicinski <kuba@kernel.org> 
> Sent: Tuesday, August 4, 2026 2:47 AM
> To: Chia-Yu Chang (Nokia) <chia-yu.chang@nokia-bell-labs.com>
> Cc: linux-rdma@vger.kernel.org; eperezma@redhat.com; jasowang@redhat.com; virtualization@lists.linux.dev; mst@redhat.com; xuanzhuo@linux.alibaba.com; pabeni@redhat.com; edumazet@google.com; linux-doc@vger.kernel.org; corbet@lwn.net; horms@kernel.org; dsahern@kernel.org; kuniyu@google.com; bpf@vger.kernel.org; netdev@vger.kernel.org; dave.taht@gmail.com; jhs@mojatatu.com; stephen@networkplumber.org; xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net; andrew+netdev@lunn.ch; donald.hunter@gmail.com; ast@fiberby.net; liuhangbin@gmail.com; shuah@kernel.org; linux-kselftest@vger.kernel.org; ij@kernel.org; ncardwell@google.com; Koen De Schepper (Nokia) <koen.de_schepper@nokia-bell-labs.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; Parav Pandit <parav@nvidia.com>
> Subject: Re: [PATCH v4 net-next 1/1] net: update comments for SKB_GSO_TCP_ECN and SKB_GSO_TCP_ACCECN
> 
> 
> CAUTION: This is an external email. Please be very careful when clicking links or opening attachments. See the URL nok.it/ext for additional information.
> 
> 
> 
> On Tue, 28 Jul 2026 18:10:07 +0200 chia-yu.chang@nokia-bell-labs.com
> wrote:
> > For RX, SKB_GSO_TCP_ECN shall NOT be used
> 
> but it _is_ still used in hns3, what's your plan there?
> Documenting something we adhere to at the outset seems like a red flag.
> 
Hello,

I would think to remove the SKB_GSO_TCP_ECN in hns3.
Because hns3 will break the whole TOS byte based on Jijie's email: https://lore.kernel.org/all/47530dd8-cba6-4282-ae80-4cabd52b08bc@huawei.com/#t

Also, the virtio related changes will be submitted only after the approval from virtio-spec.

Thanks.
Chia-Yu

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-04 12:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-28 16:10 [PATCH v4 net-next 1/1] net: update comments for SKB_GSO_TCP_ECN and SKB_GSO_TCP_ACCECN chia-yu.chang
2026-08-04  0:47 ` Jakub Kicinski
2026-08-04 12:38   ` Chia-Yu Chang (Nokia)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox