diff options
author | Jason Wang <jasowang@redhat.com> | 2012-03-05 11:08:50 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2012-03-16 01:04:51 +0200 |
commit | 7fc8d918b9674c3e9233d6d25da2457345d414a0 (patch) | |
tree | a834bd8e25277d2f6d5018945f2b64dfb7d602fe /hw/rtl8139.c | |
parent | afe0a595356192d5f79703cf6462fcc112df007c (diff) |
net: move compute_mcast_idx() to net.h
Reduce duplicated codes.
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/rtl8139.c')
-rw-r--r-- | hw/rtl8139.c | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/hw/rtl8139.c b/hw/rtl8139.c index 1d5f78bbee..5b608f53ec 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -708,30 +708,6 @@ static void rtl8139_update_irq(RTL8139State *s) qemu_set_irq(s->dev.irq[0], (isr != 0)); } -#define POLYNOMIAL 0x04c11db6 - -/* From FreeBSD */ -/* XXX: optimize */ -static int compute_mcast_idx(const uint8_t *ep) -{ - uint32_t crc; - int carry, i, j; - uint8_t b; - - crc = 0xffffffff; - for (i = 0; i < 6; i++) { - b = *ep++; - for (j = 0; j < 8; j++) { - carry = ((crc & 0x80000000L) ? 1 : 0) ^ (b & 0x01); - crc <<= 1; - b >>= 1; - if (carry) - crc = ((crc ^ POLYNOMIAL) | carry); - } - } - return (crc >> 26); -} - static int rtl8139_RxWrap(RTL8139State *s) { /* wrapping enabled; assume 1.5k more buffer space if size < 65536 */ |