Skip to contentSkip to conversation

ath9k: fix ad-hoc nexttbtt calculation

PATCH New Felix Fietkau 1 participant 1 message May 17, 2011 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath9k: fix ad-hoc nexttbtt calculation

rounding up the delta between last-beacon-tsf and tsf to intval is wrong and can lead to misconfigured timers which breaks beacon transmission. Fix this by adding intval and subtracting the offset of the tsf within the current slot.

---
 drivers/net/wireless/ath/ath9k/beacon.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/ath/ath9k/beacon.c +1 -1
index c7f4679..0199af0 100644
@@ -654,7 +654,7 @@ static void ath_beacon_config_adhoc(struct ath_softc *sc,
 			delta = (tsf - sc->beacon.bc_tstamp);
 		else
 			delta = (tsf + 1 + (~0U - sc->beacon.bc_tstamp));
-		nexttbtt = tsf + roundup(delta, intval);
+		nexttbtt = tsf + intval - (delta % intval);
 	}
 
 	ath_dbg(common, ATH_DBG_BEACON,
Signature · 1 line
1.7.3.2