From owner-svn-src-all@FreeBSD.ORG Sun Mar 20 15:46:05 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9739F106566B; Sun, 20 Mar 2011 15:46:05 +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 632C28FC0C; Sun, 20 Mar 2011 15:46:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2KFk57K082975; Sun, 20 Mar 2011 15:46:05 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2KFk5qd082973; Sun, 20 Mar 2011 15:46:05 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201103201546.p2KFk5qd082973@svn.freebsd.org> From: Adrian Chadd Date: Sun, 20 Mar 2011 15:46:05 +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: r219802 - head/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Mar 2011 15:46:05 -0000 Author: adrian Date: Sun Mar 20 15:46:05 2011 New Revision: 219802 URL: http://svn.freebsd.org/changeset/base/219802 Log: Disable a check I added a while ago to ensure the initial NF cal completed. Give it a good go (32 attempts) and then print out a warning that's going to occur whether HAL debugging is enabled or not. Then don't abort the radio setup; just continue merrily along. This should fix the issue that users were having where scanning would occasionally fail on the active channel, causing traffic to cease until the radio scanned again. 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 Sun Mar 20 15:04:43 2011 (r219801) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Sun Mar 20 15:46:05 2011 (r219802) @@ -235,11 +235,13 @@ ar5416InitCalHardware(struct ath_hal *ah /* * Initialize Calibration infrastructure. */ +#define MAX_CAL_CHECK 32 HAL_BOOL ar5416InitCal(struct ath_hal *ah, const struct ieee80211_channel *chan) { struct ar5416PerCal *cal = &AH5416(ah)->ah_cal; HAL_CHANNEL_INTERNAL *ichan; + int i; ichan = ath_hal_checkchannel(ah, chan); HALASSERT(ichan != AH_NULL); @@ -264,13 +266,29 @@ ar5416InitCal(struct ath_hal *ah, const /* XXX this actually kicks off a NF calibration -adrian */ OS_REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF); /* - * Try to make sure the above NF cal completes, just so - * it doesn't clash with subsequent percals -adrian + * This sometimes takes a -lot- longer than it should. + * Just give it a bit more time. */ - if (! ar5212WaitNFCalComplete(ah, 10000)) { + for (i = 0; i < MAX_CAL_CHECK; i++) { + if (ar5212WaitNFCalComplete(ah, 10000)) + break; + HALDEBUG(ah, HAL_DEBUG_ANY, "%s: initial NF calibration did " - "not complete in time; noisy environment?\n", __func__); - return AH_FALSE; + "not complete in time; noisy environment (pass %d)?\n", __func__, i); + } + + /* + * Although periodic and NF calibrations shouldn't run concurrently, + * this was causing the radio to not be usable on the active + * channel if the channel was busy. + * + * Instead, now simply print a warning and continue. That way if users + * report "weird crap", they should get this warning. + */ + if (i >= MAX_CAL_CHECK) { + ath_hal_printf(ah, "[ath] Warning - initial NF calibration did " + "not complete in time, noisy environment?\n"); + /* return AH_FALSE; */ } /* Initialize list pointers */ @@ -325,6 +343,7 @@ ar5416InitCal(struct ath_hal *ah, const ichan->calValid = 0; return AH_TRUE; +#undef MAX_CAL_CHECK } /*