diff options
author | Christian Weisgerber <naddy@FreeBSD.org> | 2004-06-09 14:34:04 +0000 |
---|---|---|
committer | Christian Weisgerber <naddy@FreeBSD.org> | 2004-06-09 14:34:04 +0000 |
commit | 0e939c0ceab8e6f6421a2ccc1501f6d3fabd118f (patch) | |
tree | 63c1a8adb963adf2b159557569195cbc8c219d33 /sys/dev/sn | |
parent | 6c27c6039b0c96613aaca7a958e18ab9cd1778f6 (diff) | |
download | src-0e939c0ceab8e6f6421a2ccc1501f6d3fabd118f.tar.gz src-0e939c0ceab8e6f6421a2ccc1501f6d3fabd118f.zip |
Replace handrolled CRC calculation with ether_crc32_[lb]e().
Notes
Notes:
svn path=/head/; revision=130270
Diffstat (limited to 'sys/dev/sn')
-rw-r--r-- | sys/dev/sn/if_sn.c | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/sys/dev/sn/if_sn.c b/sys/dev/sn/if_sn.c index ba2e413c3505..ed8fcbb8dc8b 100644 --- a/sys/dev/sn/if_sn.c +++ b/sys/dev/sn/if_sn.c @@ -133,7 +133,6 @@ static void snwatchdog(struct ifnet *); static void sn_setmcast(struct sn_softc *); static int sn_getmcf(struct arpcom *ac, u_char *mcf); -static uint32_t sn_mchash(const uint8_t *); /* I (GB) have been unlucky getting the hardware padding * to work properly. @@ -1417,8 +1416,8 @@ sn_getmcf(struct arpcom *ac, uint8_t *mcf) TAILQ_FOREACH(ifma, &ac->ac_if.if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) return 0; - index = sn_mchash( - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)) & 0x3f; + index = ether_crc32_le(LLADDR((struct sockaddr_dl *) + ifma->ifma_addr), ETHER_ADDR_LEN) & 0x3f; index2 = 0; for (i = 0; i < 6; i++) { index2 <<= 1; @@ -1429,22 +1428,3 @@ sn_getmcf(struct arpcom *ac, uint8_t *mcf) } return 1; /* use multicast filter */ } - -static uint32_t -sn_mchash(const uint8_t *addr) -{ - const uint32_t poly = 0xedb88320; - uint32_t crc; - int idx, bit; - uint8_t data; - - /* Compute CRC for the address value. */ - crc = 0xFFFFFFFF; /* initial value */ - - for (idx = 0; idx < ETHER_ADDR_LEN; idx++) { - for (data = *addr++, bit = 0; bit < 8; bit++, data >>= 1) { - crc = (crc >> 1)^(((crc ^ data) & 0x01) ? poly : 0); - } - } - return crc; -} |