PERFORCE change 127136 for review

Andrew Thompson thompsa at FreeBSD.org
Wed Oct 3 13:32:30 PDT 2007


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

Change 127136 by thompsa at thompsa_heff on 2007/10/03 20:32:00

	Fix adhoc mode.
	
	Obtained from:	sam

Affected files ...

.. //depot/projects/wifi/sys/dev/ipw/if_ipw.c#36 edit

Differences ...

==== //depot/projects/wifi/sys/dev/ipw/if_ipw.c#36 (text+ko) ====

@@ -849,8 +849,20 @@
 		ieee80211_state_name[nstate], sc->flags));
 
 	switch (nstate) {
-	case IEEE80211_S_SCAN:
 	case IEEE80211_S_RUN:
+		if (ic->ic_opmode == IEEE80211_M_IBSS) {
+			/*
+			 * XXX when joining an ibss network we are called
+			 * with a SCAN -> RUN transition on scan complete.
+			 * Use that to call ipw_auth_and_assoc.  On completing
+			 * the join we are then called again with an
+			 * AUTH -> RUN transition and we want to do nothing.
+			 * This is all totally bogus and needs to be redone.
+			 */
+			if (ic->ic_state == IEEE80211_S_SCAN)
+				taskqueue_enqueue_fast(taskqueue_fast,
+				    &sc->sc_assoc_task);
+		}
 		break;
 
 	case IEEE80211_S_INIT:
@@ -967,12 +979,13 @@
 	case IPW_STATE_ASSOCIATED:
 		DPRINTFN(2, ("Association succeeded (%s flags 0x%x)\n",
 			IEEESTATE(ic), sc->flags));
-		if (sc->flags & IPW_FLAG_SCANNING) {
-			ieee80211_cancel_scan(ic);
-			sc->flags &= ~IPW_FLAG_SCANNING;
-		}
 		sc->flags |= IPW_FLAG_ASSOCIATED;
-		ieee80211_new_state(ic, IEEE80211_S_RUN, -1);
+		/* XXX suppress state change in case the fw auto-associates */
+		if (ic->ic_state != IEEE80211_S_ASSOC) {
+			DPRINTF(("Unexpected association (state %u)\n",
+				ic->ic_state));
+		} else
+			ieee80211_new_state(ic, IEEE80211_S_RUN, -1);
 		break;
 
 	case IPW_STATE_SCANNING:
@@ -2794,8 +2807,7 @@
 	IPW_LOCK_DECL;
 
 	IPW_LOCK(sc);
-	if (ic->ic_opmode == IEEE80211_M_IBSS ||
-	    ic->ic_opmode == IEEE80211_M_MONITOR) {
+	if (ic->ic_opmode == IEEE80211_M_MONITOR) {
 		ipw_disable(sc);
 		ipw_setchannel(sc, ic->ic_curchan);
 		ipw_enable(sc);


More information about the p4-projects mailing list