summaryrefslogtreecommitdiffstats
path: root/sys/dev/hme
diff options
context:
space:
mode:
authornaddy <naddy@FreeBSD.org>2004-06-09 14:34:04 +0000
committernaddy <naddy@FreeBSD.org>2004-06-09 14:34:04 +0000
commit03b06cd9a3bb0e9d75237994d18bd6d3b6469ac1 (patch)
tree63c1a8adb963adf2b159557569195cbc8c219d33 /sys/dev/hme
parentd57aeb149e038b4931b3859597fe80119588eebc (diff)
downloadFreeBSD-src-03b06cd9a3bb0e9d75237994d18bd6d3b6469ac1.zip
FreeBSD-src-03b06cd9a3bb0e9d75237994d18bd6d3b6469ac1.tar.gz
Replace handrolled CRC calculation with ether_crc32_[lb]e().
Diffstat (limited to 'sys/dev/hme')
-rw-r--r--sys/dev/hme/if_hme.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/sys/dev/hme/if_hme.c b/sys/dev/hme/if_hme.c
index 218f131..ccf9fae 100644
--- a/sys/dev/hme/if_hme.c
+++ b/sys/dev/hme/if_hme.c
@@ -1405,7 +1405,6 @@ hme_setladrf(struct hme_softc *sc, int reenable)
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
struct ifmultiaddr *inm;
struct sockaddr_dl *sdl;
- u_char *cp;
u_int32_t crc;
u_int32_t hash[4];
u_int32_t macc;
@@ -1459,23 +1458,8 @@ hme_setladrf(struct hme_softc *sc, int reenable)
if (inm->ifma_addr->sa_family != AF_LINK)
continue;
sdl = (struct sockaddr_dl *)inm->ifma_addr;
- cp = LLADDR(sdl);
- crc = 0xffffffff;
- for (len = sdl->sdl_alen; --len >= 0;) {
- int octet = *cp++;
- int i;
-
-#define MC_POLY_LE 0xedb88320UL /* mcast crc, little endian */
- for (i = 0; i < 8; i++) {
- if ((crc & 1) ^ (octet & 1)) {
- crc >>= 1;
- crc ^= MC_POLY_LE;
- } else {
- crc >>= 1;
- }
- octet >>= 1;
- }
- }
+ crc = ether_crc32_le(sdl, ETHER_ADDR_LEN);
+
/* Just want the 6 most significant bits. */
crc >>= 26;
OpenPOWER on IntegriCloud