Commit f79bfda3 authored by Jose Abreu's avatar Jose Abreu Committed by David S. Miller

net: stmmac: dwmac4: Always update the MAC Hash Filter

We need to always update the MAC Hash Filter so that previous entries
are invalidated.

Found out while running stmmac selftests.

Fixes: b8ef7020 ("net: stmmac: add support for hash table size 128/256 in dwmac4")
Signed-off-by: default avatarJose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 432439fe
...@@ -401,8 +401,11 @@ static void dwmac4_set_filter(struct mac_device_info *hw, ...@@ -401,8 +401,11 @@ static void dwmac4_set_filter(struct mac_device_info *hw,
int numhashregs = (hw->multicast_filter_bins >> 5); int numhashregs = (hw->multicast_filter_bins >> 5);
int mcbitslog2 = hw->mcast_bits_log2; int mcbitslog2 = hw->mcast_bits_log2;
unsigned int value; unsigned int value;
u32 mc_filter[8];
int i; int i;
memset(mc_filter, 0, sizeof(mc_filter));
value = readl(ioaddr + GMAC_PACKET_FILTER); value = readl(ioaddr + GMAC_PACKET_FILTER);
value &= ~GMAC_PACKET_FILTER_HMC; value &= ~GMAC_PACKET_FILTER_HMC;
value &= ~GMAC_PACKET_FILTER_HPF; value &= ~GMAC_PACKET_FILTER_HPF;
...@@ -416,16 +419,13 @@ static void dwmac4_set_filter(struct mac_device_info *hw, ...@@ -416,16 +419,13 @@ static void dwmac4_set_filter(struct mac_device_info *hw,
/* Pass all multi */ /* Pass all multi */
value |= GMAC_PACKET_FILTER_PM; value |= GMAC_PACKET_FILTER_PM;
/* Set all the bits of the HASH tab */ /* Set all the bits of the HASH tab */
for (i = 0; i < numhashregs; i++) memset(mc_filter, 0xff, sizeof(mc_filter));
writel(0xffffffff, ioaddr + GMAC_HASH_TAB(i));
} else if (!netdev_mc_empty(dev)) { } else if (!netdev_mc_empty(dev)) {
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
u32 mc_filter[8];
/* Hash filter for multicast */ /* Hash filter for multicast */
value |= GMAC_PACKET_FILTER_HMC; value |= GMAC_PACKET_FILTER_HMC;
memset(mc_filter, 0, sizeof(mc_filter));
netdev_for_each_mc_addr(ha, dev) { netdev_for_each_mc_addr(ha, dev) {
/* The upper n bits of the calculated CRC are used to /* The upper n bits of the calculated CRC are used to
* index the contents of the hash table. The number of * index the contents of the hash table. The number of
...@@ -440,9 +440,10 @@ static void dwmac4_set_filter(struct mac_device_info *hw, ...@@ -440,9 +440,10 @@ static void dwmac4_set_filter(struct mac_device_info *hw,
*/ */
mc_filter[bit_nr >> 5] |= (1 << (bit_nr & 0x1f)); mc_filter[bit_nr >> 5] |= (1 << (bit_nr & 0x1f));
} }
}
for (i = 0; i < numhashregs; i++) for (i = 0; i < numhashregs; i++)
writel(mc_filter[i], ioaddr + GMAC_HASH_TAB(i)); writel(mc_filter[i], ioaddr + GMAC_HASH_TAB(i));
}
value |= GMAC_PACKET_FILTER_HPF; value |= GMAC_PACKET_FILTER_HPF;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment