aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/re
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2019-10-21 18:07:32 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2019-10-21 18:07:32 +0000
commit307b050d3b59389740206d0358b2f827a1be2445 (patch)
tree6dca31506511fda9c88c3cc8f6644974bc5efc90 /sys/dev/re
parent9bf5c8b4307eafc123fac49a41aee1cad93f8b23 (diff)
Notes
Diffstat (limited to 'sys/dev/re')
-rw-r--r--sys/dev/re/if_re.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c
index 3b31bb286fe9..1d750c25d233 100644
--- a/sys/dev/re/if_re.c
+++ b/sys/dev/re/if_re.c
@@ -649,6 +649,20 @@ re_miibus_statchg(device_t dev)
*/
}
+static u_int
+re_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
+{
+ uint32_t h, *hashes = arg;
+
+ h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26;
+ if (h < 32)
+ hashes[0] |= (1 << h);
+ else
+ hashes[1] |= (1 << (h - 32));
+
+ return (1);
+}
+
/*
* Set the RX configuration and 64-bit multicast hash filter.
*/
@@ -656,9 +670,8 @@ static void
re_set_rxmode(struct rl_softc *sc)
{
struct ifnet *ifp;
- struct ifmultiaddr *ifma;
- uint32_t hashes[2] = { 0, 0 };
- uint32_t h, rxfilt;
+ uint32_t h, hashes[2] = { 0, 0 };
+ uint32_t rxfilt;
RL_LOCK_ASSERT(sc);
@@ -683,18 +696,7 @@ re_set_rxmode(struct rl_softc *sc)
goto done;
}
- 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;
- if (h < 32)
- hashes[0] |= (1 << h);
- else
- hashes[1] |= (1 << (h - 32));
- }
- if_maddr_runlock(ifp);
+ if_foreach_llmaddr(ifp, re_hash_maddr, hashes);
if (hashes[0] != 0 || hashes[1] != 0) {
/*