diff options
| author | Serge Semin <fancer.lancer@gmail.com> | 2025-04-10 20:53:16 +0300 |
|---|---|---|
| committer | Serge Semin <fancer.lancer@gmail.com> | 2026-08-13 20:34:37 +0300 |
| commit | 20747923ecfc7d104a4820859e036d822033a6ef (patch) | |
| tree | fef037bd235a6aa88d6bf7be0f35f596b3d865f9 | |
| parent | 930a50372b6d057ed30ffd622e4f16c94aa21e74 (diff) | |
| download | linux-20747923ecfc7d104a4820859e036d822033a6ef.tar.gz linux-20747923ecfc7d104a4820859e036d822033a6ef.zip | |
net: stmmac: vlan: Drop VLAN basic perfect-filter fallback
Originally that functionality was added in the commit c7ab0b8088d7 ("net:
stmmac: Fallback to VLAN Perfect filtering if HASH is not available") in
order to initialize at least some filter if no HASH-based VLAN filter
available since at least one slot of the VLAN perfect filter always
available. But earlier another commit 3cd1cfcba26e ("net: stmmac:
Implement VLAN Hash Filtering in XGMAC") had made sure that no
HW-offloaded VLAN frames filter utilized if no HASH-based VLAN filter
provided in a controller. Thus that functionality has never been actually
used in practice. Moreover the later commit ed64639bc1e0 ("net: stmmac:
Add support for VLAN Rx filtering") implied using that perfect-filter
register if no Extended VLAN filter feature is available thus partly
duplicating what has already been implemented in the driver.
So to speak let's drop the unused code especially seeing the respective
device feature is utilized in a framework of the perfect-filter
initialization procedure already.
Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
| -rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 | ||||
| -rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 13 | ||||
| -rw-r--r-- | drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c | 31 |
3 files changed, 8 insertions, 38 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index f523ef567eab..7328791e236f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -629,7 +629,7 @@ struct stmmac_est_ops { struct stmmac_vlan_ops { /* VLAN */ void (*update_vlan_hash)(struct mac_device_info *hw, u32 hash, - u16 perfect_match, bool is_double); + bool is_double); void (*enable_vlan)(struct mac_device_info *hw, u32 type); void (*rx_hw_vlan)(struct mac_device_info *hw, struct dma_desc *rx_desc, struct sk_buff *skb); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 921aa3231d2d..f154a0037d8d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7130,29 +7130,18 @@ static u32 stmmac_vid_crc32_le(__le16 vid_le) static int stmmac_vlan_update(struct stmmac_priv *priv, bool is_double) { u32 crc, hash = 0; - u16 pmatch = 0; - int count = 0; u16 vid = 0; for_each_set_bit(vid, priv->active_vlans, VLAN_N_VID) { __le16 vid_le = cpu_to_le16(vid); crc = bitrev32(~stmmac_vid_crc32_le(vid_le)) >> 28; hash |= (1 << crc); - count++; - } - - if (!priv->dma_cap.vlhash) { - if (count > 2) /* VID = 0 always passes filter */ - return -EOPNOTSUPP; - - pmatch = vid; - hash = 0; } if (!netif_running(priv->dev)) return 0; - return stmmac_update_vlan_hash(priv, priv->hw, hash, pmatch, is_double); + return stmmac_update_vlan_hash(priv, priv->hw, hash, is_double); } /* FIXME: This may need RXC to be running, but it may be called with BH diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c index 2dcdbf78dd44..4ed7f7f031f4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c @@ -190,7 +190,7 @@ static void vlan_restore_hw_rx_fltr(struct net_device *dev, } static void vlan_update_hash(struct mac_device_info *hw, u32 hash, - u16 perfect_match, bool is_double) + bool is_double) { void __iomem *ioaddr = hw->pcsr; u32 value; @@ -210,35 +210,16 @@ static void vlan_update_hash(struct mac_device_info *hw, u32 hash, value &= ~VLAN_ESVL; value &= ~VLAN_DOVLTC; } - - if (!hw->vlan_filter[0]) - value |= VLAN_VID; - - writel(value, ioaddr + VLAN_TAG); - } else if (perfect_match) { - value &= ~VLAN_VTHM; - value |= VLAN_ETV; - if (is_double) { - value |= VLAN_EDVLP; - value |= VLAN_ESVL; - value |= VLAN_DOVLTC; - } else { - value &= ~VLAN_EDVLP; - value &= ~VLAN_ESVL; - value &= ~VLAN_DOVLTC; - } - - value &= ~VLAN_VID; - writel(value | perfect_match, ioaddr + VLAN_TAG); } else { value &= ~(VLAN_VTHM | VLAN_ETV); value &= ~(VLAN_EDVLP | VLAN_ESVL); value &= ~VLAN_DOVLTC; - if (!hw->vlan_filter[0]) - value |= VLAN_VID; - - writel(value, ioaddr + VLAN_TAG); } + + if (!hw->vlan_filter[0]) + value |= VLAN_VID; + + writel(value, ioaddr + VLAN_TAG); } static void vlan_enable(struct mac_device_info *hw, u32 type) |
