diff options
| author | Serge Semin <fancer.lancer@gmail.com> | 2025-04-08 19:21:43 +0300 |
|---|---|---|
| committer | Serge Semin <fancer.lancer@gmail.com> | 2026-08-13 20:34:12 +0300 |
| commit | 7af0d9110c1cb46f69add1b36d7b2327ba03b688 (patch) | |
| tree | 0f82eb4b097159cf8e4c789b7efb86980e5e8a1b | |
| parent | f535f3cdfde211611ea6b0a48a975f97f570a233 (diff) | |
| download | linux-7af0d9110c1cb46f69add1b36d7b2327ba03b688.tar.gz linux-7af0d9110c1cb46f69add1b36d7b2327ba03b688.zip | |
net: stmmac: vlan: Fix VLAN S-TAG stripping
In fact the always strip mode enabled in the vlan_set_hw_mode() method
means stripping both VLAN tag types C and S ones. Thus both of these
NET-device features must be enabled/disabled simultaneously if requested
by ethtool.
Fix that by adding the respective conditionals to the ndo_fix_feature()
method and making sure that both of these features are synchronously
switchable.
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.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index ca9608f08c94..a23e9e3a05ea 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -6464,6 +6464,14 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev, if (!(features & NETIF_F_RXCSUM)) features &= ~NETIF_F_RXHASH; + /* VLAN-stripping implies removing any VLAN tag type: CTAG and STAG */ + if (dwmac_is_xmac(priv->plat->core_type)) { + if (features & NETIF_F_HW_VLAN_CTAG_RX) + features |= NETIF_F_HW_VLAN_STAG_RX; + else if (features & NETIF_F_HW_VLAN_STAG_RX) + features |= NETIF_F_HW_VLAN_CTAG_RX; + } + return features; } @@ -8783,7 +8791,7 @@ static int __stmmac_dvr_probe(struct device *device, /* Both mac100 and gmac support receive VLAN tag detection */ ndev->features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX; if (dwmac_is_xmac(priv->plat->core_type)) { - ndev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX; + ndev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX; priv->hw->hw_vlan_en = true; } if (priv->dma_cap.vlhash) { |
