* [PATCH v3 net 0/3] ECN offload handling for AccECN series
@ 2026-02-16 8:51 chia-yu.chang
2026-02-16 8:51 ` [PATCH v3 net 1/3] net: update comments for SKB_GSO_TCP_ECN and SKB_GSO_TCP_ACCECN chia-yu.chang
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: chia-yu.chang @ 2026-02-16 8:51 UTC (permalink / raw)
To: linyunsheng, andrew+netdev, parav, jasowang, mst, shenjian15,
salil.mehta, shaojijie, saeedm, tariqt, mbloch, leonro,
linux-rdma, netdev, davem, edumazet, kuba, pabeni, horms, ij,
ncardwell, koen.de_schepper, g.white, ingemar.s.johansson,
mirja.kuehlewind, cheshire, rs.ietf, Jason_Livingood, vidhi_goel
Cc: Chia-Yu Chang
From: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
Hello,
Please find the v3 ECN offload handling for AccECN patch series for net.
It aims to avoid potential CWR flag corruption due to RFC3168 ECN offload,
because this flag is part of ACE signal used for Accurate ECN (RFC9768).
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.
A prior submission is made to net-next:
https://lore.kernel.org/all/SJ0PR12MB68066115C5329872316E6B37DC98A@SJ0PR12MB6806.namprd12.prod.outlook.com/
And it was suggetsed to submit the first two patches to net.
Best regards,
Chia-Yu
---
v2:
- Fix commit header title typo
v3:
- Fix commit message title typo
- Seprate prior #2 into #2 and #3 to have one patch per NIC (Paolo Abeni <pabeni@redhat.com>)
---
Chia-Yu Chang (3):
net: update comments for SKB_GSO_TCP_ECN and SKB_GSO_TCP_ACCECN
net: mlx5e: fix CWR handling in drivers to preserve ACE signal
net: hns3: fix CWR handling in drivers to preserve ACE signal
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 4 ++--
include/linux/skbuff.h | 15 ++++++++++++++-
3 files changed, 17 insertions(+), 4 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 net 1/3] net: update comments for SKB_GSO_TCP_ECN and SKB_GSO_TCP_ACCECN
2026-02-16 8:51 [PATCH v3 net 0/3] ECN offload handling for AccECN series chia-yu.chang
@ 2026-02-16 8:51 ` chia-yu.chang
2026-02-16 8:51 ` [PATCH v3 net 2/3] net: mlx5e: fix CWR handling in drivers to preserve ACE signal chia-yu.chang
2026-02-16 8:51 ` [PATCH v3 net 3/3] net: hns3: " chia-yu.chang
2 siblings, 0 replies; 7+ messages in thread
From: chia-yu.chang @ 2026-02-16 8:51 UTC (permalink / raw)
To: linyunsheng, andrew+netdev, parav, jasowang, mst, shenjian15,
salil.mehta, shaojijie, saeedm, tariqt, mbloch, leonro,
linux-rdma, netdev, davem, edumazet, kuba, pabeni, horms, ij,
ncardwell, koen.de_schepper, g.white, ingemar.s.johansson,
mirja.kuehlewind, cheshire, rs.ietf, Jason_Livingood, vidhi_goel
Cc: Chia-Yu Chang
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.
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>
---
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 daa4e4944ce3..8c94cf8cf2b5 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] 7+ messages in thread
* [PATCH v3 net 2/3] net: mlx5e: fix CWR handling in drivers to preserve ACE signal
2026-02-16 8:51 [PATCH v3 net 0/3] ECN offload handling for AccECN series chia-yu.chang
2026-02-16 8:51 ` [PATCH v3 net 1/3] net: update comments for SKB_GSO_TCP_ECN and SKB_GSO_TCP_ACCECN chia-yu.chang
@ 2026-02-16 8:51 ` chia-yu.chang
2026-02-19 14:35 ` Paolo Abeni
2026-02-19 14:50 ` Paolo Abeni
2026-02-16 8:51 ` [PATCH v3 net 3/3] net: hns3: " chia-yu.chang
2 siblings, 2 replies; 7+ messages in thread
From: chia-yu.chang @ 2026-02-16 8:51 UTC (permalink / raw)
To: linyunsheng, andrew+netdev, parav, jasowang, mst, shenjian15,
salil.mehta, shaojijie, saeedm, tariqt, mbloch, leonro,
linux-rdma, netdev, davem, edumazet, kuba, pabeni, horms, ij,
ncardwell, koen.de_schepper, g.white, ingemar.s.johansson,
mirja.kuehlewind, cheshire, rs.ietf, Jason_Livingood, vidhi_goel
Cc: Chia-Yu Chang
From: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
Currently, mlx5 Rx paths use SKB_GSO_TCP_ECN flag when a TCP segment
with the CWR flag set. This is wrong because SKB_GSO_TCP_ECN is only
valid for RFC3168 ECN on Tx, and using it on Rx allows RFC3168 ECN
offload to clear the CWR flag. As a result, incoming TCP segments
may lose their ACE signal integrity required for AccECN (RFC9768),
especially when the packet is forwarded and later re-segmented by GSO.
Fix this by setting SKB_GSO_TCP_ACCECN for any Rx segment with the CWR
flag set. SKB_GSO_TCP_ACCECN ensure that RFC3168 ECN offload will
not clear the CWR flag, therefore preserving the ACE signal.
Fixes: 92552d3abd329 ("net/mlx5e: HW_GRO cqe handler implementation")
Signed-off-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index efcfcddab376..64fb829e1f0f 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -1137,7 +1137,7 @@ static void mlx5e_shampo_update_ipv4_tcp_hdr(struct mlx5e_rq *rq, struct iphdr *
skb->csum_offset = offsetof(struct tcphdr, check);
if (tcp->cwr)
- skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN;
+ skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ACCECN;
}
static void mlx5e_shampo_update_ipv6_tcp_hdr(struct mlx5e_rq *rq, struct ipv6hdr *ipv6,
@@ -1158,7 +1158,7 @@ static void mlx5e_shampo_update_ipv6_tcp_hdr(struct mlx5e_rq *rq, struct ipv6hdr
skb->csum_offset = offsetof(struct tcphdr, check);
if (tcp->cwr)
- skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN;
+ skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ACCECN;
}
static void mlx5e_shampo_update_hdr(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe, bool match)
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 net 3/3] net: hns3: fix CWR handling in drivers to preserve ACE signal
2026-02-16 8:51 [PATCH v3 net 0/3] ECN offload handling for AccECN series chia-yu.chang
2026-02-16 8:51 ` [PATCH v3 net 1/3] net: update comments for SKB_GSO_TCP_ECN and SKB_GSO_TCP_ACCECN chia-yu.chang
2026-02-16 8:51 ` [PATCH v3 net 2/3] net: mlx5e: fix CWR handling in drivers to preserve ACE signal chia-yu.chang
@ 2026-02-16 8:51 ` chia-yu.chang
2026-02-19 14:52 ` Paolo Abeni
2 siblings, 1 reply; 7+ messages in thread
From: chia-yu.chang @ 2026-02-16 8:51 UTC (permalink / raw)
To: linyunsheng, andrew+netdev, parav, jasowang, mst, shenjian15,
salil.mehta, shaojijie, saeedm, tariqt, mbloch, leonro,
linux-rdma, netdev, davem, edumazet, kuba, pabeni, horms, ij,
ncardwell, koen.de_schepper, g.white, ingemar.s.johansson,
mirja.kuehlewind, cheshire, rs.ietf, Jason_Livingood, vidhi_goel
Cc: Chia-Yu Chang
From: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
Currently, hns3 Rx paths use SKB_GSO_TCP_ECN flag when a TCP segment
with the CWR flag set. This is wrong because SKB_GSO_TCP_ECN is only
valid for RFC3168 ECN on Tx, and using it on Rx allows RFC3168 ECN
offload to clear the CWR flag. As a result, incoming TCP segments
lose their ACE signal integrity required for AccECN (RFC9768),
especially when the packet is forwarded and later re-segmented by GSO.
Fix this by setting SKB_GSO_TCP_ACCECN for any Rx segment with the CWR
flag set. SKB_GSO_TCP_ACCECN ensure that RFC3168 ECN offload will
not clear the CWR flag, therefore preserving the ACE signal.
Fixes: d474d88f88261 ("net: hns3: add hns3_gro_complete for HW GRO process")
Signed-off-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
---
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
index a3206c97923e..e1b0dba56182 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
@@ -3904,7 +3904,7 @@ static int hns3_gro_complete(struct sk_buff *skb, u32 l234info)
skb_shinfo(skb)->gso_segs = NAPI_GRO_CB(skb)->count;
if (th->cwr)
- skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN;
+ skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ACCECN;
if (l234info & BIT(HNS3_RXD_GRO_FIXID_B))
skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_FIXEDID;
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v3 net 2/3] net: mlx5e: fix CWR handling in drivers to preserve ACE signal
2026-02-16 8:51 ` [PATCH v3 net 2/3] net: mlx5e: fix CWR handling in drivers to preserve ACE signal chia-yu.chang
@ 2026-02-19 14:35 ` Paolo Abeni
2026-02-19 14:50 ` Paolo Abeni
1 sibling, 0 replies; 7+ messages in thread
From: Paolo Abeni @ 2026-02-19 14:35 UTC (permalink / raw)
To: chia-yu.chang, linyunsheng, andrew+netdev, parav, jasowang, mst,
shenjian15, salil.mehta, shaojijie, saeedm, tariqt, mbloch,
leonro, linux-rdma, netdev, davem, edumazet, kuba, horms, ij,
ncardwell, koen.de_schepper, g.white, ingemar.s.johansson,
mirja.kuehlewind, cheshire, rs.ietf, Jason_Livingood, vidhi_goel
On 2/16/26 9:51 AM, chia-yu.chang@nokia-bell-labs.com wrote:
> From: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
>
> Currently, mlx5 Rx paths use SKB_GSO_TCP_ECN flag when a TCP segment
> with the CWR flag set. This is wrong because SKB_GSO_TCP_ECN is only
> valid for RFC3168 ECN on Tx, and using it on Rx allows RFC3168 ECN
> offload to clear the CWR flag. As a result, incoming TCP segments
> may lose their ACE signal integrity required for AccECN (RFC9768),
> especially when the packet is forwarded and later re-segmented by GSO.
>
> Fix this by setting SKB_GSO_TCP_ACCECN for any Rx segment with the CWR
> flag set. SKB_GSO_TCP_ACCECN ensure that RFC3168 ECN offload will
> not clear the CWR flag, therefore preserving the ACE signal.
>
> Fixes: 92552d3abd329 ("net/mlx5e: HW_GRO cqe handler implementation")
>
No empty line after the fixes tag (both here and in the next patch).
/P
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 net 2/3] net: mlx5e: fix CWR handling in drivers to preserve ACE signal
2026-02-16 8:51 ` [PATCH v3 net 2/3] net: mlx5e: fix CWR handling in drivers to preserve ACE signal chia-yu.chang
2026-02-19 14:35 ` Paolo Abeni
@ 2026-02-19 14:50 ` Paolo Abeni
1 sibling, 0 replies; 7+ messages in thread
From: Paolo Abeni @ 2026-02-19 14:50 UTC (permalink / raw)
To: chia-yu.chang, parav, saeedm, tariqt, mbloch, leonro
Cc: shenjian15, shaojijie, andrew+netdev, linyunsheng, mst, jasowang,
salil.mehta, linux-rdma, netdev, davem, edumazet, horms, ij,
ncardwell, koen.de_schepper, g.white, ingemar.s.johansson,
mirja.kuehlewind, Jason_Livingood, cheshire, rs.ietf, vidhi_goel,
kuba
On 2/16/26 9:51 AM, chia-yu.chang@nokia-bell-labs.com wrote:
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
> index efcfcddab376..64fb829e1f0f 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
> @@ -1137,7 +1137,7 @@ static void mlx5e_shampo_update_ipv4_tcp_hdr(struct mlx5e_rq *rq, struct iphdr *
> skb->csum_offset = offsetof(struct tcphdr, check);
>
> if (tcp->cwr)
> - skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN;
> + skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ACCECN;
Is the above enough or will later segmentation lead to wrong results? I
think/guess the firmware is (still) aggregating the wire frames using
the ECN schema, i.e. the first wire packet has CWR == 1, the later CWR==0.
Later segmentation of this GSO packet will emit CWR == 1 on all the
packets, making the egress stream different from ingress.
The above question is mostly for Mellanox person, I guess..
/P
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 net 3/3] net: hns3: fix CWR handling in drivers to preserve ACE signal
2026-02-16 8:51 ` [PATCH v3 net 3/3] net: hns3: " chia-yu.chang
@ 2026-02-19 14:52 ` Paolo Abeni
0 siblings, 0 replies; 7+ messages in thread
From: Paolo Abeni @ 2026-02-19 14:52 UTC (permalink / raw)
To: chia-yu.chang, linyunsheng, andrew+netdev, parav, jasowang, mst,
shenjian15, salil.mehta, shaojijie, saeedm, tariqt, mbloch,
leonro, linux-rdma, netdev, davem, edumazet, kuba, horms, ij,
ncardwell, koen.de_schepper, g.white, ingemar.s.johansson,
mirja.kuehlewind, cheshire, rs.ietf, Jason_Livingood, vidhi_goel
On 2/16/26 9:51 AM, chia-yu.chang@nokia-bell-labs.com wrote:
> From: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
>
> Currently, hns3 Rx paths use SKB_GSO_TCP_ECN flag when a TCP segment
> with the CWR flag set. This is wrong because SKB_GSO_TCP_ECN is only
> valid for RFC3168 ECN on Tx, and using it on Rx allows RFC3168 ECN
> offload to clear the CWR flag. As a result, incoming TCP segments
> lose their ACE signal integrity required for AccECN (RFC9768),
> especially when the packet is forwarded and later re-segmented by GSO.
>
> Fix this by setting SKB_GSO_TCP_ACCECN for any Rx segment with the CWR
> flag set. SKB_GSO_TCP_ACCECN ensure that RFC3168 ECN offload will
> not clear the CWR flag, therefore preserving the ACE signal.
>
> Fixes: d474d88f88261 ("net: hns3: add hns3_gro_complete for HW GRO process")
>
> Signed-off-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
> ---
> drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
> index a3206c97923e..e1b0dba56182 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
> @@ -3904,7 +3904,7 @@ static int hns3_gro_complete(struct sk_buff *skb, u32 l234info)
>
> skb_shinfo(skb)->gso_segs = NAPI_GRO_CB(skb)->count;
> if (th->cwr)
> - skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN;
> + skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ACCECN;
Similar question here. Does the above need to be paired with firmware
changes to ensure that the actual GSO packet contents will match the
ACCECN flag?
/P
>
> if (l234info & BIT(HNS3_RXD_GRO_FIXID_B))
> skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_FIXEDID;
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-02-19 14:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-16 8:51 [PATCH v3 net 0/3] ECN offload handling for AccECN series chia-yu.chang
2026-02-16 8:51 ` [PATCH v3 net 1/3] net: update comments for SKB_GSO_TCP_ECN and SKB_GSO_TCP_ACCECN chia-yu.chang
2026-02-16 8:51 ` [PATCH v3 net 2/3] net: mlx5e: fix CWR handling in drivers to preserve ACE signal chia-yu.chang
2026-02-19 14:35 ` Paolo Abeni
2026-02-19 14:50 ` Paolo Abeni
2026-02-16 8:51 ` [PATCH v3 net 3/3] net: hns3: " chia-yu.chang
2026-02-19 14:52 ` Paolo Abeni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox