* [PATCH net 1/1] net: fec: fix multicast filtering hardware setup
@ 2017-02-13 2:01 Andy Duan
2017-02-14 17:15 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Andy Duan @ 2017-02-13 2:01 UTC (permalink / raw)
To: davem; +Cc: netdev, festevam, stephen, fugang.duan
From: Rui Sousa <rui.sousa@nxp.com>
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: Rui Sousa <rui.sousa@nxp.com>
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
---
drivers/net/ethernet/freescale/fec_main.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 2cc552d..91a1664 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2910,6 +2910,7 @@ static void set_multicast_list(struct net_device *ndev)
struct netdev_hw_addr *ha;
unsigned int i, bit, data, crc, tmp;
unsigned char hash;
+ unsigned int hash_high = 0, hash_low = 0;
if (ndev->flags & IFF_PROMISC) {
tmp = readl(fep->hwp + FEC_R_CNTRL);
@@ -2932,11 +2933,7 @@ static void set_multicast_list(struct net_device *ndev)
return;
}
- /* Clear filter and add the addresses in hash register
- */
- writel(0, fep->hwp + FEC_GRP_HASH_TABLE_HIGH);
- writel(0, fep->hwp + FEC_GRP_HASH_TABLE_LOW);
-
+ /* Add the addresses in hash register */
netdev_for_each_mc_addr(ha, ndev) {
/* calculate crc32 value of mac address */
crc = 0xffffffff;
@@ -2954,16 +2951,14 @@ static void set_multicast_list(struct net_device *ndev)
*/
hash = (crc >> (32 - FEC_HASH_BITS)) & 0x3f;
- if (hash > 31) {
- tmp = readl(fep->hwp + FEC_GRP_HASH_TABLE_HIGH);
- tmp |= 1 << (hash - 32);
- writel(tmp, fep->hwp + FEC_GRP_HASH_TABLE_HIGH);
- } else {
- tmp = readl(fep->hwp + FEC_GRP_HASH_TABLE_LOW);
- tmp |= 1 << hash;
- writel(tmp, fep->hwp + FEC_GRP_HASH_TABLE_LOW);
- }
+ if (hash > 31)
+ hash_high |= 1 << (hash - 32);
+ else
+ hash_low |= 1 << hash;
}
+
+ 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. */
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH net 1/1] net: fec: fix multicast filtering hardware setup
@ 2017-02-10 5:54 Andy Duan
2017-02-10 21:19 ` Fabio Estevam
0 siblings, 1 reply; 5+ messages in thread
From: Andy Duan @ 2017-02-10 5:54 UTC (permalink / raw)
To: davem; +Cc: netdev, stephen, fugang.duan
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: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Rui Sousa <rui.sousa@nxp.com>
---
drivers/net/ethernet/freescale/fec_main.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 2cc552d..91a1664 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2910,6 +2910,7 @@ static void set_multicast_list(struct net_device *ndev)
struct netdev_hw_addr *ha;
unsigned int i, bit, data, crc, tmp;
unsigned char hash;
+ unsigned int hash_high = 0, hash_low = 0;
if (ndev->flags & IFF_PROMISC) {
tmp = readl(fep->hwp + FEC_R_CNTRL);
@@ -2932,11 +2933,7 @@ static void set_multicast_list(struct net_device *ndev)
return;
}
- /* Clear filter and add the addresses in hash register
- */
- writel(0, fep->hwp + FEC_GRP_HASH_TABLE_HIGH);
- writel(0, fep->hwp + FEC_GRP_HASH_TABLE_LOW);
-
+ /* Add the addresses in hash register */
netdev_for_each_mc_addr(ha, ndev) {
/* calculate crc32 value of mac address */
crc = 0xffffffff;
@@ -2954,16 +2951,14 @@ static void set_multicast_list(struct net_device *ndev)
*/
hash = (crc >> (32 - FEC_HASH_BITS)) & 0x3f;
- if (hash > 31) {
- tmp = readl(fep->hwp + FEC_GRP_HASH_TABLE_HIGH);
- tmp |= 1 << (hash - 32);
- writel(tmp, fep->hwp + FEC_GRP_HASH_TABLE_HIGH);
- } else {
- tmp = readl(fep->hwp + FEC_GRP_HASH_TABLE_LOW);
- tmp |= 1 << hash;
- writel(tmp, fep->hwp + FEC_GRP_HASH_TABLE_LOW);
- }
+ if (hash > 31)
+ hash_high |= 1 << (hash - 32);
+ else
+ hash_low |= 1 << hash;
}
+
+ 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. */
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net 1/1] net: fec: fix multicast filtering hardware setup
2017-02-10 5:54 Andy Duan
@ 2017-02-10 21:19 ` Fabio Estevam
2017-02-13 1:51 ` Andy Duan
0 siblings, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2017-02-10 21:19 UTC (permalink / raw)
To: Andy Duan; +Cc: David S. Miller, netdev@vger.kernel.org, Stephen Hemminger
On Fri, Feb 10, 2017 at 3:54 AM, Andy Duan <fugang.duan@nxp.com> wrote:
> 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: Fugang Duan <fugang.duan@nxp.com>
> Signed-off-by: Rui Sousa <rui.sousa@nxp.com>
It seems you missed to put Rui's name in the From: field.
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH net 1/1] net: fec: fix multicast filtering hardware setup
2017-02-10 21:19 ` Fabio Estevam
@ 2017-02-13 1:51 ` Andy Duan
0 siblings, 0 replies; 5+ messages in thread
From: Andy Duan @ 2017-02-13 1:51 UTC (permalink / raw)
To: Fabio Estevam; +Cc: David S. Miller, netdev@vger.kernel.org, Stephen Hemminger
From: Fabio Estevam <festevam@gmail.com> Sent: Saturday, February 11, 2017 5:20 AM
>To: Andy Duan <fugang.duan@nxp.com>
>Cc: David S. Miller <davem@davemloft.net>; netdev@vger.kernel.org;
>Stephen Hemminger <stephen@networkplumber.org>
>Subject: Re: [PATCH net 1/1] net: fec: fix multicast filtering hardware setup
>
>On Fri, Feb 10, 2017 at 3:54 AM, Andy Duan <fugang.duan@nxp.com> wrote:
>> 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: Fugang Duan <fugang.duan@nxp.com>
>> Signed-off-by: Rui Sousa <rui.sousa@nxp.com>
>
>It seems you missed to put Rui's name in the From: field.
I did some change base on original patch and merge into net tree.
Forget to change thr FR field, send it again, not V2 version.
Regards,
Andy
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-02-14 17:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-13 2:01 [PATCH net 1/1] net: fec: fix multicast filtering hardware setup Andy Duan
2017-02-14 17:15 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2017-02-10 5:54 Andy Duan
2017-02-10 21:19 ` Fabio Estevam
2017-02-13 1:51 ` Andy Duan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).