diff options
| author | David E. O'Brien <obrien@FreeBSD.org> | 2003-11-13 20:55:53 +0000 |
|---|---|---|
| committer | David E. O'Brien <obrien@FreeBSD.org> | 2003-11-13 20:55:53 +0000 |
| commit | aa8255025ab0924083e32a0a72457566d8d6e7da (patch) | |
| tree | 9f53fad8ba546c1e709992d118c397465dd5b01f /sys/dev/my | |
| parent | 2e76d77fd0916092e6d3c4a78d678bd795cea12f (diff) | |
Notes
Diffstat (limited to 'sys/dev/my')
| -rw-r--r-- | sys/dev/my/if_my.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/sys/dev/my/if_my.c b/sys/dev/my/if_my.c index d580e9c4adb0..b1dffa8fa6ad 100644 --- a/sys/dev/my/if_my.c +++ b/sys/dev/my/if_my.c @@ -142,7 +142,7 @@ static void my_autoneg_mii(struct my_softc *, int, int); static void my_setmode_mii(struct my_softc *, int); static void my_getmode_mii(struct my_softc *); static void my_setcfg(struct my_softc *, int); -static u_int8_t my_calchash(caddr_t); +static u_int32_t my_mchash(caddr_t); static void my_setmulti(struct my_softc *); static void my_reset(struct my_softc *); static int my_list_rx_init(struct my_softc *); @@ -313,22 +313,20 @@ my_phy_writereg(struct my_softc * sc, int reg, int data) return; } -static u_int8_t -my_calchash(caddr_t addr) +static u_int32_t +my_mchash(caddr_t addr) { u_int32_t crc, carry; - int i, j; - u_int8_t c; + int idx, bit; + u_int8_t data; /* Compute CRC for the address value. */ crc = 0xFFFFFFFF; /* initial value */ - for (i = 0; i < 6; i++) { - c = *(addr + i); - for (j = 0; j < 8; j++) { - carry = ((crc & 0x80000000) ? 1 : 0) ^ (c & 0x01); + for (idx = 0; idx < 6; idx++) { + for (data = *addr++, bit = 0; bit < 8; bit++, data >>= 1) { + carry = ((crc & 0x80000000) ? 1 : 0) ^ (data & 0x01); crc <<= 1; - c >>= 1; if (carry) crc = (crc ^ 0x04c11db6) | carry; } @@ -381,7 +379,7 @@ my_setmulti(struct my_softc * sc) TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; - h = my_calchash(LLADDR((struct sockaddr_dl *) ifma->ifma_addr)); + h = my_mchash(LLADDR((struct sockaddr_dl *) ifma->ifma_addr)); if (h < 32) hashes[0] |= (1 << h); else |
