summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerge Semin <fancer.lancer@gmail.com>2025-03-29 01:26:23 +0300
committerSerge Semin <fancer.lancer@gmail.com>2026-08-13 20:34:12 +0300
commitf535f3cdfde211611ea6b0a48a975f97f570a233 (patch)
tree2aa713a8d7c0fb76f7800df6310bb0a3ac3e6a93
parentd6cd34229a19ff94da813d53bc5845748a590f22 (diff)
downloadlinux-f535f3cdfde211611ea6b0a48a975f97f570a233.tar.gz
linux-f535f3cdfde211611ea6b0a48a975f97f570a233.zip
net: stmmac: vlan: Fix VLAN Stripping always enabled in ndo_set_features()
Commit 8eb301bd7b0f ("net: stmmac: enable HW-accelerated VLAN stripping for gmac4 only") attempted to fix the problem of the HW-accelerated VLAN tag stripping feature being enabled for all MAC cores even despite of having it supported by the DW GMAC4 driver only. But the solution only works up until the ndo_set_features() method is called. When it's done the mac_device_info::hw_vlan_en field will be set to true thus disabling the software-based VLAN tag stripping implementation and relying on the MAC to do that. Of course that won't be done on the DW GMAC- nor DW XLGMAC-based devices since the driver currently doesn't support the feature on these IP-cores. Let's completely fix the denoted problem just by changing the HW-offloaded VLAN tag detection flag only if the NETIF_F_HW_VLAN_CTAG_RX flag is set in ndt_device::hw_features. The later condition is only met for the DW GMAC4 and DW XGMAC IP-cores currently. Fixes: 8eb301bd7b0f ("net: stmmac: enable HW-accelerated VLAN stripping for gmac4 only") Fixes: 750011e239a5 ("net: stmmac: Add support for HW-accelerated VLAN stripping") Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_main.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 02ba1e965a5b..ca9608f08c94 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -6502,10 +6502,8 @@ static int stmmac_set_features(struct net_device *netdev,
features & NETIF_F_RXHASH,
priv->plat->rx_queues_to_use);
- if (features & NETIF_F_HW_VLAN_CTAG_RX)
- priv->hw->hw_vlan_en = true;
- else
- priv->hw->hw_vlan_en = false;
+ if (netdev->hw_features & NETIF_F_HW_VLAN_CTAG_RX)
+ priv->hw->hw_vlan_en = !!(features & NETIF_F_HW_VLAN_CTAG_RX);
phylink_rx_clk_stop_block(priv->phylink);
stmmac_set_hw_vlan_mode(priv, priv->hw);