PERFORCE change 135730 for review

Sam Leffler sam at FreeBSD.org
Tue Feb 19 18:00:53 UTC 2008


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

Change 135730 by sam at sam_ebb on 2008/02/19 18:00:23

	shuffle newstate some more so we don't accidentally turn off SWBA

Affected files ...

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

Differences ...

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

@@ -5454,31 +5454,16 @@
 	callout_stop(&sc->sc_cal_ch);
 	ath_hal_setledstate(ah, leds[nstate]);	/* set LED */
 
-	if (nstate == IEEE80211_S_INIT) {
+	if (nstate == IEEE80211_S_SCAN) {
 		/*
-		 * If there are no vaps left in RUN state then
-		 * shutdown host/driver operation:
-		 * o disable interrupts so we don't rx frames
-		 * o clean any pending items on the task q
-		 * o notify the rate control algorithm
+		 * Scanning: turn off beacon miss and don't beacon.
+		 * Mark beacon state so when we reach RUN state we'll
+		 * [re]setup beacons.
 		 */
-		if (!ath_isanyrunningvaps(vap)) {
-			sc->sc_imask &= ~(HAL_INT_SWBA | HAL_INT_BMISS);
-			/*
-			 * Disable interrupts.
-			 */
-			ath_hal_intrset(ah, sc->sc_imask &~ HAL_INT_GLOBAL);
-			sc->sc_beacons = 0;
-#if 0
-			/* XXX can't use taskqueue_drain 'cuz we're holding sc_mtx */
-			taskqueue_drain(sc->sc_tq, &sc->sc_rxtask);
-			taskqueue_drain(sc->sc_tq, &sc->sc_rxorntask);
-			taskqueue_drain(sc->sc_tq, &sc->sc_bmisstask);
-			taskqueue_drain(sc->sc_tq, &sc->sc_bstucktask);
-#endif
-		}
-		ath_rate_newstate(vap, nstate);
-		return avp->av_newstate(vap, nstate, arg);
+		ath_hal_intrset(ah,
+		    sc->sc_imask &~ (HAL_INT_SWBA | HAL_INT_BMISS));
+		sc->sc_imask &= ~(HAL_INT_SWBA | HAL_INT_BMISS);
+		sc->sc_beacons = 0;
 	}
 
 	ni = vap->iv_bss;
@@ -5492,6 +5477,7 @@
 	   __func__, rfilt, ether_sprintf(sc->sc_curbssid), sc->sc_curaid);
 	ath_hal_setrxfilter(ah, rfilt);
 
+	/* XXX is this to restore keycache on resume? */
 	if (vap->iv_opmode != IEEE80211_M_STA &&
 	    (vap->iv_flags & IEEE80211_F_PRIVACY)) {
 		for (i = 0; i < IEEE80211_WEP_NKID; i++)
@@ -5508,8 +5494,10 @@
 	 * Invoke the parent method to do net80211 work.
 	 */
 	error = avp->av_newstate(vap, nstate, arg);
+	if (error != 0)
+		goto bad;
 
-	if (error == 0 && nstate == IEEE80211_S_RUN) {
+	if (nstate == IEEE80211_S_RUN) {
 		/* NB: collect bss node again, it may have changed */
 		ni = vap->iv_bss;
 
@@ -5591,10 +5579,27 @@
 			callout_reset(&sc->sc_cal_ch, sc->sc_calinterval * hz,
 				ath_calibrate, sc);
 		}
-	} else {
-		ath_hal_intrset(ah,
-		    sc->sc_imask &~ (HAL_INT_SWBA | HAL_INT_BMISS));
-		sc->sc_imask &= ~(HAL_INT_SWBA | HAL_INT_BMISS);
+	} else if (nstate == IEEE80211_S_INIT) {
+		/*
+		 * If there are no vaps left in RUN state then
+		 * shutdown host/driver operation:
+		 * o disable interrupts so we don't rx frames
+		 * o clean any pending items on the task q
+		 * o notify the rate control algorithm
+		 */
+		if (!ath_isanyrunningvaps(vap)) {
+			sc->sc_imask &= ~(HAL_INT_SWBA | HAL_INT_BMISS);
+			/* disable interrupts  */
+			ath_hal_intrset(ah, sc->sc_imask &~ HAL_INT_GLOBAL);
+			sc->sc_beacons = 0;
+#if 0
+			/* XXX can't use taskqueue_drain 'cuz we're holding sc_mtx */
+			taskqueue_drain(sc->sc_tq, &sc->sc_rxtask);
+			taskqueue_drain(sc->sc_tq, &sc->sc_rxorntask);
+			taskqueue_drain(sc->sc_tq, &sc->sc_bmisstask);
+			taskqueue_drain(sc->sc_tq, &sc->sc_bstucktask);
+#endif
+		}
 	}
 bad:
 	return error;


More information about the p4-projects mailing list