net: stmmac: xgmac: Fix VLAN register handling
authorJose Abreu <Jose.Abreu@synopsys.com>
Thu, 2 Apr 2020 13:57:07 +0000 (15:57 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 2 Apr 2020 14:04:45 +0000 (07:04 -0700)
Commit 907a076881f1, forgot that we need to clear old values of
XGMAC_VLAN_TAG register when we switch from VLAN perfect matching to
HASH matching.

Fix it.

Fixes: 907a076881f1 ("net: stmmac: xgmac: fix incorrect XGMAC_VLAN_TAG register writting")
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c

index 0e4575f7bedbc33d916bbc4cbf0d92a221564c6c..ad4df9bddcf351503c5d90f17ad3e95a1bd2b616 100644 (file)
@@ -577,8 +577,13 @@ static void dwxgmac2_update_vlan_hash(struct mac_device_info *hw, u32 hash,
                        value |= XGMAC_VLAN_EDVLP;
                        value |= XGMAC_VLAN_ESVL;
                        value |= XGMAC_VLAN_DOVLTC;
+               } else {
+                       value &= ~XGMAC_VLAN_EDVLP;
+                       value &= ~XGMAC_VLAN_ESVL;
+                       value &= ~XGMAC_VLAN_DOVLTC;
                }
 
+               value &= ~XGMAC_VLAN_VID;
                writel(value, ioaddr + XGMAC_VLAN_TAG);
        } else if (perfect_match) {
                u32 value = readl(ioaddr + XGMAC_PACKET_FILTER);
@@ -589,13 +594,19 @@ static void dwxgmac2_update_vlan_hash(struct mac_device_info *hw, u32 hash,
 
                value = readl(ioaddr + XGMAC_VLAN_TAG);
 
+               value &= ~XGMAC_VLAN_VTHM;
                value |= XGMAC_VLAN_ETV;
                if (is_double) {
                        value |= XGMAC_VLAN_EDVLP;
                        value |= XGMAC_VLAN_ESVL;
                        value |= XGMAC_VLAN_DOVLTC;
+               } else {
+                       value &= ~XGMAC_VLAN_EDVLP;
+                       value &= ~XGMAC_VLAN_ESVL;
+                       value &= ~XGMAC_VLAN_DOVLTC;
                }
 
+               value &= ~XGMAC_VLAN_VID;
                writel(value | perfect_match, ioaddr + XGMAC_VLAN_TAG);
        } else {
                u32 value = readl(ioaddr + XGMAC_PACKET_FILTER);