PERFORCE change 77142 for review

Sam Leffler sam at FreeBSD.org
Wed May 18 12:26:52 PDT 2005


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

Change 77142 by sam at sam_ebb on 2005/05/18 19:26:38

	Defer more state transitions when in manual roaming mode (as happens
	when wpa_supplicant is used):
	o on beacon miss don't trigger a re-associate as the user app will
	  be notified that we disassociated followed by a re-associate but
	  this will confuse it if it does not look-ahead to see the pending
	  event; instead just leave control to the user app (note this
	  breaks dynamic turbo up/down shift on beacon miss)
	o when auth/assoc fails due to tx timeout or similar and roaming is
	  set to manual don't re-try; just defer to the controlling app
	
	This seems to make wpa_supplicant much more robust in the face of
	beacon misses; now to find out why we're getting them.

Affected files ...

.. //depot/projects/vap/sys/net80211/ieee80211_proto.c#9 edit

Differences ...

==== //depot/projects/vap/sys/net80211/ieee80211_proto.c#9 (text+ko) ====

@@ -1102,23 +1102,35 @@
 			IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG,
 			"%s\n", "beacon miss");
 
-		if (vap->iv_opmode != IEEE80211_M_STA)
+		/*
+		 * Our handling is only meaningful for stations that are
+		 * associated; any other conditions else will be handled
+		 * through different means (e.g. the tx timeout on mgt frames).
+		 */
+		if (vap->iv_opmode != IEEE80211_M_STA ||
+		    vap->iv_state != IEEE80211_S_RUN)
 			continue;
-		/* 
-		 * If we receive a beacon miss interrupt when using
-		 * dynamic turbo, attempt to switch modes before
-		 * reassociating.
-		 */
-		if (IEEE80211_ATH_CAP(vap, vap->iv_bss, TURBOP))
-			ieee80211_dturbo_switch(ic,
-			    ic->ic_bsschan->ic_flags ^ IEEE80211_CHAN_TURBO);
-		if (vap->iv_state == IEEE80211_S_RUN) {
+		if (ic->ic_roaming == IEEE80211_ROAMING_AUTO) {
+			/* 
+			 * If we receive a beacon miss interrupt when using
+			 * dynamic turbo, attempt to switch modes before
+			 * reassociating.
+			 */
+			if (IEEE80211_ATH_CAP(vap, vap->iv_bss, TURBOP))
+				ieee80211_dturbo_switch(ic,
+				    ic->ic_bsschan->ic_flags ^ IEEE80211_CHAN_TURBO);
 			/*
 			 * Try to reassociate before scanning for a new ap.
 			 */
-			NET_LOCK_GIANT();
 			ieee80211_new_state(vap, IEEE80211_S_ASSOC, 1);
-			NET_UNLOCK_GIANT();
+		} else {
+			/*
+			 * Somebody else is controlling state changes (e.g.
+			 * a user-mode app) don't do anything that would
+			 * confuse them; just drop into scan mode so they'll
+			 * notified of the state change and given control.
+			 */
+			ieee80211_new_state(vap, IEEE80211_S_SCAN, 0);
 		}
 	}
 }
@@ -1226,20 +1238,24 @@
 		case IEEE80211_S_SCAN:
 			/* nothing to do */
 			break;
-		case IEEE80211_S_RUN:
-			/* beacon miss */
-			IEEE80211_DPRINTF(vap, IEEE80211_MSG_STATE,
-				"no recent beacons from %s; rescanning\n",
-				ether_sprintf(vap->iv_bss->ni_bssid));
+		case IEEE80211_S_AUTH:
+		case IEEE80211_S_ASSOC:		/* timeout restart scan */
+			ieee80211_scan_assocfail(ic, vap->iv_bss->ni_macaddr);
+			if (ic->ic_roaming == IEEE80211_ROAMING_AUTO)
+				ieee80211_check_scan(vap,
+					IEEE80211_SCAN_ACTIVE | arg,
+					IEEE80211_SCAN_FOREVER);
+			break;
+		case IEEE80211_S_RUN:		/* beacon miss */
 			ieee80211_sta_leave(ni);
 			vap->iv_flags &= ~IEEE80211_F_SIBSS;	/* XXX */
-			/* FALLTHRU */
-		case IEEE80211_S_AUTH:
-		case IEEE80211_S_ASSOC:
-			/* timeout restart scan */
-			ieee80211_scan_assocfail(ic, vap->iv_bss->ni_macaddr);
-			ieee80211_check_scan(vap, IEEE80211_SCAN_ACTIVE | arg,
-				IEEE80211_SCAN_FOREVER);
+#if 0
+			ieee80211_scan_beaconmiss(ic, vap->iv_bss->ni_macaddr);
+#endif
+			if (ic->ic_roaming == IEEE80211_ROAMING_AUTO)
+				ieee80211_check_scan(vap,
+					IEEE80211_SCAN_ACTIVE | arg,
+					IEEE80211_SCAN_FOREVER);
 			break;
 		}
 		break;


More information about the p4-projects mailing list