Commit 20977d3e authored by Sujith's avatar Sujith Committed by John W. Linville

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: default avatarSujith <Sujith.Manoharan@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent db0f41f5
...@@ -464,13 +464,11 @@ void ath_beacon_sync(struct ath_softc *sc, int if_id); ...@@ -464,13 +464,11 @@ void ath_beacon_sync(struct ath_softc *sc, int if_id);
/* ANI */ /* ANI */
/*******/ /*******/
/* ANI values for STA only. #define ATH_STA_SHORT_CALINTERVAL 1000 /* 1 second */
FIXME: Add appropriate values for AP later */ #define ATH_AP_SHORT_CALINTERVAL 100 /* 100 ms */
#define ATH_ANI_POLLINTERVAL 100 /* 100 ms */
#define ATH_ANI_POLLINTERVAL 100 /* 100 milliseconds between ANI poll */ #define ATH_LONG_CALINTERVAL 30000 /* 30 seconds */
#define ATH_SHORT_CALINTERVAL 1000 /* 1 second between calibrations */ #define ATH_RESTART_CALINTERVAL 1200000 /* 20 minutes */
#define ATH_LONG_CALINTERVAL 30000 /* 30 seconds between calibrations */
#define ATH_RESTART_CALINTERVAL 1200000 /* 20 minutes between calibrations */
struct ath_ani { struct ath_ani {
bool caldone; bool caldone;
......
...@@ -308,23 +308,23 @@ static int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan) ...@@ -308,23 +308,23 @@ static int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan)
*/ */
static void ath_ani_calibrate(unsigned long data) static void ath_ani_calibrate(unsigned long data)
{ {
struct ath_softc *sc; struct ath_softc *sc = (struct ath_softc *)data;
struct ath_hw *ah; struct ath_hw *ah = sc->sc_ah;
bool longcal = false; bool longcal = false;
bool shortcal = false; bool shortcal = false;
bool aniflag = false; bool aniflag = false;
unsigned int timestamp = jiffies_to_msecs(jiffies); unsigned int timestamp = jiffies_to_msecs(jiffies);
u32 cal_interval; u32 cal_interval, short_cal_interval;
sc = (struct ath_softc *)data; short_cal_interval = (ah->opmode == NL80211_IFTYPE_AP) ?
ah = sc->sc_ah; ATH_AP_SHORT_CALINTERVAL : ATH_STA_SHORT_CALINTERVAL;
/* /*
* don't calibrate when we're scanning. * don't calibrate when we're scanning.
* we are most likely not on our home channel. * we are most likely not on our home channel.
*/ */
if (sc->rx.rxfilter & FIF_BCN_PRBRESP_PROMISC) if (sc->rx.rxfilter & FIF_BCN_PRBRESP_PROMISC)
return; goto set_timer;
/* Long calibration runs independently of short calibration. */ /* Long calibration runs independently of short calibration. */
if ((timestamp - sc->ani.longcal_timer) >= ATH_LONG_CALINTERVAL) { if ((timestamp - sc->ani.longcal_timer) >= ATH_LONG_CALINTERVAL) {
...@@ -335,8 +335,7 @@ static void ath_ani_calibrate(unsigned long data) ...@@ -335,8 +335,7 @@ static void ath_ani_calibrate(unsigned long data)
/* Short calibration applies only while caldone is false */ /* Short calibration applies only while caldone is false */
if (!sc->ani.caldone) { if (!sc->ani.caldone) {
if ((timestamp - sc->ani.shortcal_timer) >= if ((timestamp - sc->ani.shortcal_timer) >= short_cal_interval) {
ATH_SHORT_CALINTERVAL) {
shortcal = true; shortcal = true;
DPRINTF(sc, ATH_DBG_ANI, "shortcal @%lu\n", jiffies); DPRINTF(sc, ATH_DBG_ANI, "shortcal @%lu\n", jiffies);
sc->ani.shortcal_timer = timestamp; sc->ani.shortcal_timer = timestamp;
...@@ -352,8 +351,7 @@ static void ath_ani_calibrate(unsigned long data) ...@@ -352,8 +351,7 @@ static void ath_ani_calibrate(unsigned long data)
} }
/* Verify whether we must check ANI */ /* Verify whether we must check ANI */
if ((timestamp - sc->ani.checkani_timer) >= if ((timestamp - sc->ani.checkani_timer) >= ATH_ANI_POLLINTERVAL) {
ATH_ANI_POLLINTERVAL) {
aniflag = true; aniflag = true;
sc->ani.checkani_timer = timestamp; sc->ani.checkani_timer = timestamp;
} }
...@@ -362,8 +360,7 @@ static void ath_ani_calibrate(unsigned long data) ...@@ -362,8 +360,7 @@ static void ath_ani_calibrate(unsigned long data)
if (longcal || shortcal || aniflag) { if (longcal || shortcal || aniflag) {
/* Call ANI routine if necessary */ /* Call ANI routine if necessary */
if (aniflag) if (aniflag)
ath9k_hw_ani_monitor(ah, &sc->nodestats, ath9k_hw_ani_monitor(ah, &sc->nodestats, ah->curchan);
ah->curchan);
/* Perform calibration if necessary */ /* Perform calibration if necessary */
if (longcal || shortcal) { if (longcal || shortcal) {
...@@ -392,6 +389,7 @@ static void ath_ani_calibrate(unsigned long data) ...@@ -392,6 +389,7 @@ static void ath_ani_calibrate(unsigned long data)
} }
} }
set_timer:
/* /*
* Set timer interval based on previous results. * Set timer interval based on previous results.
* The interval must be the shortest necessary to satisfy ANI, * The interval must be the shortest necessary to satisfy ANI,
...@@ -401,7 +399,7 @@ static void ath_ani_calibrate(unsigned long data) ...@@ -401,7 +399,7 @@ static void ath_ani_calibrate(unsigned long data)
if (sc->sc_ah->config.enable_ani) if (sc->sc_ah->config.enable_ani)
cal_interval = min(cal_interval, (u32)ATH_ANI_POLLINTERVAL); cal_interval = min(cal_interval, (u32)ATH_ANI_POLLINTERVAL);
if (!sc->ani.caldone) if (!sc->ani.caldone)
cal_interval = min(cal_interval, (u32)ATH_SHORT_CALINTERVAL); cal_interval = min(cal_interval, (u32)short_cal_interval);
mod_timer(&sc->ani.timer, jiffies + msecs_to_jiffies(cal_interval)); mod_timer(&sc->ani.timer, jiffies + msecs_to_jiffies(cal_interval));
} }
...@@ -924,8 +922,7 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc, ...@@ -924,8 +922,7 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
/* Start ANI */ /* Start ANI */
mod_timer(&sc->ani.timer, mod_timer(&sc->ani.timer,
jiffies + msecs_to_jiffies(ATH_ANI_POLLINTERVAL)); jiffies + msecs_to_jiffies(ATH_ANI_POLLINTERVAL));
} else { } else {
DPRINTF(sc, ATH_DBG_CONFIG, "Bss Info DISSOC\n"); DPRINTF(sc, ATH_DBG_CONFIG, "Bss Info DISSOC\n");
sc->curaid = 0; sc->curaid = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment