svn commit: r191679 - user/thompsa/vaptq/sys/net80211

Andrew Thompson thompsa at FreeBSD.org
Thu Apr 30 02:26:04 UTC 2009


Author: thompsa
Date: Thu Apr 30 02:26:03 2009
New Revision: 191679
URL: http://svn.freebsd.org/changeset/base/191679

Log:
  - Comparing iv_state to iv_nstate is insufficient for determining if the state
    taskq as run since the new state can be overridden in the handler. Add a
    IEEE80211_FEXT_STATEWAIT flag to track the pending state change.
    Likewise do not compare iv_state to iv_nstate to verify the handler
    succeeded, just check the return code.
  - Assert that iv_newstate() can not be deferred again or fail for INIT

Modified:
  user/thompsa/vaptq/sys/net80211/ieee80211_proto.c
  user/thompsa/vaptq/sys/net80211/ieee80211_var.h

Modified: user/thompsa/vaptq/sys/net80211/ieee80211_proto.c
==============================================================================
--- user/thompsa/vaptq/sys/net80211/ieee80211_proto.c	Thu Apr 30 02:21:24 2009	(r191678)
+++ user/thompsa/vaptq/sys/net80211/ieee80211_proto.c	Thu Apr 30 02:26:03 2009	(r191679)
@@ -1604,7 +1604,8 @@ ieee80211_newstate_cb_locked(struct ieee
 	IEEE80211_LOCK_ASSERT(ic);
 
 	IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE,
-	    "%s: %s arg %d\n", __func__, ieee80211_state_name[nstate], arg);
+	    "%s: %s -> %s arg %d\n", __func__,
+	    ieee80211_state_name[ostate], ieee80211_state_name[nstate], arg);
 
 	if (nstate == IEEE80211_S_SCAN && ostate != IEEE80211_S_INIT) {
 		/*
@@ -1620,11 +1621,15 @@ ieee80211_newstate_cb_locked(struct ieee
 	}
 
 	rc = vap->iv_newstate(vap, nstate, arg);
-	if (rc != 0 || vap->iv_state != nstate) {
-		if (rc == EINPROGRESS)
-			if_printf(ic->ic_ifp,
-			    "Warning, iv_newstate was deferred again\n");
+	vap->iv_flags_ext &= ~IEEE80211_FEXT_STATEWAIT;
+	if (rc != 0) {
 		/* State transition failed */
+		KASSERT(rc != EINPROGRESS, ("iv_newstate was deferred"));
+		KASSERT(nstate != IEEE80211_S_INIT,
+		    ("INIT state change failed"));
+		IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE,
+		    "%s: %s returned error %d\n", __func__,
+		    ieee80211_state_name[nstate], rc);
 		return (rc);
 	}
 
@@ -1699,7 +1704,7 @@ ieee80211_new_state_locked(struct ieee80
 
 	IEEE80211_LOCK_ASSERT(ic);
 
-	if (vap->iv_state != vap->iv_nstate) {
+	if (vap->iv_flags_ext & IEEE80211_FEXT_STATEWAIT) {
 		if (vap->iv_nstate == IEEE80211_S_INIT) {
 			/*
 			 * XXX The vap is being stopped, do no allow any other
@@ -1821,6 +1826,7 @@ ieee80211_new_state_locked(struct ieee80
 	/* defer the state change to a thread */
 	vap->iv_nstate = nstate;
 	vap->iv_nstate_arg = arg;
+	vap->iv_flags_ext |= IEEE80211_FEXT_STATEWAIT;
 	ieee80211_runtask(ic, &vap->iv_nstate_task);
 	return (EINPROGRESS);
 }

Modified: user/thompsa/vaptq/sys/net80211/ieee80211_var.h
==============================================================================
--- user/thompsa/vaptq/sys/net80211/ieee80211_var.h	Thu Apr 30 02:21:24 2009	(r191678)
+++ user/thompsa/vaptq/sys/net80211/ieee80211_var.h	Thu Apr 30 02:26:03 2009	(r191679)
@@ -529,12 +529,13 @@ MALLOC_DECLARE(M_80211_VAP);
 #define	IEEE80211_FEXT_SHORTGI40 0x08000000	/* CONF: short GI in HT40 */
 #define	IEEE80211_FEXT_HTCOMPAT  0x10000000	/* CONF: HT vendor OUI's */
 #define	IEEE80211_FEXT_RIFS  	 0x20000000	/* CONF: RIFS enabled */
+#define	IEEE80211_FEXT_STATEWAIT 0x40000000	/* STATUS: awaiting state chg */
 
 #define	IEEE80211_FEXT_BITS \
 	"\20\1NONHT_PR\2INACT\3SCANWAIT\4BGSCAN\5WPS\6TSN\7SCANREQ\10RESUME" \
 	"\12NONEPR_PR\13SWBMISS\14DFS\15DOTD\22WDSLEGACY\23PROBECHAN\24HT" \
 	"\25AMDPU_TX\26AMPDU_TX\27AMSDU_TX\30AMSDU_RX\31USEHT40\32PUREN" \
-	"\33SHORTGI20\34SHORTGI40\35HTCOMPAT\36RIFS"
+	"\33SHORTGI20\34SHORTGI40\35HTCOMPAT\36RIFS\37STATEWAIT"
 
 #define	IEEE80211_FVEN_BITS	"\20"
 


More information about the svn-src-user mailing list