From owner-svn-src-head@FreeBSD.ORG Thu May 5 08:11:23 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BDC61065670; Thu, 5 May 2011 08:11:23 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 106978FC12; Thu, 5 May 2011 08:11:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p458BM2l089690; Thu, 5 May 2011 08:11:22 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p458BMBW089688; Thu, 5 May 2011 08:11:22 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201105050811.p458BMBW089688@svn.freebsd.org> From: Adrian Chadd Date: Thu, 5 May 2011 08:11:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221488 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 May 2011 08:11:23 -0000 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;