Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Oct 2003 14:29:03 -0700 (PDT)
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 39860 for review
Message-ID:  <200310172129.h9HLT3rh040004@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=39860

Change 39860 by sam@sam_ebb on 2003/10/17 14:28:03

	o consolidate rx filter calculations in one place
	o enable beacon reception when operating in adhoc mode
	  so the 802.11 layer can use them to create nodes for peers

Affected files ...

.. //depot/projects/netperf/sys/dev/ath/if_ath.c#25 edit

Differences ...

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

@@ -919,20 +919,30 @@
 	}
 }
 
-static void
-ath_mode_init(struct ath_softc *sc)
+/*
+ * Calculate the receive filter according to the
+ * operating mode and state:
+ *
+ * o always accept unicast, broadcast, and multicast traffic
+ * o maintain current state of phy error reception
+ * o probe request frames are accepted only when operating in
+ *   hostap, adhoc, or monitor modes
+ * o enable promiscuous mode according to the interface state
+ * o accept beacons:
+ *   - when operating in adhoc mode so the 802.11 layer creates
+ *     node table entries for peers,
+ *   - when operating in station mode for collecting rssi data when
+ *     the station is otherwise quiet, or
+ *   - when scanning
+ */
+static u_int32_t
+ath_calcrxfilter(struct ath_softc *sc)
 {
 	struct ieee80211com *ic = &sc->sc_ic;
 	struct ath_hal *ah = sc->sc_ah;
 	struct ifnet *ifp = &ic->ic_if;
-	u_int32_t rfilt, mfilt[2], val;
-	u_int8_t pos;
-	struct ifmultiaddr *ifma;
+	u_int32_t rfilt;
 
-	/* configure operational mode */
-	ath_hal_setopmode(ah, ic->ic_opmode);
-
-	/* receive filter */
 	rfilt = (ath_hal_getrxfilter(ah) & HAL_RX_FILTER_PHYERR)
 	      | HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST | HAL_RX_FILTER_MCAST;
 	if (ic->ic_opmode != IEEE80211_M_STA)
@@ -941,10 +951,29 @@
 	    (ifp->if_flags & IFF_PROMISC))
 		rfilt |= HAL_RX_FILTER_PROM;
 	if (ic->ic_opmode == IEEE80211_M_STA ||
+	    ic->ic_opmode == IEEE80211_M_IBSS ||
 	    ic->ic_state == IEEE80211_S_SCAN)
 		rfilt |= HAL_RX_FILTER_BEACON;
+	return rfilt;
+}
+
+static void
+ath_mode_init(struct ath_softc *sc)
+{
+	struct ieee80211com *ic = &sc->sc_ic;
+	struct ath_hal *ah = sc->sc_ah;
+	struct ifnet *ifp = &ic->ic_if;
+	u_int32_t rfilt, mfilt[2], val;
+	u_int8_t pos;
+	struct ifmultiaddr *ifma;
+
+	/* configure rx filter */
+	rfilt = ath_calcrxfilter(sc);
 	ath_hal_setrxfilter(ah, rfilt);
 
+	/* configure operational mode */
+	ath_hal_setopmode(ah, ic->ic_opmode);
+
 	/* calculate and install multicast filter */
 	if ((ifp->if_flags & IFF_ALLMULTI) == 0) {
 		mfilt[0] = mfilt[1] = 0;
@@ -2370,16 +2399,7 @@
 	error = ath_chan_set(sc, ni->ni_chan);
 	if (error != 0)
 		goto bad;
-	rfilt = (ath_hal_getrxfilter(ah) & HAL_RX_FILTER_PHYERR)
-	      | HAL_RX_FILTER_UCAST | HAL_RX_FILTER_BCAST | HAL_RX_FILTER_MCAST;
-	if (ic->ic_opmode != IEEE80211_M_STA)
-		rfilt |= HAL_RX_FILTER_PROBEREQ;
-	if (ic->ic_opmode != IEEE80211_M_HOSTAP &&
-	    (ifp->if_flags & IFF_PROMISC))
-		rfilt |= HAL_RX_FILTER_PROM;
-	if (ic->ic_opmode == IEEE80211_M_STA ||
-	    ic->ic_state == IEEE80211_S_SCAN)
-		rfilt |= HAL_RX_FILTER_BEACON;
+	rfilt = ath_calcrxfilter(sc);
 	if (nstate == IEEE80211_S_SCAN) {
 		callout_reset(&sc->sc_scan_ch, (hz * ath_dwelltime) / 1000,
 			ath_next_scan, sc);



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