summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2017-12-15 18:41:51 +0000
committerJason Wang <jasowang@redhat.com>2017-12-22 10:01:27 +0800
commiteedeaee73ac47341efca4c06e3ccb0029ee9332f (patch)
treeb3e05b8fbb3707f27871c08f7812a804cd694ad6
parent308913bb431104f34f5c2e35eaaf297ff3e8ec7b (diff)
downloadfocaccia-qemu-eedeaee73ac47341efca4c06e3ccb0029ee9332f.tar.gz
focaccia-qemu-eedeaee73ac47341efca4c06e3ccb0029ee9332f.zip
lan9118: use inline net_crc32() and bitshift instead of compute_mcast_idx()
This makes it much easier to compare the multicast CRC calculation endian and
bitshift against the Linux driver implementation.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Jason Wang <jasowang@redhat.com>
-rw-r--r--hw/net/lan9118.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c
index 3db8937cac..b9032dac59 100644
--- a/hw/net/lan9118.c
+++ b/hw/net/lan9118.c
@@ -13,6 +13,7 @@
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "net/net.h"
+#include "net/eth.h"
 #include "hw/devices.h"
 #include "sysemu/sysemu.h"
 #include "hw/ptimer.h"
@@ -504,7 +505,7 @@ static int lan9118_filter(lan9118_state *s, const uint8_t *addr)
         }
     } else {
         /* Hash matching  */
-        hash = compute_mcast_idx(addr);
+        hash = net_crc32(addr, ETH_ALEN) >> 26;
         if (hash & 0x20) {
             return (s->mac_hashh >> (hash & 0x1f)) & 1;
         } else {