Don't use caddr_t in mchash(). Also use C99 spellings over BSD ones.

Requested by:	bde,imp
This commit is contained in:
David E. O'Brien 2003-12-08 07:54:15 +00:00
parent a5b5101f5e
commit a55a017f42
28 changed files with 142 additions and 140 deletions

View File

@ -206,7 +206,7 @@ static void bge_ifmedia_sts (struct ifnet *, struct ifmediareq *);
static u_int8_t bge_eeprom_getbyte (struct bge_softc *, int, u_int8_t *); static u_int8_t bge_eeprom_getbyte (struct bge_softc *, int, u_int8_t *);
static int bge_read_eeprom (struct bge_softc *, caddr_t, int, int); static int bge_read_eeprom (struct bge_softc *, caddr_t, int, int);
static u_int32_t bge_mchash (caddr_t); static uint32_t bge_mchash (const uint8_t *);
static void bge_setmulti (struct bge_softc *); static void bge_setmulti (struct bge_softc *);
static void bge_handle_events (struct bge_softc *); static void bge_handle_events (struct bge_softc *);
@ -1130,13 +1130,13 @@ bge_init_tx_ring(sc)
#define BGE_POLY 0xEDB88320 #define BGE_POLY 0xEDB88320
static u_int32_t static uint32_t
bge_mchash(addr) bge_mchash(addr)
caddr_t addr; const uint8_t *addr;
{ {
u_int32_t crc; uint32_t crc;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -104,7 +104,7 @@ static u_short ed_pio_write_mbufs(struct ed_softc *, struct mbuf *, int);
static void ed_setrcr (struct ed_softc *); static void ed_setrcr (struct ed_softc *);
static u_int32_t ds_mchash (caddr_t addr); static uint32_t ds_mchash (const uint8_t *);
/* /*
* Interrupt conversion table for WD/SMC ASIC/83C584 * Interrupt conversion table for WD/SMC ASIC/83C584
@ -3531,14 +3531,14 @@ ed_setrcr(sc)
/* /*
* Compute crc for ethernet address * Compute crc for ethernet address
*/ */
static u_int32_t static uint32_t
ds_mchash(addr) ds_mchash(addr)
caddr_t addr; const uint8_t *addr;
{ {
#define ED_POLYNOMIAL 0x04c11db6 #define ED_POLYNOMIAL 0x04c11db6
register u_int32_t crc = 0xffffffff; register uint32_t crc = 0xffffffff;
register int carry, idx, bit; register int carry, idx, bit;
register u_char data; register uint8_t data;
for (idx = 6; --idx >= 0;) { for (idx = 6; --idx >= 0;) {
for (data = *addr++, bit = 8; --bit >= 0; data >>=1 ) { for (data = *addr++, bit = 8; --bit >= 0; data >>=1 ) {

View File

@ -2046,14 +2046,14 @@ fe_write_mbufs (struct fe_softc *sc, struct mbuf *m)
/* /*
* Compute hash value for an Ethernet address * Compute hash value for an Ethernet address
*/ */
static u_int32_t static uint32_t
fe_mchash (caddr_t addr) fe_mchash (const uint8_t *addr)
{ {
#define FE_POLY 0xEDB88320L #define FE_POLY 0xEDB88320L
u_long carry, crc = 0xFFFFFFFFL; uint32_t carry, crc = 0xFFFFFFFFL;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
for ( idx = ETHER_ADDR_LEN; --idx >= 0; ) { for ( idx = ETHER_ADDR_LEN; --idx >= 0; ) {
for (data = *addr++, bit = 8; --bit >= 0; data >>= 1) { for (data = *addr++, bit = 8; --bit >= 0; data >>= 1) {

View File

@ -149,7 +149,7 @@ static int lge_miibus_writereg(device_t, int, int, int);
static void lge_miibus_statchg(device_t); static void lge_miibus_statchg(device_t);
static void lge_setmulti(struct lge_softc *); static void lge_setmulti(struct lge_softc *);
static u_int32_t lge_mchash(caddr_t); static uint32_t lge_mchash(const uint8_t *);
static void lge_reset(struct lge_softc *); static void lge_reset(struct lge_softc *);
static int lge_list_rx_init(struct lge_softc *); static int lge_list_rx_init(struct lge_softc *);
static int lge_list_tx_init(struct lge_softc *); static int lge_list_tx_init(struct lge_softc *);
@ -367,13 +367,13 @@ lge_miibus_statchg(dev)
return; return;
} }
static u_int32_t static uint32_t
lge_mchash(addr) lge_mchash(addr)
caddr_t addr; const uint8_t *addr;
{ {
u_int32_t crc, carry; uint32_t crc, carry;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -189,13 +189,13 @@ lance_probe(struct lnc_softc *sc)
return (UNKNOWN); return (UNKNOWN);
} }
static __inline u_int32_t static __inline uint32_t
lnc_mchash(caddr_t ether_addr) lnc_mchash(const uint8_t *ether_addr)
{ {
#define LNC_POLYNOMIAL 0xEDB88320UL #define LNC_POLYNOMIAL 0xEDB88320UL
u_int32_t crc = 0xFFFFFFFFUL; uint32_t crc = 0xFFFFFFFF;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
for (idx = 0; idx < ETHER_ADDR_LEN; idx++) { for (idx = 0; idx < ETHER_ADDR_LEN; idx++) {
for (data = *ether_addr++, bit = 0; bit < MULTICAST_FILTER_LEN; bit++) { for (data = *ether_addr++, bit = 0; bit < MULTICAST_FILTER_LEN; bit++) {

View File

@ -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_setmode_mii(struct my_softc *, int);
static void my_getmode_mii(struct my_softc *); static void my_getmode_mii(struct my_softc *);
static void my_setcfg(struct my_softc *, int); static void my_setcfg(struct my_softc *, int);
static u_int32_t my_mchash(caddr_t); static uint32_t my_mchash(const uint8_t *);
static void my_setmulti(struct my_softc *); static void my_setmulti(struct my_softc *);
static void my_reset(struct my_softc *); static void my_reset(struct my_softc *);
static int my_list_rx_init(struct my_softc *); static int my_list_rx_init(struct my_softc *);
@ -313,12 +313,12 @@ my_phy_writereg(struct my_softc * sc, int reg, int data)
return; return;
} }
static u_int32_t static uint32_t
my_mchash(caddr_t addr) my_mchash(const uint8_t *addr)
{ {
u_int32_t crc, carry; uint32_t crc, carry;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -184,7 +184,7 @@ static int nge_miibus_writereg(device_t, int, int, int);
static void nge_miibus_statchg(device_t); static void nge_miibus_statchg(device_t);
static void nge_setmulti(struct nge_softc *); static void nge_setmulti(struct nge_softc *);
static u_int32_t nge_mchash(caddr_t); static uint32_t nge_mchash(const uint8_t *);
static void nge_reset(struct nge_softc *); static void nge_reset(struct nge_softc *);
static int nge_list_rx_init(struct nge_softc *); static int nge_list_rx_init(struct nge_softc *);
static int nge_list_tx_init(struct nge_softc *); static int nge_list_tx_init(struct nge_softc *);
@ -673,11 +673,11 @@ nge_miibus_statchg(dev)
static u_int32_t static u_int32_t
nge_mchash(addr) nge_mchash(addr)
caddr_t addr; const uint8_t *addr;
{ {
u_int32_t crc, carry; uint32_t crc, carry;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -225,7 +225,7 @@ static int re_miibus_readreg (device_t, int, int);
static int re_miibus_writereg (device_t, int, int, int); static int re_miibus_writereg (device_t, int, int, int);
static void re_miibus_statchg (device_t); static void re_miibus_statchg (device_t);
static u_int32_t re_mchash (caddr_t); static uint32_t re_mchash (const uint8_t *);
static void re_setmulti (struct rl_softc *); static void re_setmulti (struct rl_softc *);
static void re_reset (struct rl_softc *); static void re_reset (struct rl_softc *);
@ -575,13 +575,13 @@ re_miibus_statchg(dev)
/* /*
* Calculate CRC of a multicast group address, return the upper 6 bits. * Calculate CRC of a multicast group address, return the upper 6 bits.
*/ */
static u_int32_t static uint32_t
re_mchash(addr) re_mchash(addr)
caddr_t addr; const uint8_t *addr;
{ {
u_int32_t crc, carry; uint32_t crc, carry;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -159,7 +159,7 @@ static int sf_setvlan (struct sf_softc *, int, u_int32_t);
#endif #endif
static u_int8_t sf_read_eeprom (struct sf_softc *, int); static u_int8_t sf_read_eeprom (struct sf_softc *, int);
static u_int32_t sf_mchash (caddr_t); static uint32_t sf_mchash (const uint8_t *);
static int sf_miibus_readreg (device_t, int, int); static int sf_miibus_readreg (device_t, int, int);
static int sf_miibus_writereg (device_t, int, int, int); static int sf_miibus_writereg (device_t, int, int, int);
@ -260,11 +260,11 @@ csr_write_4(sc, reg, val)
static u_int32_t static u_int32_t
sf_mchash(addr) sf_mchash(addr)
caddr_t addr; const uint8_t *addr;
{ {
u_int32_t crc, carry; uint32_t crc, carry;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -224,7 +224,7 @@ static int sk_marv_miibus_writereg (struct sk_if_softc *, int, int,
int); int);
static void sk_marv_miibus_statchg (struct sk_if_softc *); static void sk_marv_miibus_statchg (struct sk_if_softc *);
static u_int32_t sk_mchash (caddr_t); static uint32_t sk_mchash (const uint8_t *);
static void sk_setfilt (struct sk_if_softc *, caddr_t, int); static void sk_setfilt (struct sk_if_softc *, caddr_t, int);
static void sk_setmulti (struct sk_if_softc *); static void sk_setmulti (struct sk_if_softc *);
@ -714,11 +714,11 @@ sk_marv_miibus_statchg(sc_if)
static u_int32_t static u_int32_t
sk_mchash(addr) sk_mchash(addr)
caddr_t addr; const uint8_t *addr;
{ {
u_int32_t crc; uint32_t crc;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -133,7 +133,7 @@ static void snwatchdog(struct ifnet *);
static void sn_setmcast(struct sn_softc *); static void sn_setmcast(struct sn_softc *);
static int sn_getmcf(struct arpcom *ac, u_char *mcf); static int sn_getmcf(struct arpcom *ac, u_char *mcf);
static uint32_t sn_mchash(const uint8_t *addr); static uint32_t sn_mchash(const uint8_t *);
/* I (GB) have been unlucky getting the hardware padding /* I (GB) have been unlucky getting the hardware padding
* to work properly. * to work properly.

View File

@ -101,7 +101,7 @@ static void epic_start_activity(epic_softc_t *);
static void epic_set_rx_mode(epic_softc_t *); static void epic_set_rx_mode(epic_softc_t *);
static void epic_set_tx_mode(epic_softc_t *); static void epic_set_tx_mode(epic_softc_t *);
static void epic_set_mc_table(epic_softc_t *); static void epic_set_mc_table(epic_softc_t *);
static u_int32_t tx_mchash(caddr_t); static uint32_t tx_mchash(const uint8_t *);
static int epic_read_eeprom(epic_softc_t *,u_int16_t); static int epic_read_eeprom(epic_softc_t *,u_int16_t);
static void epic_output_eepromw(epic_softc_t *, u_int16_t); static void epic_output_eepromw(epic_softc_t *, u_int16_t);
static u_int16_t epic_input_eepromw(epic_softc_t *); static u_int16_t epic_input_eepromw(epic_softc_t *);
@ -1425,13 +1425,13 @@ epic_set_mc_table(sc)
/* /*
* Synopsis: calculate EPIC's hash of multicast address. * Synopsis: calculate EPIC's hash of multicast address.
*/ */
static u_int32_t static uint32_t
tx_mchash(addr) tx_mchash(addr)
caddr_t addr; const uint8_t *addr;
{ {
u_int32_t crc, carry; uint32_t crc, carry;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -207,7 +207,7 @@ Static int aue_miibus_writereg(device_ptr_t, int, int, int);
Static void aue_miibus_statchg(device_ptr_t); Static void aue_miibus_statchg(device_ptr_t);
Static void aue_setmulti(struct aue_softc *); Static void aue_setmulti(struct aue_softc *);
Static u_int32_t aue_mchash(caddr_t); Static uint32_t aue_mchash(const uint8_t *);
Static void aue_reset(struct aue_softc *); Static void aue_reset(struct aue_softc *);
Static int aue_csr_read_1(struct aue_softc *, int); Static int aue_csr_read_1(struct aue_softc *, int);
@ -522,11 +522,11 @@ aue_miibus_statchg(device_ptr_t dev)
#define AUE_BITS 6 #define AUE_BITS 6
Static u_int32_t Static u_int32_t
aue_mchash(caddr_t addr) aue_mchash(const uint8_t *addr)
{ {
u_int32_t crc; uint32_t crc;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -140,7 +140,7 @@ Static int axe_ifmedia_upd(struct ifnet *);
Static void axe_ifmedia_sts(struct ifnet *, struct ifmediareq *); Static void axe_ifmedia_sts(struct ifnet *, struct ifmediareq *);
Static void axe_setmulti(struct axe_softc *); Static void axe_setmulti(struct axe_softc *);
Static u_int32_t axe_mchash(caddr_t); Static uint32_t axe_mchash(const uint8_t *);
Static device_method_t axe_methods[] = { Static device_method_t axe_methods[] = {
/* Device interface */ /* Device interface */
@ -313,12 +313,12 @@ axe_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
return; return;
} }
Static u_int32_t Static uint32_t
axe_mchash(caddr_t addr) axe_mchash(const uint8_t *addr)
{ {
u_int32_t crc, carry; uint32_t crc, carry;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -330,9 +330,9 @@ cue_getmac(struct cue_softc *sc, void *buf)
Static uint32_t Static uint32_t
cue_mchash(const uint8_t *addr) cue_mchash(const uint8_t *addr)
{ {
uint32_t crc; uint32_t crc;
int idx, bit; int idx, bit;
uint8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -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 int rue_miibus_writereg(device_ptr_t, int, int, int);
Static void rue_miibus_statchg(device_ptr_t); Static void rue_miibus_statchg(device_ptr_t);
Static u_int32_t rue_mchash(caddr_t); Static uint32_t rue_mchash(const uint8_t *);
Static void rue_setmulti(struct rue_softc *); Static void rue_setmulti(struct rue_softc *);
Static void rue_reset(struct rue_softc *); Static void rue_reset(struct rue_softc *);
@ -464,12 +464,12 @@ rue_miibus_statchg(device_ptr_t dev)
* Calculate CRC of a multicast group address, return the upper 6 bits. * Calculate CRC of a multicast group address, return the upper 6 bits.
*/ */
Static u_int32_t Static uint32_t
rue_mchash(caddr_t addr) rue_mchash(const uint8_t *addr)
{ {
u_int32_t crc, carry; uint32_t crc, carry;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -160,7 +160,7 @@ static int vr_miibus_writereg (device_t, int, int, int);
static void vr_miibus_statchg (device_t); static void vr_miibus_statchg (device_t);
static void vr_setcfg (struct vr_softc *, int); static void vr_setcfg (struct vr_softc *, int);
static u_int32_t vr_mchash (caddr_t); static uint32_t vr_mchash (const uint8_t *);
static void vr_setmulti (struct vr_softc *); static void vr_setmulti (struct vr_softc *);
static void vr_reset (struct vr_softc *); static void vr_reset (struct vr_softc *);
static int vr_list_rx_init (struct vr_softc *); static int vr_list_rx_init (struct vr_softc *);
@ -566,11 +566,11 @@ vr_miibus_statchg(dev)
*/ */
static u_int32_t static u_int32_t
vr_mchash(addr) vr_mchash(addr)
caddr_t addr; const uint8_t *addr;
{ {
u_int32_t crc, carry; uint32_t crc, carry;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -163,7 +163,7 @@ static void xe_enable_intr (struct xe_softc *scp);
static void xe_disable_intr (struct xe_softc *scp); static void xe_disable_intr (struct xe_softc *scp);
static void xe_set_multicast (struct xe_softc *scp); static void xe_set_multicast (struct xe_softc *scp);
static void xe_set_addr (struct xe_softc *scp, u_int8_t* addr, unsigned idx); static void xe_set_addr (struct xe_softc *scp, u_int8_t* addr, unsigned idx);
static void xe_mchash (struct xe_softc *scp, caddr_t addr); static void xe_mchash (struct xe_softc *scp, const uint8_t *addr);
static int xe_pio_write_packet (struct xe_softc *scp, struct mbuf *mbp); static int xe_pio_write_packet (struct xe_softc *scp, struct mbuf *mbp);
/* /*
@ -1412,10 +1412,10 @@ xe_set_addr(struct xe_softc *scp, u_int8_t* addr, unsigned idx) {
* address. * address.
*/ */
static void static void
xe_mchash(struct xe_softc* scp, caddr_t addr) { xe_mchash(struct xe_softc* scp, const uint8_t *addr) {
u_int32_t crc = 0xffffffff; uint32_t crc = 0xffffffff;
int idx, bit; int idx, bit;
u_int8_t carry, byte, data, crc31, hash; uint8_t carry, byte, data, crc31, hash;
/* Compute CRC of the address -- standard Ethernet CRC function */ /* Compute CRC of the address -- standard Ethernet CRC function */
for (data = *addr++, idx = 0; idx < 6; idx++, data >>= 1) { for (data = *addr++, idx = 0; idx < 6; idx++, data >>= 1) {

View File

@ -136,7 +136,7 @@ static void pcn_miibus_statchg (device_t);
static void pcn_setfilt (struct ifnet *); static void pcn_setfilt (struct ifnet *);
static void pcn_setmulti (struct pcn_softc *); static void pcn_setmulti (struct pcn_softc *);
static u_int32_t pcn_mchash (caddr_t); static uint32_t pcn_mchash (const uint8_t *);
static void pcn_reset (struct pcn_softc *); static void pcn_reset (struct pcn_softc *);
static int pcn_list_rx_init (struct pcn_softc *); static int pcn_list_rx_init (struct pcn_softc *);
static int pcn_list_tx_init (struct pcn_softc *); static int pcn_list_tx_init (struct pcn_softc *);
@ -310,11 +310,11 @@ pcn_miibus_statchg(dev)
static u_int32_t static u_int32_t
pcn_mchash(addr) pcn_mchash(addr)
caddr_t addr; const uint8_t *addr;
{ {
u_int32_t crc; uint32_t crc;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -206,7 +206,7 @@ static int rl_miibus_readreg (device_t, int, int);
static int rl_miibus_writereg (device_t, int, int, int); static int rl_miibus_writereg (device_t, int, int, int);
static void rl_miibus_statchg (device_t); static void rl_miibus_statchg (device_t);
static u_int32_t rl_mchash (caddr_t); static uint32_t rl_mchash (const uint8_t *);
static void rl_setmulti (struct rl_softc *); static void rl_setmulti (struct rl_softc *);
static void rl_reset (struct rl_softc *); static void rl_reset (struct rl_softc *);
static int rl_list_tx_init (struct rl_softc *); static int rl_list_tx_init (struct rl_softc *);
@ -737,11 +737,11 @@ rl_miibus_statchg(dev)
*/ */
static u_int32_t static u_int32_t
rl_mchash(addr) rl_mchash(addr)
caddr_t addr; const uint8_t *addr;
{ {
u_int32_t crc, carry; uint32_t crc, carry;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -159,7 +159,7 @@ static int sf_setvlan (struct sf_softc *, int, u_int32_t);
#endif #endif
static u_int8_t sf_read_eeprom (struct sf_softc *, int); static u_int8_t sf_read_eeprom (struct sf_softc *, int);
static u_int32_t sf_mchash (caddr_t); static uint32_t sf_mchash (const uint8_t *);
static int sf_miibus_readreg (device_t, int, int); static int sf_miibus_readreg (device_t, int, int);
static int sf_miibus_writereg (device_t, int, int, int); static int sf_miibus_writereg (device_t, int, int, int);
@ -260,11 +260,11 @@ csr_write_4(sc, reg, val)
static u_int32_t static u_int32_t
sf_mchash(addr) sf_mchash(addr)
caddr_t addr; const uint8_t *addr;
{ {
u_int32_t crc, carry; uint32_t crc, carry;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -155,7 +155,7 @@ static void sis_miibus_statchg (device_t);
static void sis_setmulti_sis (struct sis_softc *); static void sis_setmulti_sis (struct sis_softc *);
static void sis_setmulti_ns (struct sis_softc *); static void sis_setmulti_ns (struct sis_softc *);
static u_int32_t sis_mchash (struct sis_softc *, caddr_t); static uint32_t sis_mchash (struct sis_softc *, const uint8_t *);
static void sis_reset (struct sis_softc *); static void sis_reset (struct sis_softc *);
static int sis_list_rx_init (struct sis_softc *); static int sis_list_rx_init (struct sis_softc *);
static int sis_list_tx_init (struct sis_softc *); static int sis_list_tx_init (struct sis_softc *);
@ -839,11 +839,11 @@ sis_miibus_statchg(dev)
static u_int32_t static u_int32_t
sis_mchash(sc, addr) sis_mchash(sc, addr)
struct sis_softc *sc; struct sis_softc *sc;
caddr_t addr; const uint8_t *addr;
{ {
u_int32_t crc, carry; uint32_t crc, carry;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -224,7 +224,7 @@ static int sk_marv_miibus_writereg (struct sk_if_softc *, int, int,
int); int);
static void sk_marv_miibus_statchg (struct sk_if_softc *); static void sk_marv_miibus_statchg (struct sk_if_softc *);
static u_int32_t sk_mchash (caddr_t); static uint32_t sk_mchash (const uint8_t *);
static void sk_setfilt (struct sk_if_softc *, caddr_t, int); static void sk_setfilt (struct sk_if_softc *, caddr_t, int);
static void sk_setmulti (struct sk_if_softc *); static void sk_setmulti (struct sk_if_softc *);
@ -714,11 +714,11 @@ sk_marv_miibus_statchg(sc_if)
static u_int32_t static u_int32_t
sk_mchash(addr) sk_mchash(addr)
caddr_t addr; const uint8_t *addr;
{ {
u_int32_t crc; uint32_t crc;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -119,7 +119,7 @@ static void ste_miibus_statchg (device_t);
static int ste_eeprom_wait (struct ste_softc *); static int ste_eeprom_wait (struct ste_softc *);
static int ste_read_eeprom (struct ste_softc *, caddr_t, int, int, int); static int ste_read_eeprom (struct ste_softc *, caddr_t, int, int, int);
static void ste_wait (struct ste_softc *); static void ste_wait (struct ste_softc *);
static u_int32_t ste_mchash (caddr_t); static u_int8_t ste_calchash (caddr_t);
static void ste_setmulti (struct ste_softc *); static void ste_setmulti (struct ste_softc *);
static int ste_init_rx_list (struct ste_softc *); static int ste_init_rx_list (struct ste_softc *);
static void ste_init_tx_list (struct ste_softc *); static void ste_init_tx_list (struct ste_softc *);
@ -552,22 +552,24 @@ ste_read_eeprom(sc, dest, off, cnt, swap)
return(err ? 1 : 0); return(err ? 1 : 0);
} }
static u_int32_t static u_int8_t
ste_mchash(addr) ste_calchash(addr)
caddr_t addr; caddr_t addr;
{ {
u_int32_t crc, carry; u_int32_t crc, carry;
int idx, bit; int i, j;
u_int8_t data; u_int8_t c;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */
for (idx = 0; idx < 6; idx++) { for (i = 0; i < 6; i++) {
for (data = *addr++, bit = 0; bit < 8; bit++, data >>= 1) { c = *(addr + i);
carry = ((crc & 0x80000000) ? 1 : 0) ^ (data & 0x01); for (j = 0; j < 8; j++) {
carry = ((crc & 0x80000000) ? 1 : 0) ^ (c & 0x01);
crc <<= 1; crc <<= 1;
c >>= 1;
if (carry) if (carry)
crc = (crc ^ 0x04c11db6) | carry; crc = (crc ^ 0x04c11db6) | carry;
} }
@ -603,7 +605,7 @@ ste_setmulti(sc)
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK) if (ifma->ifma_addr->sa_family != AF_LINK)
continue; continue;
h = ste_mchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); h = ste_calchash(LLADDR((struct sockaddr_dl *)ifma->ifma_addr));
if (h < 32) if (h < 32)
hashes[0] |= (1 << h); hashes[0] |= (1 << h);
else else

View File

@ -298,7 +298,7 @@ static int tl_miibus_writereg (device_t, int, int, int);
static void tl_miibus_statchg (device_t); static void tl_miibus_statchg (device_t);
static void tl_setmode (struct tl_softc *, int); static void tl_setmode (struct tl_softc *, int);
static u_int32_t tl_mchash (caddr_t); static uint32_t tl_mchash (const uint8_t *);
static void tl_setmulti (struct tl_softc *); static void tl_setmulti (struct tl_softc *);
static void tl_setfilt (struct tl_softc *, caddr_t, int); static void tl_setfilt (struct tl_softc *, caddr_t, int);
static void tl_softreset (struct tl_softc *, int); static void tl_softreset (struct tl_softc *, int);
@ -887,11 +887,11 @@ tl_setmode(sc, media)
* Bytes 0-2 and 3-5 are symmetrical, so are folded together. Then * Bytes 0-2 and 3-5 are symmetrical, so are folded together. Then
* the folded 24-bit value is split into 6-bit portions and XOR'd. * the folded 24-bit value is split into 6-bit portions and XOR'd.
*/ */
static u_int32_t static uint32_t
tl_mchash(addr) tl_mchash(addr)
caddr_t addr; const uint8_t *addr;
{ {
int t; int t;
t = (addr[0] ^ addr[3]) << 16 | (addr[1] ^ addr[4]) << 8 | t = (addr[0] ^ addr[3]) << 16 | (addr[1] ^ addr[4]) << 8 |
(addr[2] ^ addr[5]); (addr[2] ^ addr[5]);

View File

@ -160,7 +160,7 @@ static int vr_miibus_writereg (device_t, int, int, int);
static void vr_miibus_statchg (device_t); static void vr_miibus_statchg (device_t);
static void vr_setcfg (struct vr_softc *, int); static void vr_setcfg (struct vr_softc *, int);
static u_int32_t vr_mchash (caddr_t); static uint32_t vr_mchash (const uint8_t *);
static void vr_setmulti (struct vr_softc *); static void vr_setmulti (struct vr_softc *);
static void vr_reset (struct vr_softc *); static void vr_reset (struct vr_softc *);
static int vr_list_rx_init (struct vr_softc *); static int vr_list_rx_init (struct vr_softc *);
@ -566,11 +566,11 @@ vr_miibus_statchg(dev)
*/ */
static u_int32_t static u_int32_t
vr_mchash(addr) vr_mchash(addr)
caddr_t addr; const uint8_t *addr;
{ {
u_int32_t crc, carry; uint32_t crc, carry;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -174,7 +174,7 @@ static int wb_mii_readreg (struct wb_softc *, struct wb_mii_frame *);
static int wb_mii_writereg (struct wb_softc *, struct wb_mii_frame *); static int wb_mii_writereg (struct wb_softc *, struct wb_mii_frame *);
static void wb_setcfg (struct wb_softc *, u_int32_t); static void wb_setcfg (struct wb_softc *, u_int32_t);
static u_int32_t wb_mchash (caddr_t); static uint32_t wb_mchash (const uint8_t *);
static void wb_setmulti (struct wb_softc *); static void wb_setmulti (struct wb_softc *);
static void wb_reset (struct wb_softc *); static void wb_reset (struct wb_softc *);
static void wb_fixmedia (struct wb_softc *); static void wb_fixmedia (struct wb_softc *);
@ -588,11 +588,11 @@ wb_miibus_statchg(dev)
static u_int32_t static u_int32_t
wb_mchash(addr) wb_mchash(addr)
caddr_t addr; const uint8_t *addr;
{ {
u_int32_t crc, carry; uint32_t crc, carry;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */

View File

@ -238,7 +238,7 @@ static int xl_mii_writereg (struct xl_softc *, struct xl_mii_frame *);
static void xl_setcfg (struct xl_softc *); static void xl_setcfg (struct xl_softc *);
static void xl_setmode (struct xl_softc *, int); static void xl_setmode (struct xl_softc *, int);
static u_int32_t xl_mchash (caddr_t); static uint32_t xl_mchash (const uint8_t *);
static void xl_setmulti (struct xl_softc *); static void xl_setmulti (struct xl_softc *);
static void xl_setmulti_hash (struct xl_softc *); static void xl_setmulti_hash (struct xl_softc *);
static void xl_reset (struct xl_softc *); static void xl_reset (struct xl_softc *);
@ -812,11 +812,11 @@ xl_read_eeprom(sc, dest, off, cnt, swap)
*/ */
static u_int32_t static u_int32_t
xl_mchash(addr) xl_mchash(addr)
caddr_t addr; const uint8_t *addr;
{ {
u_int32_t crc, carry; uint32_t crc, carry;
int idx, bit; int idx, bit;
u_int8_t data; uint8_t data;
/* Compute CRC for the address value. */ /* Compute CRC for the address value. */
crc = 0xFFFFFFFF; /* initial value */ crc = 0xFFFFFFFF; /* initial value */