PERFORCE change 87685 for review

Sam Leffler sam at FreeBSD.org
Sat Dec 3 05:19:22 GMT 2005


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

Change 87685 by sam at sam_ebb on 2005/12/03 05:18:46

	add support for ahdemo mode

Affected files ...

.. //depot/projects/wifi/sys/dev/ath/if_ath.c#122 edit
.. //depot/projects/wifi/sys/dev/ath/if_athvar.h#48 edit

Differences ...

==== //depot/projects/wifi/sys/dev/ath/if_ath.c#122 (text+ko) ====

@@ -517,6 +517,7 @@
 		  IEEE80211_C_IBSS		/* ibss, nee adhoc, mode */
 		| IEEE80211_C_HOSTAP		/* hostap mode */
 		| IEEE80211_C_MONITOR		/* monitor mode */
+		| IEEE80211_C_AHDEMO		/* adhoc demo mode */
 		| IEEE80211_C_SHPREAMBLE	/* short preamble supported */
 		| IEEE80211_C_SHSLOT		/* short slot time supported */
 		| IEEE80211_C_WPA		/* capable of WPA1+WPA2 */
@@ -964,7 +965,7 @@
 	 */
 	sc->sc_curchan.channel = ic->ic_curchan->ic_freq;
 	sc->sc_curchan.channelFlags = ath_chan2flags(ic->ic_curchan);
-	if (!ath_hal_reset(ah, ic->ic_opmode, &sc->sc_curchan, AH_FALSE, &status)) {
+	if (!ath_hal_reset(ah, sc->sc_opmode, &sc->sc_curchan, AH_FALSE, &status)) {
 		if_printf(ifp, "unable to reset hardware; hal status %u\n",
 			status);
 		goto done;
@@ -1132,7 +1133,7 @@
 	ath_draintxq(sc);		/* stop xmit side */
 	ath_stoprecv(sc);		/* stop recv side */
 	/* NB: indicate channel change so we do a full reset */
-	if (!ath_hal_reset(ah, ic->ic_opmode, &sc->sc_curchan, AH_TRUE, &status))
+	if (!ath_hal_reset(ah, sc->sc_opmode, &sc->sc_curchan, AH_TRUE, &status))
 		if_printf(ifp, "%s: unable to reset hardware; hal status %u\n",
 			__func__, status);
 	ath_update_txpow(sc);		/* update tx power state */
@@ -1770,8 +1771,20 @@
 
 	error = ieee80211_media_change(ifp);
 	if (error == ENETRESET) {
+		struct ath_softc *sc = ifp->if_softc;
+		struct ieee80211com *ic = &sc->sc_ic;
+
+		if (ic->ic_opmode == IEEE80211_M_AHDEMO) {
+			/* 
+			 * Adhoc demo mode is just ibss mode w/o beacons
+			 * (mostly).  The hal knows nothing about it;
+			 * tell it we're operating in ibss mode.
+			 */
+			sc->sc_opmode = HAL_M_IBSS;
+		} else
+			sc->sc_opmode = ic->ic_opmode;
 		if (IS_UP(ifp))
-			ath_init(ifp->if_softc);	/* XXX lose error */
+			ath_init(sc);		/* XXX lose error */
 		error = 0;
 	}
 	return error;
@@ -4734,7 +4747,7 @@
 		ath_hal_intrset(ah, 0);		/* disable interrupts */
 		ath_draintxq(sc);		/* clear pending tx frames */
 		ath_stoprecv(sc);		/* turn off frame recv */
-		if (!ath_hal_reset(ah, ic->ic_opmode, &hchan, AH_TRUE, &status)) {
+		if (!ath_hal_reset(ah, sc->sc_opmode, &hchan, AH_TRUE, &status)) {
 			if_printf(ic->ic_ifp, "%s: unable to reset "
 			    "channel %u (%u Mhz, flags 0x%x hal flags 0x%x)\n",
 			    __func__, ieee80211_chan2ieee(ic, chan),
@@ -4922,9 +4935,7 @@
 	ni = ic->ic_bss;
 
 	rfilt = ath_calcrxfilter(sc);
-	stamode = (ic->ic_opmode == IEEE80211_M_STA ||
-		   ic->ic_opmode == IEEE80211_M_IBSS ||
-		   ic->ic_opmode == IEEE80211_M_AHDEMO);
+	stamode = (sc->sc_opmode == HAL_M_STA || sc->sc_opmode == HAL_M_IBSS);
 	if (stamode && nstate == IEEE80211_S_RUN) {
 		sc->sc_curaid = ni->ni_associd;
 		IEEE80211_ADDR_COPY(sc->sc_curbssid, ni->ni_bssid);
@@ -4952,9 +4963,7 @@
 	 */
 	ath_rate_newstate(sc, nstate);
 
-	if (ic->ic_opmode == IEEE80211_M_MONITOR) {
-		/* nothing to do */;
-	} else if (nstate == IEEE80211_S_RUN) {
+	if (nstate == IEEE80211_S_RUN) {
 		DPRINTF(sc, ATH_DEBUG_STATE,
 			"%s(RUN): ic_flags=0x%08x iv=%d bssid=%s "
 			"capinfo=0x%04x chan=%d\n"
@@ -4982,6 +4991,7 @@
 			error = ath_beacon_alloc(sc, ni);
 			if (error != 0)
 				goto bad;
+			ath_beacon_config(sc);
 			break;
 		case IEEE80211_M_STA:
 			/*
@@ -4991,16 +5001,11 @@
 			    sc->sc_hasclrkey &&
 			    ni->ni_ucastkey.wk_keyix == IEEE80211_KEYIX_NONE)
 				ath_setup_stationkey(ni);
+			ath_beacon_config(sc);
 			break;
 		default:
 			break;
 		}
-
-		/*
-		 * Configure the beacon and sleep timers.
-		 */
-		ath_beacon_config(sc);
-
 		/*
 		 * Reset rssi stats; maybe not the best place...
 		 */

==== //depot/projects/wifi/sys/dev/ath/if_athvar.h#48 (text+ko) ====

@@ -224,6 +224,7 @@
 	const HAL_RATE_TABLE	*sc_quarter_rates;/* quarter rate table */
 	const HAL_RATE_TABLE	*sc_currates;	/* current rate table */
 	enum ieee80211_phymode	sc_curmode;	/* current phy mode */
+	HAL_OPMODE		sc_opmode;	/* current operating mode */
 	u_int16_t		sc_curtxpow;	/* current tx power limit */
 	u_int16_t		sc_curaid;	/* current association id */
 	HAL_CHANNEL		sc_curchan;	/* current h/w channel */


More information about the p4-projects mailing list