aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/main.c
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2009-02-20 04:43:28 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-27 14:52:49 -0500
commit20977d3e685abb8b84c385426c39de1fca0a58ac (patch)
treea68b114815f43b408514724dcb38c41ba3f4482f /drivers/net/wireless/ath9k/main.c
parentdb0f41f556620ed73e8beaafb820baf53f863df9 (diff)
ath9k: Add appropriate ANI values for AP mode
The short calibration interval is different for AP mode, fix this. Also, the timer should be rearmed in the calibration routine during scanning. Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/main.c')
-rw-r--r--drivers/net/wireless/ath9k/main.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 7264c4c36a5f..b47cbe9e7a5a 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -308,23 +308,23 @@ static int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan)
308 */ 308 */
309static void ath_ani_calibrate(unsigned long data) 309static void ath_ani_calibrate(unsigned long data)
310{ 310{
311 struct ath_softc *sc; 311 struct ath_softc *sc = (struct ath_softc *)data;
312 struct ath_hw *ah; 312 struct ath_hw *ah = sc->sc_ah;
313 bool longcal = false; 313 bool longcal = false;
314 bool shortcal = false; 314 bool shortcal = false;
315 bool aniflag = false; 315 bool aniflag = false;
316 unsigned int timestamp = jiffies_to_msecs(jiffies); 316 unsigned int timestamp = jiffies_to_msecs(jiffies);
317 u32 cal_interval; 317 u32 cal_interval, short_cal_interval;
318 318
319 sc = (struct ath_softc *)data; 319 short_cal_interval = (ah->opmode == NL80211_IFTYPE_AP) ?
320 ah = sc->sc_ah; 320 ATH_AP_SHORT_CALINTERVAL : ATH_STA_SHORT_CALINTERVAL;
321 321
322 /* 322 /*
323 * don't calibrate when we're scanning. 323 * don't calibrate when we're scanning.
324 * we are most likely not on our home channel. 324 * we are most likely not on our home channel.
325 */ 325 */
326 if (sc->rx.rxfilter & FIF_BCN_PRBRESP_PROMISC) 326 if (sc->rx.rxfilter & FIF_BCN_PRBRESP_PROMISC)
327 return; 327 goto set_timer;
328 328
329 /* Long calibration runs independently of short calibration. */ 329 /* Long calibration runs independently of short calibration. */
330 if ((timestamp - sc->ani.longcal_timer) >= ATH_LONG_CALINTERVAL) { 330 if ((timestamp - sc->ani.longcal_timer) >= ATH_LONG_CALINTERVAL) {
@@ -335,8 +335,7 @@ static void ath_ani_calibrate(unsigned long data)
335 335
336 /* Short calibration applies only while caldone is false */ 336 /* Short calibration applies only while caldone is false */
337 if (!sc->ani.caldone) { 337 if (!sc->ani.caldone) {
338 if ((timestamp - sc->ani.shortcal_timer) >= 338 if ((timestamp - sc->ani.shortcal_timer) >= short_cal_interval) {
339 ATH_SHORT_CALINTERVAL) {
340 shortcal = true; 339 shortcal = true;
341 DPRINTF(sc, ATH_DBG_ANI, "shortcal @%lu\n", jiffies); 340 DPRINTF(sc, ATH_DBG_ANI, "shortcal @%lu\n", jiffies);
342 sc->ani.shortcal_timer = timestamp; 341 sc->ani.shortcal_timer = timestamp;
@@ -352,8 +351,7 @@ static void ath_ani_calibrate(unsigned long data)
352 } 351 }
353 352
354 /* Verify whether we must check ANI */ 353 /* Verify whether we must check ANI */
355 if ((timestamp - sc->ani.checkani_timer) >= 354 if ((timestamp - sc->ani.checkani_timer) >= ATH_ANI_POLLINTERVAL) {
356 ATH_ANI_POLLINTERVAL) {
357 aniflag = true; 355 aniflag = true;
358 sc->ani.checkani_timer = timestamp; 356 sc->ani.checkani_timer = timestamp;
359 } 357 }
@@ -362,8 +360,7 @@ static void ath_ani_calibrate(unsigned long data)
362 if (longcal || shortcal || aniflag) { 360 if (longcal || shortcal || aniflag) {
363 /* Call ANI routine if necessary */ 361 /* Call ANI routine if necessary */
364 if (aniflag) 362 if (aniflag)
365 ath9k_hw_ani_monitor(ah, &sc->nodestats, 363 ath9k_hw_ani_monitor(ah, &sc->nodestats, ah->curchan);
366 ah->curchan);
367 364
368 /* Perform calibration if necessary */ 365 /* Perform calibration if necessary */
369 if (longcal || shortcal) { 366 if (longcal || shortcal) {
@@ -392,6 +389,7 @@ static void ath_ani_calibrate(unsigned long data)
392 } 389 }
393 } 390 }
394 391
392set_timer:
395 /* 393 /*
396 * Set timer interval based on previous results. 394 * Set timer interval based on previous results.
397 * The interval must be the shortest necessary to satisfy ANI, 395 * The interval must be the shortest necessary to satisfy ANI,
@@ -401,7 +399,7 @@ static void ath_ani_calibrate(unsigned long data)
401 if (sc->sc_ah->config.enable_ani) 399 if (sc->sc_ah->config.enable_ani)
402 cal_interval = min(cal_interval, (u32)ATH_ANI_POLLINTERVAL); 400 cal_interval = min(cal_interval, (u32)ATH_ANI_POLLINTERVAL);
403 if (!sc->ani.caldone) 401 if (!sc->ani.caldone)
404 cal_interval = min(cal_interval, (u32)ATH_SHORT_CALINTERVAL); 402 cal_interval = min(cal_interval, (u32)short_cal_interval);
405 403
406 mod_timer(&sc->ani.timer, jiffies + msecs_to_jiffies(cal_interval)); 404 mod_timer(&sc->ani.timer, jiffies + msecs_to_jiffies(cal_interval));
407} 405}
@@ -924,8 +922,7 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
924 922
925 /* Start ANI */ 923 /* Start ANI */
926 mod_timer(&sc->ani.timer, 924 mod_timer(&sc->ani.timer,
927 jiffies + msecs_to_jiffies(ATH_ANI_POLLINTERVAL)); 925 jiffies + msecs_to_jiffies(ATH_ANI_POLLINTERVAL));
928
929 } else { 926 } else {
930 DPRINTF(sc, ATH_DBG_CONFIG, "Bss Info DISSOC\n"); 927 DPRINTF(sc, ATH_DBG_CONFIG, "Bss Info DISSOC\n");
931 sc->curaid = 0; 928 sc->curaid = 0;