Skip to content

Commit

Permalink
lan9118: use inline net_crc32() and bitshift instead of compute_mcast…
Browse files Browse the repository at this point in the history
…_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>
  • Loading branch information
mcayland authored and jasowang committed Dec 22, 2017
1 parent 308913b commit eedeaee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hw/net/lan9118.c
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit eedeaee

Please sign in to comment.