Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 May 2011 08:11:22 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r221488 - head/sys/dev/ath/ath_hal/ar5416
Message-ID:  <201105050811.p458BMBW089688@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Thu May  5 08:11:22 2011
New Revision: 221488
URL: http://svn.freebsd.org/changeset/base/221488

Log:
  Don't perform NF calibration for radio chains which aren't in use:
  
  Quoting the ath9k commit message:
  
  At present the noise floor calibration is processed in supported
  control and extension chains rather than required chains.
  Unnccesarily doing nfcal in all supported chains leads to
  invalid nf readings on extn chains and these invalid values
  got updated into history buffer. While loading those values
  from history buffer is moving the chip to deaf state.
  
  This issue was observed in AR9002/AR9003 chips while doing
  associate/dissociate in HT40 mode and interface up/down
  in iterative manner. After some iterations, the chip was moved
  to deaf state. Somehow the pci devices are recovered by poll work
  after chip reset. Raading the nf values in all supported extension chains
  when the hw is not yet configured in HT40 mode results invalid values.
  
  Reference:	https://patchwork.kernel.org/patch/753862/
  
  Obtained from:	Linux ath9k

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Thu May  5 08:08:18 2011	(r221487)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c	Thu May  5 08:11:22 2011	(r221488)
@@ -620,9 +620,9 @@ ar5416LoadNF(struct ath_hal *ah, const s
 	HALDEBUG(ah, HAL_DEBUG_NFCAL, "CCA: ");
 	for (i = 0; i < AR5416_NUM_NF_READINGS; i ++) {
 
-		/* Don't write to EXT radio CCA registers */
+		/* Don't write to EXT radio CCA registers unless in HT/40 mode */
 		/* XXX this check should really be cleaner! */
-		if (i >= 3 && !IEEE80211_IS_CHAN_HT40(chan))
+		if (i > 2 && !IEEE80211_IS_CHAN_HT40(chan))
 			continue;
 
 		if (chainmask & (1 << i)) { 
@@ -670,6 +670,12 @@ ar5416LoadNF(struct ath_hal *ah, const s
 	 * of next noise floor calibration the baseband does.  
 	 */
 	for (i = 0; i < AR5416_NUM_NF_READINGS; i ++)
+
+		/* Don't write to EXT radio CCA registers unless in HT/40 mode */
+		/* XXX this check should really be cleaner! */
+		if (i > 2 && !IEEE80211_IS_CHAN_HT40(chan))
+			continue;
+
 		if (chainmask & (1 << i)) {	
 			val = OS_REG_READ(ah, ar5416_cca_regs[i]);
 			val &= 0xFFFFFE00;
@@ -701,10 +707,12 @@ ar5416InitNfHistBuff(struct ar5212NfCalH
  * Update the noise floor buffer as a ring buffer
  */
 static void
-ar5416UpdateNFHistBuff(struct ar5212NfCalHist *h, int16_t *nfarray)
+ar5416UpdateNFHistBuff(struct ath_hal *ah, struct ar5212NfCalHist *h,
+    int16_t *nfarray)
 {
 	int i;
 
+	/* XXX TODO: don't record nfarray[] entries for inactive chains */
 	for (i = 0; i < AR5416_NUM_NF_READINGS; i ++) {
 		h[i].nfCalBuffer[h[i].currIndex] = nfarray[i];
 
@@ -814,7 +822,7 @@ ar5416GetNf(struct ath_hal *ah, struct i
 		}
 		ichan->privFlags |= CHANNEL_MIMO_NF_VALID;
 
-		ar5416UpdateNFHistBuff(AH5416(ah)->ah_cal.nfCalHist, nfarray);
+		ar5416UpdateNFHistBuff(ah, AH5416(ah)->ah_cal.nfCalHist, nfarray);
 		ichan->rawNoiseFloor = nf;
 	}
 	return nf;



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