summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2019-10-14 20:29:14 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2019-10-14 20:29:14 +0000
commita433f711bb1e39bc202c0d6d4eea087fb12ae471 (patch)
tree02976ed89b6bf3a297432f5c82de141bab1c5c8c
parent9c601934f647e74793d9f53ab6e5bbaf06213aa2 (diff)
downloadsrc-test2-a433f711bb1e39bc202c0d6d4eea087fb12ae471.tar.gz
src-test2-a433f711bb1e39bc202c0d6d4eea087fb12ae471.zip
Convert to if_foreach_llmaddr() KPI.
Reviewed by: hselasky
Notes
Notes: svn path=/head/; revision=353508
-rw-r--r--sys/dev/usb/net/if_ure.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/sys/dev/usb/net/if_ure.c b/sys/dev/usb/net/if_ure.c
index 64653f64a492..ff17cdf1468a 100644
--- a/sys/dev/usb/net/if_ure.c
+++ b/sys/dev/usb/net/if_ure.c
@@ -792,6 +792,19 @@ ure_tick(struct usb_ether *ue)
}
}
+static u_int
+ure_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);
+}
+
/*
* Program the 64-bit multicast hash filter.
*/
@@ -800,9 +813,8 @@ ure_rxfilter(struct usb_ether *ue)
{
struct ure_softc *sc = uether_getsc(ue);
struct ifnet *ifp = uether_getifp(ue);
- struct ifmultiaddr *ifma;
- uint32_t h, rxmode;
- uint32_t hashes[2] = { 0, 0 };
+ uint32_t rxmode;
+ uint32_t h, hashes[2] = { 0, 0 };
URE_LOCK_ASSERT(sc, MA_OWNED);
@@ -818,18 +830,7 @@ ure_rxfilter(struct usb_ether *ue)
}
rxmode |= URE_RCR_AM;
- 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, ure_hash_maddr, &hashes);
h = bswap32(hashes[0]);
hashes[0] = bswap32(hashes[1]);