svn commit: r353825 - head/sys/dev/sge

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


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]);


More information about the svn-src-head mailing list