summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_ste.c
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/pci/if_ste.c
parentd57aeb149e038b4931b3859597fe80119588eebc (diff)
downloadFreeBSD-src-03b06cd9a3bb0e9d75237994d18bd6d3b6469ac1.zip
FreeBSD-src-03b06cd9a3bb0e9d75237994d18bd6d3b6469ac1.tar.gz
Replace handrolled CRC calculation with ether_crc32_[lb]e().
Diffstat (limited to 'sys/pci/if_ste.c')
-rw-r--r--sys/pci/if_ste.c31
1 files changed, 2 insertions, 29 deletions
diff --git a/sys/pci/if_ste.c b/sys/pci/if_ste.c
index c1e60d1..4cd92fc 100644
--- a/sys/pci/if_ste.c
+++ b/sys/pci/if_ste.c
@@ -122,7 +122,6 @@ static void ste_miibus_statchg (device_t);
static int ste_eeprom_wait (struct ste_softc *);
static int ste_read_eeprom (struct ste_softc *, caddr_t, int, int, int);
static void ste_wait (struct ste_softc *);
-static u_int8_t ste_calchash (caddr_t);
static void ste_setmulti (struct ste_softc *);
static int ste_init_rx_list (struct ste_softc *);
static void ste_init_tx_list (struct ste_softc *);
@@ -560,33 +559,6 @@ ste_read_eeprom(sc, dest, off, cnt, swap)
return(err ? 1 : 0);
}
-static u_int8_t
-ste_calchash(addr)
- caddr_t addr;
-{
-
- u_int32_t crc, carry;
- int i, j;
- u_int8_t c;
-
- /* 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);
- crc <<= 1;
- c >>= 1;
- if (carry)
- crc = (crc ^ 0x04c11db6) | carry;
- }
- }
-
- /* return the filter bit position */
- return(crc & 0x0000003F);
-}
-
static void
ste_setmulti(sc)
struct ste_softc *sc;
@@ -613,7 +585,8 @@ ste_setmulti(sc)
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
- h = ste_calchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
+ h = ether_crc32_be(LLADDR((struct sockaddr_dl *)
+ ifma->ifma_addr), ETHER_ADDR_LEN) & 0x3F;
if (h < 32)
hashes[0] |= (1 << h);
else
OpenPOWER on IntegriCloud