From: Chia-Yu Chang <[email protected]> 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 durging 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 <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]> Signed-off-by: Chia-Yu Chang <[email protected]> --- 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 8b399ddf1b9b..c59f0ce414d9 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 essential for + * preserving ACE signal correceness (CWR is part of it) in a forwarding + * scenario, e.g., from virtio_net RX to GSO TX. + */ SKB_GSO_TCP_ACCECN = 1 << 19, /* These indirectly map onto the same netdev feature. -- 2.34.1
