]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: stmmac: fix .ndo_fix_features()
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Wed, 1 Apr 2026 07:21:19 +0000 (08:21 +0100)
committerJakub Kicinski <kuba@kernel.org>
Thu, 2 Apr 2026 18:28:18 +0000 (11:28 -0700)
netdev features documentation requires that .ndo_fix_features() is
stateless: it shouldn't modify driver state. Yet, stmmac_fix_features()
does exactly that, changing whether GSO frames are processed by the
driver.

Move this code to stmmac_set_features() instead, which is the correct
place for it. We don't need to check whether TSO is supported; this
is already handled via the setup of netdev->hw_features, and we are
guaranteed that if netdev->hw_features indicates that a feature is
not supported, .ndo_set_features() won't be called with it set.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1w7pt9-0000000East-1YAO@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index 52864561f14e8d272c6782cd55322a899c0ca0bc..f76ed64fb9e6ee2b1cf3ff5196cef818b048c755 100644 (file)
@@ -6073,14 +6073,6 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev,
        if (priv->plat->bugged_jumbo && (dev->mtu > ETH_DATA_LEN))
                features &= ~NETIF_F_CSUM_MASK;
 
-       /* Disable tso if asked by ethtool */
-       if ((priv->plat->flags & STMMAC_FLAG_TSO_EN) && (priv->dma_cap.tsoen)) {
-               if (features & NETIF_F_TSO)
-                       priv->tso = true;
-               else
-                       priv->tso = false;
-       }
-
        return features;
 }
 
@@ -6107,6 +6099,8 @@ static int stmmac_set_features(struct net_device *netdev,
                        stmmac_enable_sph(priv, priv->ioaddr, sph_en, chan);
        }
 
+       priv->tso = !!(features & NETIF_F_TSO);
+
        if (features & NETIF_F_HW_VLAN_CTAG_RX)
                priv->hw->hw_vlan_en = true;
        else