Commit 01f8902b authored by Rui Sousa's avatar Rui Sousa Committed by David S. Miller

net: fec: fix multicast filtering hardware setup

Fix hardware setup of multicast address hash:
- Never clear the hardware hash (to avoid packet loss)
- Construct the hash register values in software and then write once
to hardware
Signed-off-by: default avatarRui Sousa <rui.sousa@nxp.com>
Signed-off-by: default avatarFugang Duan <fugang.duan@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 144adc65
...@@ -2910,6 +2910,7 @@ static void set_multicast_list(struct net_device *ndev) ...@@ -2910,6 +2910,7 @@ static void set_multicast_list(struct net_device *ndev)
struct netdev_hw_addr *ha; struct netdev_hw_addr *ha;
unsigned int i, bit, data, crc, tmp; unsigned int i, bit, data, crc, tmp;
unsigned char hash; unsigned char hash;
unsigned int hash_high = 0, hash_low = 0;
if (ndev->flags & IFF_PROMISC) { if (ndev->flags & IFF_PROMISC) {
tmp = readl(fep->hwp + FEC_R_CNTRL); tmp = readl(fep->hwp + FEC_R_CNTRL);
...@@ -2932,11 +2933,7 @@ static void set_multicast_list(struct net_device *ndev) ...@@ -2932,11 +2933,7 @@ static void set_multicast_list(struct net_device *ndev)
return; return;
} }
/* Clear filter and add the addresses in hash register /* Add the addresses in hash register */
*/
writel(0, fep->hwp + FEC_GRP_HASH_TABLE_HIGH);
writel(0, fep->hwp + FEC_GRP_HASH_TABLE_LOW);
netdev_for_each_mc_addr(ha, ndev) { netdev_for_each_mc_addr(ha, ndev) {
/* calculate crc32 value of mac address */ /* calculate crc32 value of mac address */
crc = 0xffffffff; crc = 0xffffffff;
...@@ -2954,16 +2951,14 @@ static void set_multicast_list(struct net_device *ndev) ...@@ -2954,16 +2951,14 @@ static void set_multicast_list(struct net_device *ndev)
*/ */
hash = (crc >> (32 - FEC_HASH_BITS)) & 0x3f; hash = (crc >> (32 - FEC_HASH_BITS)) & 0x3f;
if (hash > 31) { if (hash > 31)
tmp = readl(fep->hwp + FEC_GRP_HASH_TABLE_HIGH); hash_high |= 1 << (hash - 32);
tmp |= 1 << (hash - 32); else
writel(tmp, fep->hwp + FEC_GRP_HASH_TABLE_HIGH); hash_low |= 1 << hash;
} else {
tmp = readl(fep->hwp + FEC_GRP_HASH_TABLE_LOW);
tmp |= 1 << hash;
writel(tmp, fep->hwp + FEC_GRP_HASH_TABLE_LOW);
}
} }
writel(hash_high, fep->hwp + FEC_GRP_HASH_TABLE_HIGH);
writel(hash_low, fep->hwp + FEC_GRP_HASH_TABLE_LOW);
} }
/* Set a MAC change in hardware. */ /* Set a MAC change in hardware. */
......
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