]> git.hungrycats.org Git - linux/commitdiff
net: stmmac: drop gso_enabled_types and rely on netdev features
authorLorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Mon, 24 Aug 2026 09:59:08 +0000 (11:59 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 27 Aug 2026 18:05:34 +0000 (11:05 -0700)
The gso_enabled_types field is used by stmmac_xmit() to decide whether a
GSO skb should be passed to stmmac_tso_xmit(). It is updated in
stmmac_set_features() based solely on NETIF_F_TSO, so disabling IPv4
TSO while keeping IPv6 TSO (NETIF_F_TSO6) enabled zeroes the mask. As a
result IPv6 GSO frames, which the networking stack still generates since
NETIF_F_TSO6 is enabled, fall through to the non-TSO xmit path where
they are not handled.

The networking stack already manages the GSO logic: a GSO skb is only
delivered to the driver when the matching offload feature (NETIF_F_TSO,
NETIF_F_TSO6 or NETIF_F_GSO_UDP_L4) is enabled, otherwise the frame is
segmented in software before reaching ndo_start_xmit().
stmmac_features_check() also validates each GSO frame against the TSO
hardware constraints and falls back to software GSO when they are not met.

Drop the gso_enabled_types field and rely on skb_is_gso() in
stmmac_xmit() instead, which correctly routes IPv6 GSO frames to the TSO
path when NETIF_F_TSO is disabled. This also removes the data race
between stmmac_set_gso_types(), called from the feature-set path, and
the lockless read of gso_enabled_types in stmmac_xmit().

Fixes: 2e4082e4b739 ("net: stmmac: simplify GSO/TSO test in stmmac_xmit()")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
Link: https://patch.msgid.link/20260824-stmmac-fix-tso6-features-v3-1-c73a7a4a0ec7@oss.qualcomm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac.h
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index 8ba8f03e1ce037a59e8ead33971d7bc3c84286c5..7582fca637419dd8fc258e576c536a1a50941f22 100644 (file)
@@ -265,8 +265,6 @@ struct stmmac_priv {
        u32 rx_coal_frames[MTL_MAX_RX_QUEUES];
 
        int hwts_tx_en;
-       /* skb_shinfo(skb)->gso_type types that we handle */
-       unsigned int gso_enabled_types;
        bool tx_path_in_lpi_mode;
        bool sph_active;
        bool sph_capable;
index efa35cfecc4f2ae28922c5eb297dc08db7097238..bc6ba4be18b109296c19c3a59cefd67d3bca11ae 100644 (file)
@@ -4376,18 +4376,6 @@ static void stmmac_flush_tx_descriptors(struct stmmac_priv *priv, int queue)
        stmmac_set_queue_tx_tail_ptr(priv, tx_q, queue, tx_q->cur_tx);
 }
 
-static void stmmac_set_gso_types(struct stmmac_priv *priv, bool tso)
-{
-       if (!tso) {
-               priv->gso_enabled_types = 0;
-       } else {
-               /* Manage oversized TCP frames for GMAC4 device */
-               priv->gso_enabled_types = SKB_GSO_TCPV4 | SKB_GSO_TCPV6;
-               if (priv->plat->core_type == DWMAC_CORE_GMAC4)
-                       priv->gso_enabled_types |= SKB_GSO_UDP_L4;
-       }
-}
-
 static void stmmac_set_gso_features(struct net_device *ndev)
 {
        struct stmmac_priv *priv = netdev_priv(ndev);
@@ -4421,8 +4409,6 @@ static void stmmac_set_gso_features(struct net_device *ndev)
        if (priv->plat->core_type == DWMAC_CORE_GMAC4)
                ndev->hw_features |= NETIF_F_GSO_UDP_L4;
 
-       stmmac_set_gso_types(priv, true);
-
        dev_info(priv->device, "TSO feature enabled\n");
 }
 
@@ -4772,8 +4758,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
        if (priv->tx_path_in_lpi_mode && priv->eee_sw_timer_en)
                stmmac_stop_sw_lpi(priv);
 
-       if (skb_is_gso(skb) &&
-           skb_shinfo(skb)->gso_type & priv->gso_enabled_types)
+       if (skb_is_gso(skb))
                return stmmac_tso_xmit(skb, dev);
 
        if (priv->est && priv->est->enable &&
@@ -6207,8 +6192,6 @@ static int stmmac_set_features(struct net_device *netdev,
                        stmmac_enable_sph(priv, priv->ioaddr, sph_en, chan);
        }
 
-       stmmac_set_gso_types(priv, features & NETIF_F_TSO);
-
        if (features & NETIF_F_HW_VLAN_CTAG_RX)
                priv->hw->hw_vlan_en = true;
        else