aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSujith Manoharan <Sujith.Manoharan@atheros.com>2011-02-20 21:20:01 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-02-23 16:25:28 -0500
commit200be651f77f8407086873520436bf55a4468e26 (patch)
tree81eaf8a105f904768326f736bc0ae38395c2841c
parenta5fae37d118bb633708b2787e53871e38bf3b15e (diff)
ath9k_htc: Fix TBTT calculation for IBSS mode
The target beacon transmission time has to be synced with the HW TSF when configuring beacon timers in Adhoc mode. Failing to do this would cause erroneous beacon transmission, for example, on completion of a scan run to check for IBSS merges. Signed-off-by: Sujith Manoharan <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_beacon.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
index e897a56695b2..007b99fc50c8 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_beacon.c
@@ -188,20 +188,31 @@ static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv *priv,
188{ 188{
189 struct ath_common *common = ath9k_hw_common(priv->ah); 189 struct ath_common *common = ath9k_hw_common(priv->ah);
190 enum ath9k_int imask = 0; 190 enum ath9k_int imask = 0;
191 u32 nexttbtt, intval; 191 u32 nexttbtt, intval, tsftu;
192 __be32 htc_imask = 0; 192 __be32 htc_imask = 0;
193 int ret; 193 int ret;
194 u8 cmd_rsp; 194 u8 cmd_rsp;
195 u64 tsf;
195 196
196 intval = bss_conf->beacon_interval & ATH9K_BEACON_PERIOD; 197 intval = bss_conf->beacon_interval & ATH9K_BEACON_PERIOD;
197 nexttbtt = intval; 198 nexttbtt = intval;
199
200 /*
201 * Pull nexttbtt forward to reflect the current TSF.
202 */
203 tsf = ath9k_hw_gettsf64(priv->ah);
204 tsftu = TSF_TO_TU(tsf >> 32, tsf) + FUDGE;
205 do {
206 nexttbtt += intval;
207 } while (nexttbtt < tsftu);
208
198 intval |= ATH9K_BEACON_ENA; 209 intval |= ATH9K_BEACON_ENA;
199 if (priv->op_flags & OP_ENABLE_BEACON) 210 if (priv->op_flags & OP_ENABLE_BEACON)
200 imask |= ATH9K_INT_SWBA; 211 imask |= ATH9K_INT_SWBA;
201 212
202 ath_dbg(common, ATH_DBG_BEACON, 213 ath_dbg(common, ATH_DBG_CONFIG,
203 "IBSS Beacon config, intval: %d, imask: 0x%x\n", 214 "IBSS Beacon config, intval: %d, nexttbtt: %u, imask: 0x%x\n",
204 bss_conf->beacon_interval, imask); 215 bss_conf->beacon_interval, nexttbtt, imask);
205 216
206 WMI_CMD(WMI_DISABLE_INTR_CMDID); 217 WMI_CMD(WMI_DISABLE_INTR_CMDID);
207 ath9k_hw_beaconinit(priv->ah, nexttbtt, intval); 218 ath9k_hw_beaconinit(priv->ah, nexttbtt, intval);