Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Mar 2011 15:46:05 +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: r219802 - head/sys/dev/ath/ath_hal/ar5416
Message-ID:  <201103201546.p2KFk5qd082973@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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
 }
 
 /*



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