summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/if_aue.c12
-rw-r--r--sys/dev/usb/if_axe.c26
-rw-r--r--sys/dev/usb/if_cue.c14
-rw-r--r--sys/dev/usb/if_rue.c22
4 files changed, 34 insertions, 40 deletions
diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c
index bbb5669..0e7f1f5 100644
--- a/sys/dev/usb/if_aue.c
+++ b/sys/dev/usb/if_aue.c
@@ -1,4 +1,4 @@
-/*
+/*-
* Copyright (c) 1997, 1998, 1999, 2000
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
*
@@ -210,7 +210,7 @@ Static int aue_miibus_writereg(device_ptr_t, int, int, int);
Static void aue_miibus_statchg(device_ptr_t);
Static void aue_setmulti(struct aue_softc *);
-Static u_int32_t aue_crc(caddr_t);
+Static u_int32_t aue_mchash(caddr_t);
Static void aue_reset(struct aue_softc *);
Static int aue_csr_read_1(struct aue_softc *, int);
@@ -525,9 +525,11 @@ aue_miibus_statchg(device_ptr_t dev)
#define AUE_BITS 6
Static u_int32_t
-aue_crc(caddr_t addr)
+aue_mchash(caddr_t addr)
{
- u_int32_t idx, bit, data, crc;
+ u_int32_t crc;
+ int idx, bit;
+ u_int8_t data;
/* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */
@@ -569,7 +571,7 @@ aue_setmulti(struct aue_softc *sc)
{
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
- h = aue_crc(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
+ h = aue_mchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
AUE_SETBIT(sc, AUE_MAR + (h >> 3), 1 << (h & 0x7));
}
diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c
index b4df6e6..c71514f 100644
--- a/sys/dev/usb/if_axe.c
+++ b/sys/dev/usb/if_axe.c
@@ -28,7 +28,6 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
- *
*/
#include <sys/cdefs.h>
@@ -102,11 +101,6 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/if_axereg.h>
-#ifndef lint
-static const char rcsid[] =
- "$FreeBSD$";
-#endif
-
/*
* Various supported device vendors/products.
*/
@@ -146,7 +140,7 @@ Static int axe_ifmedia_upd(struct ifnet *);
Static void axe_ifmedia_sts(struct ifnet *, struct ifmediareq *);
Static void axe_setmulti(struct axe_softc *);
-Static u_int32_t axe_crc(caddr_t);
+Static u_int32_t axe_mchash(caddr_t);
Static device_method_t axe_methods[] = {
/* Device interface */
@@ -320,21 +314,19 @@ axe_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
}
Static u_int32_t
-axe_crc(caddr_t addr)
+axe_mchash(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;
}
@@ -369,7 +361,7 @@ axe_setmulti(struct axe_softc *sc)
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
- h = axe_crc(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
+ h = axe_mchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
hashtbl[h / 8] |= 1 << (h % 8);
}
diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c
index 54d887e..d4e2d77 100644
--- a/sys/dev/usb/if_cue.c
+++ b/sys/dev/usb/if_cue.c
@@ -116,7 +116,7 @@ Static void cue_watchdog(struct ifnet *);
Static void cue_shutdown(device_ptr_t);
Static void cue_setmulti(struct cue_softc *);
-Static u_int32_t cue_crc(const uint8_t *);
+Static u_int32_t cue_mchash(caddr_t);
Static void cue_reset(struct cue_softc *);
Static int cue_csr_read_1(struct cue_softc *, int);
@@ -331,9 +331,11 @@ cue_getmac(struct cue_softc *sc, void *buf)
#define CUE_BITS 9
Static u_int32_t
-cue_crc(const uint8_t *addr)
+cue_mchash(caddr_t addr)
{
- uint32_t idx, bit, data, crc;
+ u_int32_t crc;
+ int idx, bit;
+ u_int8_t data;
/* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */
@@ -376,7 +378,7 @@ cue_setmulti(struct cue_softc *sc)
{
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
- h = cue_crc(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
+ h = cue_mchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
sc->cue_mctab[h >> 3] |= 1 << (h & 0x7);
}
@@ -386,9 +388,9 @@ cue_setmulti(struct cue_softc *sc)
*/
if (ifp->if_flags & IFF_BROADCAST) {
#if __FreeBSD_version >= 500000
- h = cue_crc(ifp->if_broadcastaddr);
+ h = cue_mchash(ifp->if_broadcastaddr);
#else
- h = cue_crc(etherbroadcastaddr);
+ h = cue_mchash(etherbroadcastaddr);
#endif
sc->cue_mctab[h >> 3] |= 1 << (h & 0x7);
}
diff --git a/sys/dev/usb/if_rue.c b/sys/dev/usb/if_rue.c
index a769e6e..b8fc87a 100644
--- a/sys/dev/usb/if_rue.c
+++ b/sys/dev/usb/if_rue.c
@@ -103,7 +103,7 @@ __FBSDID("$FreeBSD$");
#include "miibus_if.h"
#ifdef USB_DEBUG
-static int ruedebug = 0;
+Static int ruedebug = 0;
SYSCTL_NODE(_hw_usb, OID_AUTO, rue, CTLFLAG_RW, 0, "USB rue");
SYSCTL_INT(_hw_usb_rue, OID_AUTO, debug, CTLFLAG_RW,
&ruedebug, 0, "rue debug level");
@@ -157,7 +157,7 @@ Static int rue_miibus_readreg(device_ptr_t, int, int);
Static int rue_miibus_writereg(device_ptr_t, int, int, int);
Static void rue_miibus_statchg(device_ptr_t);
-static u_int8_t rue_calchash(caddr_t);
+Static u_int32_t rue_mchash(caddr_t);
Static void rue_setmulti(struct rue_softc *);
Static void rue_reset(struct rue_softc *);
@@ -464,22 +464,20 @@ rue_miibus_statchg(device_ptr_t dev)
* Calculate CRC of a multicast group address, return the upper 6 bits.
*/
-static u_int8_t
-rue_calchash(caddr_t addr)
+Static u_int32_t
+rue_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;
}
@@ -529,7 +527,7 @@ rue_setmulti(struct rue_softc *sc)
{
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
- h = rue_calchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
+ h = rue_mchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
if (h < 32)
hashes[0] |= (1 << h);
else
OpenPOWER on IntegriCloud