From owner-svn-src-user@FreeBSD.ORG Fri Jul 30 15:56:01 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 089631065678; Fri, 30 Jul 2010 15:56:01 +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 D0C138FC18; Fri, 30 Jul 2010 15:56:00 +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 o6UFu0Ws006530; Fri, 30 Jul 2010 15:56:00 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6UFu0LM006528; Fri, 30 Jul 2010 15:56:00 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201007301556.o6UFu0LM006528@svn.freebsd.org> From: Adrian Chadd Date: Fri, 30 Jul 2010 15:56:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210658 - user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Jul 2010 15:56:01 -0000 Author: adrian Date: Fri Jul 30 15:56:00 2010 New Revision: 210658 URL: http://svn.freebsd.org/changeset/base/210658 Log: Fix the NF calibration to only occur if a periodic calibration is not in progress. Since I've also seen periodic calibrations take forever (as in, up to an hour to do the 64 samples needed for a percal), longcal may never get set during a time where there isn't an in-progress percal. To avoid this, perform a longcal immediately after the last successful periodic calibration sample is read. There shouldn't be any further periodic calibrations performed if *isCalDone is set to AH_TRUE. This means that there'll be at least one NF calibration and sample done at the end of each periodic calibration. I'm not sure whether a NF sample and/or calibration can be taken in between calibration samples (whether it'll upset the calibration process, which I don't have any documentation on atm) so I'm not interleaving NF and periodic calibration sampling. Modified: user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Modified: user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c ============================================================================== --- user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Fri Jul 30 15:36:57 2010 (r210657) +++ user/adrian/if_ath_devel/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Fri Jul 30 15:56:00 2010 (r210658) @@ -470,8 +470,26 @@ ar5416PerCalibrationN(struct ath_hal *ah } } - /* Do NF cal only at longer intervals */ - if (longcal) { + /* + * NF calibration can only be done if there's no in-progress periodic + * calibration. + * + * To ensure it happens, an NF calibration is done at the end of the + * periodic calibration run. That way if the periodic calibrations are + * taking too long to run and prevent the "longcal" tick from actually + * performing a successful NF calibration, the noise floor values still + * get updated. + */ + + /* Do NF cal only at longer intervals or at the end of a successful percal */ + /* + * XXX I don't know if there's some minimum delay between completing a percal + * XXX and beginning a NF calibration. -adrian + */ + if ((*isCalDone == AH_TRUE) || + (longcal && currCal == AH_NULL) || + (longcal && currCal != AH_NULL && + (currCal->calState == CAL_WAITING || currCal->calState == CAL_DONE))) { /* * Get the value from the previous NF cal * and update the history buffer.