Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Nov 2011 03:00:40 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r227047 - user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416
Message-ID:  <201111030300.pA330eQL049763@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Thu Nov  3 03:00:39 2011
New Revision: 227047
URL: http://svn.freebsd.org/changeset/base/227047

Log:
  ANI fixes, inspired by the Atheros reference code.
  
  * Since some items may be disabled or out of range, don't stop trying
    once a value is modified. The call to ar5416AniControl() may fail
    because the value is disabled or out of range, so fall through to
    the next value.
  
  * If in hostap mode, the beacon-RSSI-based logic for ANI twiddling
    can't be used, so instead just step firstep up to max.
  
  Although this change doesn't currently implement it, winding up
  firstep manually up to 16 (which isn't done here) does quieten
  most of the residual CCK/OFDM errors in hostap mode in a busy
  2.4ghz environment. I won't commit that (yet) until I've tested it
  with real traffic.
  
  Obtained from:	Atheros

Modified:
  user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c

Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c	Thu Nov  3 02:48:15 2011	(r227046)
+++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c	Thu Nov  3 03:00:39 2011	(r227047)
@@ -384,20 +384,31 @@ ar5416AniOfdmErrTrigger(struct ath_hal *
 	aniState = ahp->ah_curani;
 	params = aniState->params;
 	/* First, raise noise immunity level, up to max */
-	if ((AH5416(ah)->ah_ani_function & (1 << HAL_ANI_NOISE_IMMUNITY_LEVEL)) &&
-	    (aniState->noiseImmunityLevel+1 < params->maxNoiseImmunityLevel)) {
-		ar5416AniControl(ah, HAL_ANI_NOISE_IMMUNITY_LEVEL, 
-				 aniState->noiseImmunityLevel + 1);
+	if (aniState->noiseImmunityLevel+1 < params->maxNoiseImmunityLevel) {
+		if (ar5416AniControl(ah, HAL_ANI_NOISE_IMMUNITY_LEVEL, 
+				 aniState->noiseImmunityLevel + 1))
 		return;
 	}
 	/* then, raise spur immunity level, up to max */
-	if ((AH5416(ah)->ah_ani_function & (1 << HAL_ANI_SPUR_IMMUNITY_LEVEL)) &&
-	    (aniState->spurImmunityLevel+1 < params->maxSpurImmunityLevel)) {
-		ar5416AniControl(ah, HAL_ANI_SPUR_IMMUNITY_LEVEL,
-				 aniState->spurImmunityLevel + 1);
+	if (aniState->spurImmunityLevel+1 < params->maxSpurImmunityLevel) {
+		if (ar5416AniControl(ah, HAL_ANI_SPUR_IMMUNITY_LEVEL,
+				 aniState->spurImmunityLevel + 1))
 		return;
 	}
 
+	/*
+	 * In the case of AP mode operation, we cannot bucketize beacons
+	 * according to RSSI.  Instead, raise Firstep level, up to max, and
+	 * simply return.
+	 */
+	if (AH_PRIVATE(ah)->ah_opmode == HAL_M_HOSTAP) {
+		if (aniState->firstepLevel < params->maxFirstepLevel) {
+			if (ar5416AniControl(ah, HAL_ANI_FIRSTEP_LEVEL,
+			    aniState->firstepLevel + 1))
+				return;
+		}
+	}
+
 	if (ANI_ENA_RSSI(ah)) {
 		int32_t rssi = BEACON_RSSI(ahp);
 		if (rssi > params->rssiThrHigh) {
@@ -418,8 +429,8 @@ ar5416AniOfdmErrTrigger(struct ath_hal *
 			 * raise firstep level 
 			 */
 			if (aniState->firstepLevel+1 < params->maxFirstepLevel) {
-				ar5416AniControl(ah, HAL_ANI_FIRSTEP_LEVEL,
-						 aniState->firstepLevel + 1);
+				if (ar5416AniControl(ah, HAL_ANI_FIRSTEP_LEVEL,
+						 aniState->firstepLevel + 1))
 				return;
 			}
 		} else if (rssi > params->rssiThrLow) {
@@ -432,9 +443,9 @@ ar5416AniOfdmErrTrigger(struct ath_hal *
 				    HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION,
 				    AH_TRUE);
 			if (aniState->firstepLevel+1 < params->maxFirstepLevel)
-				ar5416AniControl(ah, HAL_ANI_FIRSTEP_LEVEL,
-				     aniState->firstepLevel + 1);
-			return;
+				if (ar5416AniControl(ah, HAL_ANI_FIRSTEP_LEVEL,
+				     aniState->firstepLevel + 1))
+				return;
 		} else {
 			/* 
 			 * Beacon rssi is low, if in 11b/g mode, turn off ofdm
@@ -447,8 +458,8 @@ ar5416AniOfdmErrTrigger(struct ath_hal *
 					    HAL_ANI_OFDM_WEAK_SIGNAL_DETECTION,
 					    AH_FALSE);
 				if (aniState->firstepLevel > 0)
-					ar5416AniControl(ah,
-					     HAL_ANI_FIRSTEP_LEVEL, 0);
+					(ar5416AniControl(ah,
+					     HAL_ANI_FIRSTEP_LEVEL, 0));
 				return;
 			}
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201111030300.pA330eQL049763>