Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Oct 2019 18:06:06 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r353807 - head/sys/dev/alc
Message-ID:  <201910211806.x9LI6647064831@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Mon Oct 21 18:06:06 2019
New Revision: 353807
URL: https://svnweb.freebsd.org/changeset/base/353807

Log:
  Convert to if_foreach_llmaddr() KPI.

Modified:
  head/sys/dev/alc/if_alc.c

Modified: head/sys/dev/alc/if_alc.c
==============================================================================
--- head/sys/dev/alc/if_alc.c	Mon Oct 21 18:05:43 2019	(r353806)
+++ head/sys/dev/alc/if_alc.c	Mon Oct 21 18:06:06 2019	(r353807)
@@ -4581,12 +4581,22 @@ alc_rxvlan(struct alc_softc *sc)
 	CSR_WRITE_4(sc, ALC_MAC_CFG, reg);
 }
 
+static u_int
+alc_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
 alc_rxfilter(struct alc_softc *sc)
 {
 	struct ifnet *ifp;
-	struct ifmultiaddr *ifma;
-	uint32_t crc;
 	uint32_t mchash[2];
 	uint32_t rxcfg;
 
@@ -4609,15 +4619,7 @@ alc_rxfilter(struct alc_softc *sc)
 		goto chipit;
 	}
 
-	if_maddr_rlock(ifp);
-	CK_STAILQ_FOREACH(ifma, &sc->alc_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, alc_hash_maddr, mchash);
 
 chipit:
 	CSR_WRITE_4(sc, ALC_MAR0, mchash[0]);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910211806.x9LI6647064831>