Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Oct 2004 21:58:22 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 63952 for review
Message-ID:  <200410292158.i9TLwMA3001537@repoman.freebsd.org>

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

Change 63952 by sam@sam_ebb on 2004/10/29 21:58:00

	o fix rx filter calculation by passing in the 802.11 state instead
	  of using ic_state; this can be wrong as we're called prior to
	  completing the state transition from ath_newstate
	o move the call to ath_rate_newstate to happen before setting up
	  the beacon state so the rate information is setup

Affected files ...

.. //depot/projects/wifi/sys/dev/ath/if_ath.c#4 edit

Differences ...

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

@@ -1459,7 +1459,7 @@
  *   - when scanning
  */
 static u_int32_t
-ath_calcrxfilter(struct ath_softc *sc)
+ath_calcrxfilter(struct ath_softc *sc, enum ieee80211_state state)
 {
 	struct ieee80211com *ic = &sc->sc_ic;
 	struct ath_hal *ah = sc->sc_ah;
@@ -1475,7 +1475,7 @@
 		rfilt |= HAL_RX_FILTER_PROM;
 	if (ic->ic_opmode == IEEE80211_M_STA ||
 	    ic->ic_opmode == IEEE80211_M_IBSS ||
-	    ic->ic_state == IEEE80211_S_SCAN)
+	    state == IEEE80211_S_SCAN)
 		rfilt |= HAL_RX_FILTER_BEACON;
 	return rfilt;
 }
@@ -1483,6 +1483,7 @@
 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 = &sc->sc_if;
 	u_int32_t rfilt, mfilt[2], val;
@@ -1490,7 +1491,7 @@
 	struct ifmultiaddr *ifma;
 
 	/* configure rx filter */
-	rfilt = ath_calcrxfilter(sc);
+	rfilt = ath_calcrxfilter(sc, ic->ic_state);
 	ath_hal_setrxfilter(ah, rfilt);
 
 	/* configure operational mode */
@@ -3402,13 +3403,17 @@
 	if (nstate == IEEE80211_S_INIT) {
 		sc->sc_imask &= ~(HAL_INT_SWBA | HAL_INT_BMISS);
 		ath_hal_intrset(ah, sc->sc_imask);
+		/*
+		 * Notify the rate control algorithm.
+		 */
+		ath_rate_newstate(sc, nstate);
 		goto done;
 	}
 	ni = ic->ic_bss;
 	error = ath_chan_set(sc, ni->ni_chan);
 	if (error != 0)
 		goto bad;
-	rfilt = ath_calcrxfilter(sc);
+	rfilt = ath_calcrxfilter(sc, nstate);
 	if (nstate == IEEE80211_S_SCAN)
 		bssid = ifp->if_broadcastaddr;
 	else
@@ -3427,6 +3432,12 @@
 				ath_hal_keysetmac(ah, i, bssid);
 	}
 
+	/*
+	 * Notify the rate control algorithm so rates
+	 * are setup should ath_beacon_alloc be called.
+	 */
+	ath_rate_newstate(sc, nstate);
+
 	if (ic->ic_opmode == IEEE80211_M_MONITOR) {
 		/* nothing to do */;
 	} else if (nstate == IEEE80211_S_RUN) {
@@ -3461,10 +3472,6 @@
 	}
 done:
 	/*
-	 * Notify the rate control algorithm.
-	 */
-	ath_rate_newstate(sc, nstate);
-	/*
 	 * Invoke the parent method to complete the work.
 	 */
 	error = sc->sc_newstate(ic, nstate, arg);



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