aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-12-19 12:01:50 -0500
committerJohn W. Linville <linville@tuxdriver.com>2013-12-19 14:41:56 -0500
commit63ded3f059f5c906fdef4b7f0663fb39c4d96c8e (patch)
treeebeebc78a32e8e2511aa64a05ed20c7b22ead201
parentc32e4e518f6642372c57ac9edbfb8274fa20c5e4 (diff)
ath9k: fix TSF offset precision issue
Dividing the beacon interval by ATH_BCBUF (8) truncates the result for the default beacon interval of 100. Fix the calculation by moving the division after conversion from TU to microseconds. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/beacon.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index accfb3b60daa..112aff720e13 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -279,13 +279,14 @@ static void ath9k_set_tsfadjust(struct ath_softc *sc, struct ieee80211_vif *vif)
279 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 279 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
280 struct ath_beacon_config *cur_conf = &sc->cur_beacon_conf; 280 struct ath_beacon_config *cur_conf = &sc->cur_beacon_conf;
281 struct ath_vif *avp = (void *)vif->drv_priv; 281 struct ath_vif *avp = (void *)vif->drv_priv;
282 u64 tsfadjust; 282 u32 tsfadjust;
283 283
284 if (avp->av_bslot == 0) 284 if (avp->av_bslot == 0)
285 return; 285 return;
286 286
287 tsfadjust = cur_conf->beacon_interval * avp->av_bslot / ATH_BCBUF; 287 tsfadjust = cur_conf->beacon_interval * avp->av_bslot;
288 avp->tsf_adjust = cpu_to_le64(TU_TO_USEC(tsfadjust)); 288 tsfadjust = TU_TO_USEC(tsfadjust) / ATH_BCBUF;
289 avp->tsf_adjust = cpu_to_le64(tsfadjust);
289 290
290 ath_dbg(common, CONFIG, "tsfadjust is: %llu for bslot: %d\n", 291 ath_dbg(common, CONFIG, "tsfadjust is: %llu for bslot: %d\n",
291 (unsigned long long)tsfadjust, avp->av_bslot); 292 (unsigned long long)tsfadjust, avp->av_bslot);