From 50fc57124e412b937af7fc3d7bd43ddc6ba0a649 Mon Sep 17 00:00:00 2001 From: Serge Semin Date: Thu, 21 Aug 2025 16:24:53 +0300 Subject: net: stmmac: vlan: Extend VLAN filters devices support DW GMAC, DW QoS Ether and DW XGMAC/XLGMAC IP-core supports three types of the VLAN filters: 1. Basic Rx VLAN perfect filter. In some extent it's available on all DW controllers. But in case of DW GMAC the S-VLAN tagged frames filtering has been supported since v3.70a. 2. Extended Rx VLAN perfect filter. It's optionally available on the modern IP-cores: DW QoS Ether, DW XGMAC, DW XLGMAC, etc. The feature has been introduced as a substitution to the Basic Rx VLAn perfect filter to extend the amount of the VLAN tags to filter. 3. Rx VLAN hash filter. It's optionally available on all modern IP-cores and on DW GMACs since v3.70a. As it can be inferred from the name the filter implies to use hash-table as a set of the allowed the VLAN-tags. The notable particularity of this filter is that it' S-VLAN capability is synchronized with the Basic Rx VLAN perfect filter. So as can be seen from the description at least one VLAN filter is always available on the modern DW network controllers, meanwhile the extended Rx VLAN and hash-based filters are optional. Moreover the current VLAN tag filters implementation in the driver support all of these filters working complementarily. Thus the driver can be freely converted to advertise the HW-accelerated VLAN C/S-Tags filtering for all the modern DW network controllers: DW GMAC v3.7x, DW QoS Ether and DW XGMAC/XLGMAC. Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 163ab3f0ad2b..04ffac733947 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -8805,7 +8805,10 @@ static int __stmmac_dvr_probe(struct device *device, ndev->features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX; ndev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX; - if (priv->dma_cap.vlhash || priv->dma_cap.nrvf_num) { + /* VLAN filtering is implemented for modern IP-cores only */ + if ((priv->plat->core_type == DWMAC_CORE_GMAC && + priv->synopsys_id >= DWMAC_CORE_3_70) || + dwmac_is_xmac(priv->plat->core_type)) { ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_STAG_FILTER; ndev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER | -- cgit v1.2.3