diff options
| author | Gleb Smirnoff <glebius@FreeBSD.org> | 2019-10-21 18:12:36 +0000 |
|---|---|---|
| committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2019-10-21 18:12:36 +0000 |
| commit | 5c973840f12e9b1a76acbb53d8d37a6584f2606f (patch) | |
| tree | a0e1497a98c21ab79f7e4256f6a9008be5bc120b /sys/dev/tsec | |
| parent | bc0bdf25c7c130ec04b94cbba427b993cf9fe820 (diff) | |
Notes
Diffstat (limited to 'sys/dev/tsec')
| -rw-r--r-- | sys/dev/tsec/if_tsec.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/sys/dev/tsec/if_tsec.c b/sys/dev/tsec/if_tsec.c index 701d9abbbb41..321df50111e0 100644 --- a/sys/dev/tsec/if_tsec.c +++ b/sys/dev/tsec/if_tsec.c @@ -1886,13 +1886,22 @@ tsec_offload_process_frame(struct tsec_softc *sc, struct mbuf *m) m_adj(m, sizeof(struct tsec_rx_fcb)); } +static u_int +tsec_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t h, *hashtable = arg; + + h = (ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 24) & 0xFF; + hashtable[(h >> 5)] |= 1 << (0x1F - (h & 0x1F)); + + return (1); +} + static void tsec_setup_multicast(struct tsec_softc *sc) { uint32_t hashtable[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; struct ifnet *ifp = sc->tsec_ifp; - struct ifmultiaddr *ifma; - uint32_t h; int i; TSEC_GLOBAL_LOCK_ASSERT(sc); @@ -1904,18 +1913,7 @@ tsec_setup_multicast(struct tsec_softc *sc) return; } - 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) >> 24) & 0xFF; - - hashtable[(h >> 5)] |= 1 << (0x1F - (h & 0x1F)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, tsec_hash_maddr, &hashtable); for (i = 0; i < 8; i++) TSEC_WRITE(sc, TSEC_REG_GADDR(i), hashtable[i]); |
