Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Oct 2019 18:07:40 +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: r353825 - head/sys/dev/sge
Message-ID:  <201910211807.x9LI7eaP065765@repo.freebsd.org>

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

Log:
  Convert to if_foreach_llmaddr() KPI.

Modified:
  head/sys/dev/sge/if_sge.c

Modified: head/sys/dev/sge/if_sge.c
==============================================================================
--- head/sys/dev/sge/if_sge.c	Mon Oct 21 18:07:35 2019	(r353824)
+++ head/sys/dev/sge/if_sge.c	Mon Oct 21 18:07:40 2019	(r353825)
@@ -442,12 +442,22 @@ sge_miibus_statchg(device_t dev)
 	}
 }
 
+static u_int
+sge_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int count)
+{
+	uint32_t crc, *hashes = arg;
+
+	crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN);
+	hashes[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
+
+	return (1);
+}
+
 static void
 sge_rxfilter(struct sge_softc *sc)
 {
 	struct ifnet *ifp;
-	struct ifmultiaddr *ifma;
-	uint32_t crc, hashes[2];
+	uint32_t hashes[2];
 	uint16_t rxfilt;
 
 	SGE_LOCK_ASSERT(sc);
@@ -468,15 +478,7 @@ sge_rxfilter(struct sge_softc *sc)
 		rxfilt |= AcceptMulticast;
 		hashes[0] = hashes[1] = 0;
 		/* Now program new ones. */
-		if_maddr_rlock(ifp);
-		CK_STAILQ_FOREACH(ifma, &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);
-			hashes[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
-		}
-		if_maddr_runlock(ifp);
+		if_foreach_llmaddr(ifp, sge_hash_maddr, hashes);
 	}
 	CSR_WRITE_2(sc, RxMacControl, rxfilt);
 	CSR_WRITE_4(sc, RxHashTable, hashes[0]);



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