svn commit: r353805 - head/sys/dev/age

Gleb Smirnoff glebius at FreeBSD.org
Mon Oct 21 18:00:18 UTC 2019


Author: glebius
Date: Mon Oct 21 18:00:17 2019
New Revision: 353805
URL: https://svnweb.freebsd.org/changeset/base/353805

Log:
  Convert to if_foreach_llmaddr() KPI.

Modified:
  head/sys/dev/age/if_age.c

Modified: head/sys/dev/age/if_age.c
==============================================================================
--- head/sys/dev/age/if_age.c	Mon Oct 21 17:59:53 2019	(r353804)
+++ head/sys/dev/age/if_age.c	Mon Oct 21 18:00:17 2019	(r353805)
@@ -3140,12 +3140,22 @@ age_rxvlan(struct age_softc *sc)
 	CSR_WRITE_4(sc, AGE_MAC_CFG, reg);
 }
 
+static u_int
+age_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
+{
+	uint32_t *mchash = arg;
+	uint32_t crc;
+
+	crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN);
+	mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
+
+	return (1);
+}
+
 static void
 age_rxfilter(struct age_softc *sc)
 {
 	struct ifnet *ifp;
-	struct ifmultiaddr *ifma;
-	uint32_t crc;
 	uint32_t mchash[2];
 	uint32_t rxcfg;
 
@@ -3170,16 +3180,7 @@ age_rxfilter(struct age_softc *sc)
 
 	/* Program new filter. */
 	bzero(mchash, sizeof(mchash));
-
-	if_maddr_rlock(ifp);
-	CK_STAILQ_FOREACH(ifma, &sc->age_ifp->if_multiaddrs, ifma_link) {
-		if (ifma->ifma_addr->sa_family != AF_LINK)
-			continue;
-		crc = ether_crc32_be(LLADDR((struct sockaddr_dl *)
-		    ifma->ifma_addr), ETHER_ADDR_LEN);
-		mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
-	}
-	if_maddr_runlock(ifp);
+	if_foreach_llmaddr(ifp, age_hash_maddr, mchash);
 
 	CSR_WRITE_4(sc, AGE_MAR0, mchash[0]);
 	CSR_WRITE_4(sc, AGE_MAR1, mchash[1]);


More information about the svn-src-head mailing list