svn commit: r210674 - stable/8/sys/dev/iwn

Bernhard Schmidt bschmidt at FreeBSD.org
Sat Jul 31 10:20:09 UTC 2010


Author: bschmidt
Date: Sat Jul 31 10:20:09 2010
New Revision: 210674
URL: http://svn.freebsd.org/changeset/base/210674

Log:
  MFC r210114:
  Handle RUN->ASSOC->RUN transition correctly, as in not trigger a
  firmware error. Convert if statements to a switch statement while
  I'm here.

Modified:
  stable/8/sys/dev/iwn/if_iwn.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/iwn/if_iwn.c
==============================================================================
--- stable/8/sys/dev/iwn/if_iwn.c	Sat Jul 31 10:18:15 2010	(r210673)
+++ stable/8/sys/dev/iwn/if_iwn.c	Sat Jul 31 10:20:09 2010	(r210674)
@@ -1940,27 +1940,44 @@ iwn_newstate(struct ieee80211vap *vap, e
 	IWN_LOCK(sc);
 	callout_stop(&sc->sc_timer_to);
 
-	if (nstate == IEEE80211_S_AUTH && vap->iv_state != IEEE80211_S_AUTH) {
-		/* !AUTH -> AUTH requires adapter config */
-		/* Reset state to handle reassociations correctly. */
+	switch (nstate) {
+	case IEEE80211_S_ASSOC:
+		if (vap->iv_state != IEEE80211_S_RUN)
+			break;
+		/* FALLTHROUGH */
+	case IEEE80211_S_AUTH:
+		if (vap->iv_state == IEEE80211_S_AUTH)
+			break;
+
+		/*
+		 * !AUTH -> AUTH transition requires state reset to handle
+		 * reassociations correctly.
+		 */
 		sc->rxon.associd = 0;
 		sc->rxon.filter &= ~htole32(IWN_FILTER_BSS);
 		iwn_calib_reset(sc);
 		error = iwn_auth(sc, vap);
-	}
-	if (nstate == IEEE80211_S_RUN && vap->iv_state != IEEE80211_S_RUN) {
+		break;
+
+	case IEEE80211_S_RUN:
+		/*
+		 * RUN -> RUN transition; Just restart the timers.
+		 */
+		if (vap->iv_state == IEEE80211_S_RUN) {
+			iwn_calib_reset(sc);
+			break;
+		}
+
 		/*
 		 * !RUN -> RUN requires setting the association id
 		 * which is done with a firmware cmd.  We also defer
 		 * starting the timers until that work is done.
 		 */
 		error = iwn_run(sc, vap);
-	}
-	if (nstate == IEEE80211_S_RUN) {
-		/*
-		 * RUN -> RUN transition; just restart the timers.
-		 */
-		iwn_calib_reset(sc);
+		break;
+
+	default:
+		break;
 	}
 	IWN_UNLOCK(sc);
 	IEEE80211_LOCK(ic);


More information about the svn-src-stable-8 mailing list