gso_features_check() compares the frame length against
netif_get_gso_max_size(), which picks the IPv4 or the IPv6 limit from
skb->protocol.  A tag which is already inside the frame replaces that field
with the VLAN ethertype, as skb_vlan_push() does, and an IPv6 packet is
then measured against the IPv4 limit and segmented although the device
could send it as one TSO frame.

The lookup moves from netdevice.h into dev.c: vlan_get_protocol() reads the
L3 protocol from behind an in-frame tag, while if_vlan.h includes
netdevice.h, so an inline in that header cannot call it.  dev.c is the only
file which calls the lookup, so it becomes a static helper there.

Assisted-by: LLM
Signed-off-by: Wang Zhan <[email protected]>

---
v4:
- drop the Fixes tag: not stable material
- move the limit lookup into dev.c, so it can use vlan_get_protocol()
v3: https://lore.kernel.org/[email protected]/
v2: https://lore.kernel.org/[email protected]/
v1: https://lore.kernel.org/[email protected]/
---
 include/linux/netdevice.h | 9 ---------
 net/core/dev.c            | 9 +++++++++
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d037faff7c44b6..421c0f5952463e 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -5561,15 +5561,6 @@ netif_get_gro_max_size(const struct net_device *dev, 
const struct sk_buff *skb)
               READ_ONCE(dev->gro_ipv4_max_size);
 }
 
-static inline unsigned int
-netif_get_gso_max_size(const struct net_device *dev, const struct sk_buff *skb)
-{
-       /* pairs with WRITE_ONCE() in netif_set_gso(_ipv4)_max_size() */
-       return skb->protocol == htons(ETH_P_IPV6) ?
-              READ_ONCE(dev->gso_max_size) :
-              READ_ONCE(dev->gso_ipv4_max_size);
-}
-
 static inline bool netif_is_macsec(const struct net_device *dev)
 {
        return dev->priv_flags & IFF_MACSEC;
diff --git a/net/core/dev.c b/net/core/dev.c
index a8eb382f40caf3..8475d5da64fdf0 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3869,6 +3869,15 @@ static bool skb_gso_has_extension_hdr(const struct 
sk_buff *skb)
                         skb_inner_network_header_len(skb) != sizeof(struct 
ipv6hdr)));
 }
 
+static unsigned int
+netif_get_gso_max_size(const struct net_device *dev, const struct sk_buff *skb)
+{
+       /* pairs with WRITE_ONCE() in netif_set_gso(_ipv4)_max_size() */
+       return vlan_get_protocol(skb) == htons(ETH_P_IPV6) ?
+              READ_ONCE(dev->gso_max_size) :
+              READ_ONCE(dev->gso_ipv4_max_size);
+}
+
 static netdev_features_t gso_features_check(const struct sk_buff *skb,
                                            struct net_device *dev,
                                            netdev_features_t features)
-- 
2.47.3

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to