mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Convert to if_foreach_llmaddr() KPI.
Reviewed by: hselasky
This commit is contained in:
parent
19a1980e10
commit
8fd18ef9b6
1 changed files with 13 additions and 12 deletions
|
|
@ -481,13 +481,23 @@ axe_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
|||
AXE_UNLOCK(sc);
|
||||
}
|
||||
|
||||
static u_int
|
||||
axe_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
|
||||
{
|
||||
uint8_t *hashtbl = arg;
|
||||
uint32_t h;
|
||||
|
||||
h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26;
|
||||
hashtbl[h / 8] |= 1 << (h % 8);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void
|
||||
axe_setmulti(struct usb_ether *ue)
|
||||
{
|
||||
struct axe_softc *sc = uether_getsc(ue);
|
||||
struct ifnet *ifp = uether_getifp(ue);
|
||||
struct ifmultiaddr *ifma;
|
||||
uint32_t h = 0;
|
||||
uint16_t rxmode;
|
||||
uint8_t hashtbl[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
|
|
@ -503,16 +513,7 @@ axe_setmulti(struct usb_ether *ue)
|
|||
}
|
||||
rxmode &= ~AXE_RXCMD_ALLMULTI;
|
||||
|
||||
if_maddr_rlock(ifp);
|
||||
CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
|
||||
{
|
||||
if (ifma->ifma_addr->sa_family != AF_LINK)
|
||||
continue;
|
||||
h = ether_crc32_be(LLADDR((struct sockaddr_dl *)
|
||||
ifma->ifma_addr), ETHER_ADDR_LEN) >> 26;
|
||||
hashtbl[h / 8] |= 1 << (h % 8);
|
||||
}
|
||||
if_maddr_runlock(ifp);
|
||||
if_foreach_llmaddr(ifp, axe_hash_maddr, &hashtbl);
|
||||
|
||||
axe_cmd(sc, AXE_CMD_WRITE_MCAST, 0, 0, (void *)&hashtbl);
|
||||
axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL);
|
||||
|
|
|
|||
Loading…
Reference in a new issue