summaryrefslogtreecommitdiff
path: root/hw/eepro100.c
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2012-03-05 11:08:50 +0800
committerMichael S. Tsirkin <mst@redhat.com>2012-03-16 01:04:51 +0200
commit7fc8d918b9674c3e9233d6d25da2457345d414a0 (patch)
treea834bd8e25277d2f6d5018945f2b64dfb7d602fe /hw/eepro100.c
parentafe0a595356192d5f79703cf6462fcc112df007c (diff)
downloadqemu-7fc8d918b9674c3e9233d6d25da2457345d414a0.tar.gz
qemu-7fc8d918b9674c3e9233d6d25da2457345d414a0.tar.bz2
qemu-7fc8d918b9674c3e9233d6d25da2457345d414a0.zip
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/eepro100.c')
-rw-r--r--hw/eepro100.c25
1 files changed, 0 insertions, 25 deletions
diff --git a/hw/eepro100.c b/hw/eepro100.c
index e3ba71974e..02e6f7ef31 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -322,33 +322,8 @@ static const uint16_t eepro100_mdi_mask[] = {
0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
};
-#define POLYNOMIAL 0x04c11db6
-
static E100PCIDeviceInfo *eepro100_get_class(EEPRO100State *s);
-/* From FreeBSD */
-/* XXX: optimize */
-static unsigned 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 & BITS(7, 2)) >> 2;
-}
-
/* Read a 16 bit control/status (CSR) register. */
static uint16_t e100_read_reg2(EEPRO100State *s, E100RegisterOffset addr)
{