From 872f3a66ddd5353164fd497486cbc6436ee8c2f7 Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Mon, 28 Nov 2016 17:06:35 +0000 Subject: [PATCH] [ath] revert the previous commit, after reading the 802.11-2012 spec a bit more. The 802.11-2012 spec talks about this - section 10.1.3.2 - Beacon Generation in Infrastructure Networks. So yes, we should be expecting beacons to be going out in multiples of intval. Silly adrian. So: * fix the FreeBSD APs that are sending beacons at incorrect TBTTs (target beacon transmit time); and * yes indeed we will have to wake up out of network sleep until we sync a beacon. --- sys/dev/ath/if_ath_beacon.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/sys/dev/ath/if_ath_beacon.c b/sys/dev/ath/if_ath_beacon.c index 629457d45bed..a9c0af931ba4 100644 --- a/sys/dev/ath/if_ath_beacon.c +++ b/sys/dev/ath/if_ath_beacon.c @@ -965,9 +965,9 @@ ath_beacon_config(struct ath_softc *sc, struct ieee80211vap *vap) intval = ni->ni_intval & HAL_BEACON_PERIOD; } - /* - * Note: rounding up to the next intval can cause problems. + * Note: rounding up to the next intval can cause problems with + * bad APs when we're in powersave mode. * * In STA mode with powersave enabled, beacons are only received * whenever the beacon timer fires to wake up the hardware. @@ -975,17 +975,14 @@ ath_beacon_config(struct ath_softc *sc, struct ieee80211vap *vap) * that the AP has started transmitting beacons at TSF values that * are multiples of intval, versus say being 25 TU off. * - * I'm not sure why nexttbtt is rounded up to the intval. - * If we sync against a beacon that is way out, we should - * take a beacon miss and re-sync against the next beacon. - * - * So for now - don't round up if we're in STA mode. - * Maybe later (when someone eventually does powersave+IBSS, - * powersave+MBSS) this can be flipped on for those too. + * The specification (802.11-2012 10.1.3.2 - Beacon Generation in + * Infrastructure Networks) requires APs be beaconing at a + * mutiple of intval. So, if bintval=100, then we shouldn't + * get beacons at intervals other than around multiples of 100. */ if (nexttbtt == 0) /* e.g. for ap mode */ nexttbtt = intval; - else if ((ic->ic_opmode != IEEE80211_M_STA) && intval) /* NB: can be 0 for monitor mode */ + else nexttbtt = roundup(nexttbtt, intval); DPRINTF(sc, ATH_DEBUG_BEACON, "%s: nexttbtt %u intval %u (%u)\n",