PERFORCE change 139442 for review

Sam Leffler sam at FreeBSD.org
Sun Apr 6 06:46:47 UTC 2008


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

Change 139442 by sam at sam_ebb on 2008/04/06 06:46:38

	o turn off bgscan for now; it doesn't appear to bring us back to
	  the home channel
	o only issue CONFIG on INIT -> SCAN state change; other cases
	  such as RUN -> SCAN need to not do this or the firmware goes
	  belly up
	o remove IWI_DISASSOC requests if found associated when we need
	  to push the firmware; this doesn't appear to work, we'll need
	  to add it back in as we hit the cases (need to wait for disassoc
	  to complete before doing further work)
	o handle spontaneous deauth (e.g. when inactive); clock the state
	  machine to SCAN
	o remote soft locking arond iwi_init on firmware restart; this
	  doesn't work; need to revisit when we attack firmware error handling
	
	wpa_supplicant now recovers from spontaneous deauth.  Once bgscan
	is working again we'll be able to bypass the scan and reassociate
	directly like other drivers.

Affected files ...

.. //depot/projects/vap/sys/dev/iwi/if_iwi.c#18 edit

Differences ...

==== //depot/projects/vap/sys/dev/iwi/if_iwi.c#18 (text+ko) ====

@@ -395,7 +395,9 @@
 	    | IEEE80211_C_SHPREAMBLE	/* short preamble supported */
 	    | IEEE80211_C_WPA		/* 802.11i */
 	    | IEEE80211_C_WME		/* 802.11e */
+#if 0
 	    | IEEE80211_C_BGSCAN	/* capable of bg scanning */
+#endif
 	    ;
 
 	/* read MAC address from EEPROM */
@@ -1003,12 +1005,11 @@
 		IWI_UNLOCK(sc);
 		break;
 	case IEEE80211_S_SCAN:
+		if (vap->iv_state != IEEE80211_S_INIT)
+			break;
 		iwi_queue_cmd(sc, IWI_CONFIG, 0);
 		return EINPROGRESS;
 	case IEEE80211_S_AUTH:
-		/* The firmware will fail if we are already associated */
-		if (sc->flags & IWI_FLAG_ASSOCIATED)
-			iwi_queue_cmd(sc, IWI_DISASSOC, 0);
 		iwi_queue_cmd(sc, IWI_AUTH, arg);
 		return EINPROGRESS;
 	case IEEE80211_S_RUN:
@@ -1034,9 +1035,6 @@
 		 */
 		if (vap->iv_state == IEEE80211_S_AUTH)
 			break;
-		/* The firmware will fail if we are already associated */
-		if (sc->flags & IWI_FLAG_ASSOCIATED)
-			iwi_queue_cmd(sc, IWI_DISASSOC, 0);
 		iwi_queue_cmd(sc, IWI_ASSOC, arg);
 		return EINPROGRESS;
 	default:
@@ -1477,10 +1475,20 @@
 			    &IWI_VAP(vap)->iwi_authsuccess_task);
 			break;
 		case IWI_AUTH_FAIL:
-			DPRINTFN(2, ("Authentication failed\n"));
+			/*
+			 * These are delivered as an unsolicited deauth
+			 * (e.g. due to inactivity) or in response to an
+			 * associate request.
+			 */
 			sc->flags &= ~IWI_FLAG_ASSOCIATED;
-			IWI_STATE_END(sc, IWI_FW_ASSOCIATING);
-			/* XXX */
+			if (vap->iv_state != IEEE80211_S_RUN) {
+				DPRINTFN(2, ("Authentication failed\n"));
+				IWI_STATE_END(sc, IWI_FW_ASSOCIATING);
+			} else {
+				DPRINTFN(2, ("Deauthenticated\n"));
+			}
+			taskqueue_enqueue(taskqueue_swi,
+			    &IWI_VAP(vap)->iwi_assocfailed_task);
 			break;
 		case IWI_AUTH_SENT_1:
 		case IWI_AUTH_RECV_2:
@@ -1526,8 +1534,8 @@
 
 			case IWI_FW_DISASSOCIATING:
 				DPRINTFN(2, ("Dissassociated\n"));
-				IWI_STATE_END(sc,
-				    IWI_FW_DISASSOCIATING);
+				IWI_STATE_END(sc, IWI_FW_DISASSOCIATING);
+				/* XXX what next? */
 				break;
 			}
 			sc->flags &= ~IWI_FLAG_ASSOCIATED;
@@ -3252,13 +3260,10 @@
 iwi_restart(void *arg, int npending)
 {
 	struct iwi_softc *sc = arg;
-	IWI_LOCK_DECL;
 
-	IWI_LOCK(sc);
 	/* XXX not right */
 	if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING)
 		iwi_init(sc);
-	IWI_UNLOCK(sc);
 }
 
 /*


More information about the p4-projects mailing list