summaryrefslogtreecommitdiffstats
path: root/sys/dev/re/if_re.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/re/if_re.c')
-rw-r--r--sys/dev/re/if_re.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c
index 5881f39..cb6331b 100644
--- a/sys/dev/re/if_re.c
+++ b/sys/dev/re/if_re.c
@@ -225,7 +225,7 @@ static int re_miibus_readreg (device_t, int, int);
static int re_miibus_writereg (device_t, int, int, int);
static void re_miibus_statchg (device_t);
-static u_int8_t re_calchash (caddr_t);
+static u_int32_t re_mchash (caddr_t);
static void re_setmulti (struct rl_softc *);
static void re_reset (struct rl_softc *);
@@ -574,23 +574,21 @@ re_miibus_statchg(dev)
/*
* Calculate CRC of a multicast group address, return the upper 6 bits.
*/
-static u_int8_t
-re_calchash(addr)
- caddr_t addr;
+static u_int32_t
+re_mchash(addr)
+ caddr_t addr;
{
- u_int32_t crc, carry;
- int i, j;
- u_int8_t c;
+ u_int32_t crc, carry;
+ 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;
}
@@ -634,7 +632,7 @@ re_setmulti(sc)
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
- h = re_calchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
+ h = re_mchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
if (h < 32)
hashes[0] |= (1 << h);
else
OpenPOWER on IntegriCloud