From owner-p4-projects@FreeBSD.ORG Mon May 23 23:37:04 2005 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D655F16A420; Mon, 23 May 2005 23:37:03 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9AAB716A41C for ; Mon, 23 May 2005 23:37:03 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5A9A443D49 for ; Mon, 23 May 2005 23:37:03 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j4NNb3WB099144 for ; Mon, 23 May 2005 23:37:03 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j4NNb3Tr099141 for perforce@freebsd.org; Mon, 23 May 2005 23:37:03 GMT (envelope-from sam@freebsd.org) Date: Mon, 23 May 2005 23:37:03 GMT Message-Id: <200505232337.j4NNb3Tr099141@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 77364 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2005 23:37:04 -0000 http://perforce.freebsd.org/chv.cgi?CH=77364 Change 77364 by sam@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 */