diff mbox series

[3/6] net/ftgmac100: fix multicast hash routine

Message ID 20180529062838.20556-4-clg@kaod.org
State New
Headers show
Series ftgmac100 and NC-SI enhancements for the Aspeed SoC | expand

Commit Message

Cédric Le Goater May 29, 2018, 6:28 a.m. UTC
Based on the multicast hash calculation of the FTGMAC100 Linux driver.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 hw/net/ftgmac100.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Philippe Mathieu-Daudé May 29, 2018, 12:34 p.m. UTC | #1
On 05/29/2018 03:28 AM, Cédric Le Goater wrote:
> Based on the multicast hash calculation of the FTGMAC100 Linux driver.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  hw/net/ftgmac100.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c
> index 50af1222464a..fd7699b1c05e 100644
> --- a/hw/net/ftgmac100.c
> +++ b/hw/net/ftgmac100.c
> @@ -778,8 +778,8 @@ static int ftgmac100_filter(FTGMAC100State *s, const uint8_t *buf, size_t len)
>                  return 0;
>              }
>  
> -            /* TODO: this does not seem to work for ftgmac100 */
> -            mcast_idx = net_crc32(buf, ETH_ALEN) >> 26;
> +            mcast_idx = net_crc32_le(buf, ETH_ALEN);
> +            mcast_idx = (~(mcast_idx >> 2)) & 0x3f;
>              if (!(s->math[mcast_idx / 32] & (1 << (mcast_idx % 32)))) {
>                  return 0;
>              }
>
diff mbox series

Patch

diff --git a/hw/net/ftgmac100.c b/hw/net/ftgmac100.c
index 50af1222464a..fd7699b1c05e 100644
--- a/hw/net/ftgmac100.c
+++ b/hw/net/ftgmac100.c
@@ -778,8 +778,8 @@  static int ftgmac100_filter(FTGMAC100State *s, const uint8_t *buf, size_t len)
                 return 0;
             }
 
-            /* TODO: this does not seem to work for ftgmac100 */
-            mcast_idx = net_crc32(buf, ETH_ALEN) >> 26;
+            mcast_idx = net_crc32_le(buf, ETH_ALEN);
+            mcast_idx = (~(mcast_idx >> 2)) & 0x3f;
             if (!(s->math[mcast_idx / 32] & (1 << (mcast_idx % 32)))) {
                 return 0;
             }