PERFORCE change 77364 for review

Sam Leffler sam at FreeBSD.org
Mon May 23 23:37:04 GMT 2005


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

Change 77364 by sam at sam_ebb on 2005/05/23 23:36:26

	Sync beacon timers on return to the bss channel since the channel
	change destroys the timer register contents.  Will also (eventually)
	use this to deal with timer drift in adhoc mode.

Affected files ...

.. //depot/projects/vap/sys/dev/ath/if_ath.c#15 edit
.. //depot/projects/vap/sys/dev/ath/if_athvar.h#7 edit

Differences ...

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

@@ -3011,6 +3011,7 @@
 		if (vap->iv_opmode == IEEE80211_M_IBSS && sc->sc_hasveol)
 			ath_beacon_proc(sc, 0);
 	}
+	sc->sc_syncbeacon = 0;
 }
 
 static void
@@ -3355,7 +3356,7 @@
 	int subtype, int rssi, u_int32_t rstamp)
 {
 	struct ath_softc *sc = ni->ni_ic->ic_ifp->if_softc;
-	struct ieee80211vap *vap;
+	struct ieee80211vap *vap = ni->ni_vap;
 
 	/*
 	 * Call up first so subsequent work can use information
@@ -3366,9 +3367,16 @@
 	case IEEE80211_FC0_SUBTYPE_BEACON:
 		/* update rssi statistics for use by the hal */
 		ATH_RSSI_LPF(ATH_NODE(ni)->an_halstats.ns_avgbrssi, rssi);
+		if (sc->sc_syncbeacon &&
+		    ni == vap->iv_bss && vap->iv_state == IEEE80211_S_RUN) {
+			/*
+			 * Resync beacon timers using the tsf of the
+			 * beacon frame we just received.
+			 */
+			ath_beacon_config(sc);
+		}
 		/* fall thru... */
 	case IEEE80211_FC0_SUBTYPE_PROBE_RESP:
-		vap = ni->ni_vap;
 		if (vap->iv_opmode == IEEE80211_M_IBSS &&
 		    vap->iv_state == IEEE80211_S_RUN) {
 			u_int64_t tsf = ath_extend_tsf(sc->sc_ah, rstamp);
@@ -4956,6 +4964,7 @@
 	/* XXX calibration timer? */
 
 	sc->sc_scanning = 1;
+	sc->sc_syncbeacon = 0;
 	rfilt = ath_calcrxfilter(sc);
 	ath_hal_setrxfilter(ah, rfilt);
 	ath_hal_setassocid(ah, ifp->if_broadcastaddr, 0);
@@ -4989,6 +4998,14 @@
 	struct ath_softc *sc = ifp->if_softc;
 
 	(void) ath_chan_set(sc, ic->ic_curchan);
+	/*
+	 * If we are returning to our bss channel then mark state
+	 * so the next recv'd beacon's tsf will be used to sync the
+	 * beacon timers.  Note that since we only hear beacons in
+	 * sta/ibss mode this has no effect in other operating modes.
+	 */
+	if (!sc->sc_scanning && ic->ic_curchan == ic->ic_bsschan)
+		sc->sc_syncbeacon = 1;
 }
 
 static int

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

@@ -251,7 +251,8 @@
 				sc_beacons : 1,	/* beacons running */
 				sc_hasbmask: 1,	/* bssid mask support */
 				sc_hastsfadd:1,	/* tsf adjust support */
-				sc_scanning: 1;	/* scanning active */
+				sc_scanning: 1,	/* scanning active */
+				sc_syncbeacon:1;/* sync/resync beacon timers */
 						/* rate tables */
 	const HAL_RATE_TABLE	*sc_rates[IEEE80211_MODE_MAX];
 	const HAL_RATE_TABLE	*sc_currates;	/* current rate table */


More information about the p4-projects mailing list