svn commit: r227047 - user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416

Adrian Chadd adrian at FreeBSD.org
Thu Nov 3 03:00:40 UTC 2011


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;
 			}
 		}


More information about the svn-src-user mailing list