diff options
author | Anthony Liguori | 2012-04-10 15:21:58 +0200 |
---|---|---|
committer | Anthony Liguori | 2012-04-10 15:21:58 +0200 |
commit | 4e1957acc854b2f3f3068c75cef2a429f9b97011 (patch) | |
tree | cab3ca24ed0fc963cb693c0d440a9495a2cc47eb /net.c | |
parent | Merge remote-tracking branch 'qmp/queue/qmp' into staging (diff) | |
parent | rtl8139: do the network/host communication only in normal operating mode (diff) | |
download | qemu-4e1957acc854b2f3f3068c75cef2a429f9b97011.tar.gz qemu-4e1957acc854b2f3f3068c75cef2a429f9b97011.tar.xz qemu-4e1957acc854b2f3f3068c75cef2a429f9b97011.zip |
Merge commit 'ff71f2e8cacefae99179993204172bc65e4303df' into staging
* commit 'ff71f2e8cacefae99179993204172bc65e4303df': (21 commits)
rtl8139: do the network/host communication only in normal operating mode
rtl8139: correctly check the opmode
net: move compute_mcast_idx() to net.h
rtl8139: support byte read to TxStatus registers
rtl8139: remove unused marco
rtl8139: limit transmission buffer size in c+ mode
pci_regs: Add PCI_EXP_TYPE_PCIE_BRIDGE
virtio-net: add DATA_VALID flag
pci_bridge: upper 32 bit are long registers
pci: fix bridge IO/BASE
pcie: drop functionality moved to core
pci: set memory type for memory behind the bridge
pci: add standard bridge device
slotid: add slot id capability
shpc: standard hot plug controller
pci_bridge: user-friendly default bus name
pci: make another unused extern function static
pci: don't export an internal function
pci_regs: Fix value of PCI_EXP_TYPE_RC_EC.
pci: Do not check if a bus exist in pci_parse_devaddr.
...
Diffstat (limited to 'net.c')
-rw-r--r-- | net.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -1475,3 +1475,26 @@ int net_client_parse(QemuOptsList *opts_list, const char *optarg) default_net = 0; return 0; } + +/* From FreeBSD */ +/* XXX: optimize */ +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 >> 26; +} |