summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2008-04-18 09:16:15 +0000
committerDamien Miller <djm@cvs.openbsd.org>2008-04-18 09:16:15 +0000
commit9490f7792ea055f8deb63b21074eb1e994861753 (patch)
tree6314ca9a7c3db1e6b3bf70254587530da5564b6c /sys/dev
parentadd7cd1933b616a68b7facc7786f42ec7a011711 (diff)
extend the if_ethersubr.c crc functions to support updating a running
crc in addition to the existing "oneshot" mode and use them to replace ieee80211_crc_update() with the new ether_crc32_le_update(). Saves 1k kernel bss + some code. Mark the new ether_crc32_[lb]e_update functions as __pure for a ~25x speedup (on my i386 at least). feedback and ok damien@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/if_wi.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/sys/dev/ic/if_wi.c b/sys/dev/ic/if_wi.c
index 072b4feacf2..cf37c4bb405 100644
--- a/sys/dev/ic/if_wi.c
+++ b/sys/dev/ic/if_wi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_wi.c,v 1.139 2008/04/17 19:26:51 damien Exp $ */
+/* $OpenBSD: if_wi.c,v 1.140 2008/04/18 09:16:14 djm Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -126,7 +126,7 @@ u_int32_t widebug = WIDEBUG;
#if !defined(lint) && !defined(__OpenBSD__)
static const char rcsid[] =
- "$OpenBSD: if_wi.c,v 1.139 2008/04/17 19:26:51 damien Exp $";
+ "$OpenBSD: if_wi.c,v 1.140 2008/04/18 09:16:14 djm Exp $";
#endif /* lint */
#ifdef foo
@@ -209,7 +209,6 @@ struct wi_funcs wi_func_io = {
int
wi_attach(struct wi_softc *sc, struct wi_funcs *funcs)
{
- extern void ieee80211_crc_init(void);
struct ieee80211com *ic;
struct ifnet *ifp;
struct wi_ltv_macaddr mac;
@@ -223,9 +222,6 @@ wi_attach(struct wi_softc *sc, struct wi_funcs *funcs)
sc->sc_funcs = funcs;
sc->wi_cmd_count = 500;
- /* make use of the WEP CRC table from net80211 */
- ieee80211_crc_init();
-
wi_reset(sc);
/* Read the station address. */
@@ -2306,9 +2302,7 @@ wi_do_hostencrypt(struct wi_softc *sc, caddr_t buf, int len)
dat += 4;
/* compute crc32 over data and encrypt */
- crc = ~0;
- crc = ieee80211_crc_update(crc, dat, len);
- crc = ~crc;
+ crc = ~ether_crc32_le(dat, len);
rc4_crypt(&ctx, dat, dat, len);
dat += len;
@@ -2353,9 +2347,7 @@ wi_do_hostdecrypt(struct wi_softc *sc, caddr_t buf, int len)
/* decrypt and compute crc32 over data */
rc4_crypt(&ctx, dat, dat, len);
- crc = ~0;
- crc = ieee80211_crc_update(crc, dat, len);
- crc = ~crc;
+ crc = ~ether_crc32_le(dat, len);
dat += len;
/* decrypt little-endian crc32 and verify */