Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Oct 2019 18:12:32 +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: r353858 - head/sys/dev/rtwn
Message-ID:  <201910211812.x9LICWSG072714@repo.freebsd.org>

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

Log:
  Convert to if_foreach_llmaddr() KPI.

Modified:
  head/sys/dev/rtwn/if_rtwn_rx.c

Modified: head/sys/dev/rtwn/if_rtwn_rx.c
==============================================================================
--- head/sys/dev/rtwn/if_rtwn_rx.c	Mon Oct 21 18:12:26 2019	(r353857)
+++ head/sys/dev/rtwn/if_rtwn_rx.c	Mon Oct 21 18:12:31 2019	(r353858)
@@ -366,6 +366,18 @@ rtwn_get_multi_pos(const uint8_t maddr[])
 	return (pos);
 }
 
+static u_int
+rtwm_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt)
+{
+	uint32_t *mfilt = arg;
+	uint8_t pos;
+
+	pos = rtwn_get_multi_pos(LLADDR(sdl));
+	mfilt[pos / 32] |= (1 << (pos % 32));
+
+	return (1);
+}
+
 void
 rtwn_set_multi(struct rtwn_softc *sc)
 {
@@ -377,28 +389,13 @@ rtwn_set_multi(struct rtwn_softc *sc)
 	/* general structure was copied from ath(4). */
 	if (ic->ic_allmulti == 0) {
 		struct ieee80211vap *vap;
-		struct ifnet *ifp;
-		struct ifmultiaddr *ifma;
 
 		/*
 		 * Merge multicast addresses to form the hardware filter.
 		 */
 		mfilt[0] = mfilt[1] = 0;
-		TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
-			ifp = vap->iv_ifp;
-			if_maddr_rlock(ifp);
-			CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
-				caddr_t dl;
-				uint8_t pos;
-
-				dl = LLADDR((struct sockaddr_dl *)
-				    ifma->ifma_addr);
-				pos = rtwn_get_multi_pos(dl);
-
-				mfilt[pos / 32] |= (1 << (pos % 32));
-			}
-			if_maddr_runlock(ifp);
-		}
+		TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next)
+			if_foreach_llmaddr(vap->iv_ifp, rtwm_hash_maddr, mfilt);
 	} else
 		mfilt[0] = mfilt[1] = ~0;
 



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