Revision 69f3ce78
b/hw/eepro100.c | ||
---|---|---|
322 | 322 |
0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
323 | 323 |
}; |
324 | 324 |
|
325 |
#define POLYNOMIAL 0x04c11db6 |
|
326 |
|
|
325 | 327 |
static E100PCIDeviceInfo *eepro100_get_class(EEPRO100State *s); |
326 | 328 |
|
329 |
/* From FreeBSD (locally modified). */ |
|
330 |
static unsigned e100_compute_mcast_idx(const uint8_t *ep) |
|
331 |
{ |
|
332 |
uint32_t crc; |
|
333 |
int carry, i, j; |
|
334 |
uint8_t b; |
|
335 |
|
|
336 |
crc = 0xffffffff; |
|
337 |
for (i = 0; i < 6; i++) { |
|
338 |
b = *ep++; |
|
339 |
for (j = 0; j < 8; j++) { |
|
340 |
carry = ((crc & 0x80000000L) ? 1 : 0) ^ (b & 0x01); |
|
341 |
crc <<= 1; |
|
342 |
b >>= 1; |
|
343 |
if (carry) { |
|
344 |
crc = ((crc ^ POLYNOMIAL) | carry); |
|
345 |
} |
|
346 |
} |
|
347 |
} |
|
348 |
return (crc & BITS(7, 2)) >> 2; |
|
349 |
} |
|
350 |
|
|
327 | 351 |
/* Read a 16 bit control/status (CSR) register. */ |
328 | 352 |
static uint16_t e100_read_reg2(EEPRO100State *s, E100RegisterOffset addr) |
329 | 353 |
{ |
... | ... | |
823 | 847 |
uint8_t multicast_addr[6]; |
824 | 848 |
pci_dma_read(&s->dev, s->cb_address + 10 + i, multicast_addr, 6); |
825 | 849 |
TRACE(OTHER, logout("multicast entry %s\n", nic_dump(multicast_addr, 6))); |
826 |
unsigned mcast_idx = compute_mcast_idx(multicast_addr); |
|
850 |
unsigned mcast_idx = e100_compute_mcast_idx(multicast_addr);
|
|
827 | 851 |
assert(mcast_idx < 64); |
828 | 852 |
s->mult[mcast_idx >> 3] |= (1 << (mcast_idx & 7)); |
829 | 853 |
} |
... | ... | |
1650 | 1674 |
if (s->configuration[21] & BIT(3)) { |
1651 | 1675 |
/* Multicast all bit is set, receive all multicast frames. */ |
1652 | 1676 |
} else { |
1653 |
unsigned mcast_idx = compute_mcast_idx(buf); |
|
1677 |
unsigned mcast_idx = e100_compute_mcast_idx(buf);
|
|
1654 | 1678 |
assert(mcast_idx < 64); |
1655 | 1679 |
if (s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7))) { |
1656 | 1680 |
/* Multicast frame is allowed in hash table. */ |
Also available in: Unified diff