PERFORCE change 137808 for review

Sam Leffler sam at FreeBSD.org
Sat Mar 15 22:49:14 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=137808

Change 137808 by sam at sam_ebb on 2008/03/15 22:48:36

	remove hack to walk the vap list to calculate the mcast filter
	as net80211 now does the merge for us

Affected files ...

.. //depot/projects/vap/sys/dev/ath/if_ath.c#44 edit

Differences ...

==== //depot/projects/vap/sys/dev/ath/if_ath.c#44 (text+ko) ====

@@ -142,6 +142,7 @@
 			const u_int8_t mac[IEEE80211_ADDR_LEN]);
 static void	ath_key_update_begin(struct ieee80211vap *);
 static void	ath_key_update_end(struct ieee80211vap *);
+static void	ath_update_mcast(struct ifnet *);
 static void	ath_mode_init(struct ath_softc *);
 static void	ath_setslottime(struct ath_softc *);
 static void	ath_updateslot(struct ifnet *);
@@ -625,6 +626,7 @@
 	ic->ic_vap_create = ath_vap_create;
 	ic->ic_vap_delete = ath_vap_delete;
 	ic->ic_raw_xmit = ath_raw_xmit;
+	ic->ic_update_mcast = ath_update_mcast;
 	ic->ic_node_alloc = ath_node_alloc;
 	sc->sc_node_free = ic->ic_node_free;
 	ic->ic_node_free = ath_node_free;
@@ -2496,25 +2498,20 @@
 	return rfilt;
 }
 
-/*
- * Merge multicast address from all vap's to form the hardware
- * filter.  Ideally we should only inspect our own list and the
- * 802.11 layer would merge for us but that's bit difficult so
- * for now we put the onus on the driver.
- */
 static void
-ath_merge_mcast(struct ath_softc *sc, u_int32_t mfilt[2])
+ath_update_mcast(struct ifnet *ifp)
 {
-	struct ieee80211com *ic = &sc->sc_ic;
-	struct ieee80211vap *vap;
+	struct ath_softc *sc = ifp->if_softc;
+	u_int32_t mfilt[2];
 
-	mfilt[0] = mfilt[1] = 0;
-	/* XXX locking */
-	TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
-		struct ifnet *ifp = vap->iv_ifp;
+	/* calculate and install multicast filter */
+	if ((ifp->if_flags & IFF_ALLMULTI) == 0) {
 		struct ifmultiaddr *ifma;
-
-		IF_ADDR_LOCK(ifp);
+		/*
+		 * Merge multicast addresses to form the hardware filter.
+		 */
+		mfilt[0] = mfilt[1] = 0;
+		IF_ADDR_LOCK(ifp);	/* XXX need some fiddling to remove? */
 		TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
 			caddr_t dl;
 			u_int32_t val;
@@ -2530,7 +2527,11 @@
 			mfilt[pos / 32] |= (1 << (pos % 32));
 		}
 		IF_ADDR_UNLOCK(ifp);
-	}
+	} else
+		mfilt[0] = mfilt[1] = ~0;
+	ath_hal_setmcastfilter(sc->sc_ah, mfilt[0], mfilt[1]);
+	DPRINTF(sc, ATH_DEBUG_MODE, "%s: , MC filter %08x:%08x\n",
+		__func__, mfilt[0], mfilt[1]);
 }
 
 static void
@@ -2539,11 +2540,12 @@
 	struct ieee80211com *ic = &sc->sc_ic;
 	struct ath_hal *ah = sc->sc_ah;
 	struct ifnet *ifp = sc->sc_ifp;
-	u_int32_t rfilt, mfilt[2];
+	u_int32_t rfilt;
 
 	/* configure rx filter */
 	rfilt = ath_calcrxfilter(sc);
 	ath_hal_setrxfilter(ah, rfilt);
+	DPRINTF(sc, ATH_DEBUG_MODE, "%s: RX filter 0x%x\n", __func__, rfilt);
 
 	/* configure operational mode */
 	ath_hal_setopmode(ah);
@@ -2560,13 +2562,7 @@
 	ath_hal_setmac(ah, ic->ic_myaddr);
 
 	/* calculate and install multicast filter */
-	if ((ifp->if_flags & IFF_ALLMULTI) == 0)
-		ath_merge_mcast(sc, mfilt);
-	else
-		mfilt[0] = mfilt[1] = ~0;
-	ath_hal_setmcastfilter(ah, mfilt[0], mfilt[1]);
-	DPRINTF(sc, ATH_DEBUG_MODE, "%s: RX filter 0x%x, MC filter %08x:%08x\n",
-		__func__, rfilt, mfilt[0], mfilt[1]);
+	ath_update_mcast(ifp);
 }
 
 /*


More information about the p4-projects mailing list