summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorPaolo Abeni <pabeni@redhat.com>2025-09-25 12:42:52 +0200
committerPaolo Abeni <pabeni@redhat.com>2025-09-25 12:42:52 +0200
commit12de5f0f6c2d7aad7e60aada650fcfb374c28a5e (patch)
tree1bda173a3e3b89f2d1d87078f8d6996c7c3ffe7e /include/linux
parentbb6a22651b893c08c7855b34aa618b2a71bece9e (diff)
parent5e9ff9378adcaff1efd19d31f7be946472df02f8 (diff)
Merge branch 'net-gso-restore-outer-ip-ids-correctly'
Richard Gobert says: ==================== net: gso: restore outer ip ids correctly GRO currently ignores outer IPv4 header IDs for encapsulated packets that have their don't-fragment flag set. GSO, however, always assumes that outer IP IDs are incrementing. This results in GSO mangling the outer IDs when they aren't incrementing. For example, GSO mangles the outer IDs of IPv6 packets that were converted to IPv4, which must have an ID of 0 according to RFC 6145, sect. 5.1. GRO+GSO is supposed to be entirely transparent by default. GSO already correctly restores inner IDs and IDs of non-encapsulated packets. The tx-tcp-mangleid-segmentation feature can be enabled to allow the mangling of such IDs so that TSO can be used. This series fixes outer ID restoration for encapsulated packets when tx-tcp-mangleid-segmentation is disabled. It also allows GRO to merge packets with fixed IDs that don't have their don't-fragment flag set. v1: https://lore.kernel.org/netdev/20250814114030.7683-1-richardbgobert@gmail.com/ v2: https://lore.kernel.org/netdev/20250819063223.5239-1-richardbgobert@gmail.com/ v3: https://lore.kernel.org/netdev/20250821073047.2091-1-richardbgobert@gmail.com/ v4: https://lore.kernel.org/netdev/20250901113826.6508-1-richardbgobert@gmail.com/ v5: https://lore.kernel.org/netdev/20250915113933.3293-1-richardbgobert@gmail.com/ v6: https://lore.kernel.org/netdev/20250916144841.4884-1-richardbgobert@gmail.com/ v7: https://lore.kernel.org/netdev/20250922084103.4764-1-richardbgobert@gmail.com/ ==================== Link: https://patch.msgid.link/20250923085908.4687-1-richardbgobert@gmail.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/netdevice.h9
-rw-r--r--include/linux/skbuff.h8
2 files changed, 14 insertions, 3 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 1c54d44805fa..1b85454116f6 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -5320,13 +5320,18 @@ void skb_warn_bad_offload(const struct sk_buff *skb);
static inline bool net_gso_ok(netdev_features_t features, int gso_type)
{
- netdev_features_t feature = (netdev_features_t)gso_type << NETIF_F_GSO_SHIFT;
+ netdev_features_t feature;
+
+ if (gso_type & (SKB_GSO_TCP_FIXEDID | SKB_GSO_TCP_FIXEDID_INNER))
+ gso_type |= __SKB_GSO_TCP_FIXEDID;
+
+ feature = ((netdev_features_t)gso_type << NETIF_F_GSO_SHIFT) & NETIF_F_GSO_MASK;
/* check flags correspondence */
BUILD_BUG_ON(SKB_GSO_TCPV4 != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT));
BUILD_BUG_ON(SKB_GSO_DODGY != (NETIF_F_GSO_ROBUST >> NETIF_F_GSO_SHIFT));
BUILD_BUG_ON(SKB_GSO_TCP_ECN != (NETIF_F_TSO_ECN >> NETIF_F_GSO_SHIFT));
- BUILD_BUG_ON(SKB_GSO_TCP_FIXEDID != (NETIF_F_TSO_MANGLEID >> NETIF_F_GSO_SHIFT));
+ BUILD_BUG_ON(__SKB_GSO_TCP_FIXEDID != (NETIF_F_TSO_MANGLEID >> NETIF_F_GSO_SHIFT));
BUILD_BUG_ON(SKB_GSO_TCPV6 != (NETIF_F_TSO6 >> NETIF_F_GSO_SHIFT));
BUILD_BUG_ON(SKB_GSO_FCOE != (NETIF_F_FSO >> NETIF_F_GSO_SHIFT));
BUILD_BUG_ON(SKB_GSO_GRE != (NETIF_F_GSO_GRE >> NETIF_F_GSO_SHIFT));
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 78ecfa7d00d0..fb3fec9affaa 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -674,7 +674,7 @@ enum {
/* This indicates the tcp segment has CWR set. */
SKB_GSO_TCP_ECN = 1 << 2,
- SKB_GSO_TCP_FIXEDID = 1 << 3,
+ __SKB_GSO_TCP_FIXEDID = 1 << 3,
SKB_GSO_TCPV6 = 1 << 4,
@@ -707,6 +707,12 @@ enum {
SKB_GSO_FRAGLIST = 1 << 18,
SKB_GSO_TCP_ACCECN = 1 << 19,
+
+ /* These indirectly map onto the same netdev feature.
+ * If NETIF_F_TSO_MANGLEID is set it may mangle both inner and outer IDs.
+ */
+ SKB_GSO_TCP_FIXEDID = 1 << 30,
+ SKB_GSO_TCP_FIXEDID_INNER = 1 << 31,
};
#if BITS_PER_LONG > 32