Convert to if_foreach_llmaddr() KPI.
This commit is contained in:
parent
36581f8254
commit
57cc02c62e
@ -974,13 +974,24 @@ ffec_get_hwaddr(struct ffec_softc *sc, uint8_t *hwaddr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static u_int
|
||||||
|
ffec_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
|
||||||
|
{
|
||||||
|
uint64_t *ghash = arg;
|
||||||
|
uint32_t crc;
|
||||||
|
|
||||||
|
/* 6 bits from MSB in LE CRC32 are used for hash. */
|
||||||
|
crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN);
|
||||||
|
*ghash |= 1LLU << (((uint8_t *)&crc)[3] >> 2);
|
||||||
|
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ffec_setup_rxfilter(struct ffec_softc *sc)
|
ffec_setup_rxfilter(struct ffec_softc *sc)
|
||||||
{
|
{
|
||||||
struct ifnet *ifp;
|
struct ifnet *ifp;
|
||||||
struct ifmultiaddr *ifma;
|
|
||||||
uint8_t *eaddr;
|
uint8_t *eaddr;
|
||||||
uint32_t crc;
|
|
||||||
uint64_t ghash, ihash;
|
uint64_t ghash, ihash;
|
||||||
|
|
||||||
FFEC_ASSERT_LOCKED(sc);
|
FFEC_ASSERT_LOCKED(sc);
|
||||||
@ -994,16 +1005,7 @@ ffec_setup_rxfilter(struct ffec_softc *sc)
|
|||||||
ghash = 0xffffffffffffffffLLU;
|
ghash = 0xffffffffffffffffLLU;
|
||||||
else {
|
else {
|
||||||
ghash = 0;
|
ghash = 0;
|
||||||
if_maddr_rlock(ifp);
|
if_foreach_llmaddr(ifp, ffec_hash_maddr, &ghash);
|
||||||
CK_STAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) {
|
|
||||||
if (ifma->ifma_addr->sa_family != AF_LINK)
|
|
||||||
continue;
|
|
||||||
/* 6 bits from MSB in LE CRC32 are used for hash. */
|
|
||||||
crc = ether_crc32_le(LLADDR((struct sockaddr_dl *)
|
|
||||||
ifma->ifma_addr), ETHER_ADDR_LEN);
|
|
||||||
ghash |= 1LLU << (((uint8_t *)&crc)[3] >> 2);
|
|
||||||
}
|
|
||||||
if_maddr_runlock(ifp);
|
|
||||||
}
|
}
|
||||||
WR4(sc, FEC_GAUR_REG, (uint32_t)(ghash >> 32));
|
WR4(sc, FEC_GAUR_REG, (uint32_t)(ghash >> 32));
|
||||||
WR4(sc, FEC_GALR_REG, (uint32_t)ghash);
|
WR4(sc, FEC_GALR_REG, (uint32_t)ghash);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user