Patchwork [2/6] ath9k: Fix ANI monitoring

login
register
mail settings
Submitter Sujith Manoharan
Date June 4, 2013, 10:11 a.m.
Message ID <1370340695-29003-2-git-send-email-sujith@msujith.org>
Download mbox | patch
Permalink /patch/2658211/
State Not Applicable, archived
Headers show

Comments

Sujith Manoharan - June 4, 2013, 10:11 a.m.
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>

The commit "ath9k_hw: improve ANI processing and rx desensitizing parameters"
changed various ANI operational parameters to address a specific
card/environment. This is not really applicable for other cards
in general usage.

As per internal documentation, lowering the immunity level can be
done only after 5 periods have passed and the CCK/OFDM errors are
below the low watermak threshold - which have been fixed at 300 and
400 respectively by the sytems team.

Raising the immunity level can be done when CCK/OFDM errors exceed
600 and 1000 (per second).

Set these values once during attach.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath9k/ani.c | 29 +++++++++++++++++------------
 drivers/net/wireless/ath/ath9k/ani.h |  2 --
 2 files changed, 17 insertions(+), 14 deletions(-)
Felix Fietkau - June 4, 2013, 11:32 a.m.
On 2013-06-04 12:11 PM, Sujith Manoharan wrote:
> From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
> 
> The commit "ath9k_hw: improve ANI processing and rx desensitizing parameters"
> changed various ANI operational parameters to address a specific
> card/environment. This is not really applicable for other cards
> in general usage.
> 
> As per internal documentation, lowering the immunity level can be
> done only after 5 periods have passed and the CCK/OFDM errors are
> below the low watermak threshold - which have been fixed at 300 and
> 400 respectively by the sytems team.
> 
> Raising the immunity level can be done when CCK/OFDM errors exceed
> 600 and 1000 (per second).
> 
> Set these values once during attach.
> ---
> diff --git a/drivers/net/wireless/ath/ath9k/ani.h b/drivers/net/wireless/ath/ath9k/ani.h
> index 78b9fa9..1088472 100644
> --- a/drivers/net/wireless/ath/ath9k/ani.h
> +++ b/drivers/net/wireless/ath/ath9k/ani.h
> @@ -21,11 +21,9 @@
>  
>  /* units are errors per second */
>  #define ATH9K_ANI_OFDM_TRIG_HIGH          3500
> -#define ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI 1000
>  
>  /* units are errors per second */
>  #define ATH9K_ANI_OFDM_TRIG_LOW           400
> -#define ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI 900
>  
>  /* units are errors per second */
>  #define ATH9K_ANI_CCK_TRIG_HIGH           600
> 
With this patch, the raise-limit is always 3500, you should change it to
1000 when removing the above-/below-INI distinction.

- Felix
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sujith Manoharan - June 4, 2013, 11:47 a.m.
Felix Fietkau wrote:
> With this patch, the raise-limit is always 3500, you should change it to
> 1000 when removing the above-/below-INI distinction.

Thanks, I'll fix this and send a v2.

Sujith
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sujith Manoharan - June 4, 2013, 11:56 a.m.
Sujith Manoharan wrote:
> > With this patch, the raise-limit is always 3500, you should change it to
> > 1000 when removing the above-/below-INI distinction.
> 
> Thanks, I'll fix this and send a v2.

Actually, the changes appear to have been merged internally, for QCA988x.
So, I am not sure if we can keep the ANI tweaks.

Sujith
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sujith Manoharan - June 4, 2013, 12:04 p.m.
Sujith Manoharan wrote:
> Actually, the changes appear to have been merged internally, for QCA988x.
> So, I am not sure if we can keep the ANI tweaks.

Let's see if there is any improvement in this bug with
these patches: https://bugzilla.kernel.org/show_bug.cgi?id=49201

Sujith
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c
index 3ec4c53..1520e55 100644
--- a/drivers/net/wireless/ath/ath9k/ani.c
+++ b/drivers/net/wireless/ath/ath9k/ani.c
@@ -186,14 +186,6 @@  static void ath9k_hw_set_ofdm_nil(struct ath_hw *ah, u8 immunityLevel,
 				     ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
 				     entry_ofdm->ofdm_weak_signal_on);
 	}
-
-	if (aniState->ofdmNoiseImmunityLevel >= ATH9K_ANI_OFDM_DEF_LEVEL) {
-		ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH;
-		ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI;
-	} else {
-		ah->config.ofdm_trig_high = ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI;
-		ah->config.ofdm_trig_low = ATH9K_ANI_OFDM_TRIG_LOW;
-	}
 }
 
 static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
@@ -439,12 +431,25 @@  void ath9k_hw_ani_monitor(struct ath_hw *ah, struct ath9k_channel *chan)
 		ofdmPhyErrRate, aniState->cckNoiseImmunityLevel,
 		cckPhyErrRate, aniState->ofdmsTurn);
 
-	if (aniState->listenTime > ah->aniperiod) {
-		if (cckPhyErrRate < ah->config.cck_trig_low &&
-		    ofdmPhyErrRate < ah->config.ofdm_trig_low) {
+	if (aniState->listenTime > 5 * ah->aniperiod) {
+		/*
+		 * Check if we need to lower immunity if
+		 * 5 ani_periods have passed.
+		 */
+		if (ofdmPhyErrRate <= ah->config.ofdm_trig_low &&
+		    cckPhyErrRate <= ah->config.cck_trig_low) {
 			ath9k_hw_ani_lower_immunity(ah);
 			aniState->ofdmsTurn = !aniState->ofdmsTurn;
-		} else if (ofdmPhyErrRate > ah->config.ofdm_trig_high) {
+		}
+		ath9k_ani_restart(ah);
+	} else if (aniState->listenTime > ah->aniperiod) {
+		/*
+		 * Check if immunity has to be raised,
+		 * (either OFDM or CCK).
+		 */
+		if (ofdmPhyErrRate > ah->config.ofdm_trig_high &&
+		    (cckPhyErrRate <= ah->config.cck_trig_high ||
+		     aniState->ofdmsTurn)) {
 			ath9k_hw_ani_ofdm_err_trigger(ah);
 			aniState->ofdmsTurn = false;
 		} else if (cckPhyErrRate > ah->config.cck_trig_high) {
diff --git a/drivers/net/wireless/ath/ath9k/ani.h b/drivers/net/wireless/ath/ath9k/ani.h
index 78b9fa9..1088472 100644
--- a/drivers/net/wireless/ath/ath9k/ani.h
+++ b/drivers/net/wireless/ath/ath9k/ani.h
@@ -21,11 +21,9 @@ 
 
 /* units are errors per second */
 #define ATH9K_ANI_OFDM_TRIG_HIGH          3500
-#define ATH9K_ANI_OFDM_TRIG_HIGH_BELOW_INI 1000
 
 /* units are errors per second */
 #define ATH9K_ANI_OFDM_TRIG_LOW           400
-#define ATH9K_ANI_OFDM_TRIG_LOW_ABOVE_INI 900
 
 /* units are errors per second */
 #define ATH9K_ANI_CCK_TRIG_HIGH           600