Date: Sat, 25 Dec 2004 19:31:07 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 67688 for review Message-ID: <200412251931.iBPJV7tK056315@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=67688 Change 67688 by sam@sam_ebb on 2004/12/25 19:30:46 Fixup beacon timer calculations: o lintval is specified in ms and must be converted to TU's o roundup when calculating the nexttbtt to insure things are multiple of the beacon interval o remove bogus use of HAL_BEACON_RESET_TSF when setting station timers; there's an implicit reset done and setting the flag screwed up the sleep timer calculations (though all of this turned into a noop because of masking done by the hal) Affected files ... .. //depot/projects/wifi/sys/dev/ath/if_ath.c#46 edit Differences ... ==== //depot/projects/wifi/sys/dev/ath/if_ath.c#46 (text+ko) ==== @@ -1975,6 +1975,7 @@ static void ath_beacon_config(struct ath_softc *sc) { +#define MS_TO_TU(x) (((x) * 1000) / 1024) struct ath_hal *ah = sc->sc_ah; struct ieee80211com *ic = &sc->sc_ic; struct ieee80211_node *ni = ic->ic_bss; @@ -1984,20 +1985,15 @@ (LE_READ_4(ni->ni_tstamp.data) >> 10); DPRINTF(sc, ATH_DEBUG_BEACON, "%s: nexttbtt %u intval %u\n", __func__, nexttbtt, ni->ni_intval); - nexttbtt += ni->ni_intval; - intval = ni->ni_intval & HAL_BEACON_PERIOD; + intval = MS_TO_TU(ni->ni_intval) & HAL_BEACON_PERIOD; + nexttbtt = roundup(nexttbtt, intval); if (ic->ic_opmode == IEEE80211_M_STA) { HAL_BEACON_STATE bs; u_int32_t bmisstime; /* NB: no PCF support right now */ memset(&bs, 0, sizeof(bs)); - /* - * Reset our tsf so the hardware will update the - * tsf register to reflect timestamps found in - * received beacons. - */ - bs.bs_intval = intval | HAL_BEACON_RESET_TSF; + bs.bs_intval = intval; bs.bs_nexttbtt = nexttbtt; bs.bs_dtimperiod = bs.bs_intval; bs.bs_nextdtim = nexttbtt; @@ -2016,8 +2012,8 @@ * TU's and then calculate based on the beacon interval. * Note that we clamp the result to at most 10 beacons. */ - bmisstime = (ic->ic_bmisstimeout * 1000) / 1024; - bs.bs_bmissthreshold = howmany(bmisstime,ni->ni_intval); + bmisstime = MS_TO_TU(ic->ic_bmisstimeout); + bs.bs_bmissthreshold = howmany(bmisstime, intval); if (bs.bs_bmissthreshold > 10) bs.bs_bmissthreshold = 10; else if (bs.bs_bmissthreshold <= 0) @@ -2032,8 +2028,7 @@ * * XXX fixed at 100ms */ - bs.bs_sleepduration = - roundup((100 * 1000) / 1024, bs.bs_intval); + bs.bs_sleepduration = roundup(MS_TO_TU(100), bs.bs_intval); if (bs.bs_sleepduration > bs.bs_dtimperiod) bs.bs_sleepduration = roundup(bs.bs_sleepduration, bs.bs_dtimperiod); @@ -2057,7 +2052,7 @@ ath_hal_intrset(ah, sc->sc_imask); } else { ath_hal_intrset(ah, 0); - if (nexttbtt == ni->ni_intval) + if (nexttbtt == intval) intval |= HAL_BEACON_RESET_TSF; if (ic->ic_opmode == IEEE80211_M_IBSS) { /* @@ -2088,6 +2083,7 @@ if (ic->ic_opmode == IEEE80211_M_IBSS && sc->sc_hasveol) ath_beacon_proc(sc, 0); } +#undef MS_TO_TU } static void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200412251931.iBPJV7tK056315>
