From owner-svn-src-user@FreeBSD.ORG Fri Jul 30 14:29:55 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 4A2E11065678; Fri, 30 Jul 2010 14:29:55 +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 1EE628FC08; Fri, 30 Jul 2010 14:29:55 +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 o6UETt2j087354; Fri, 30 Jul 2010 14:29:55 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6UETsmb087352; Fri, 30 Jul 2010 14:29:54 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201007301429.o6UETsmb087352@svn.freebsd.org> From: Adrian Chadd Date: Fri, 30 Jul 2010 14:29:54 +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: r210653 - user/adrian/if_ath_devel/sys/dev/ath 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 14:29:55 -0000 Author: adrian Date: Fri Jul 30 14:29:54 2010 New Revision: 210653 URL: http://svn.freebsd.org/changeset/base/210653 Log: Don't delay updating the longcal timer - instead, update the longcal flag immediately so it's only set once per longcal interval. Without this, the current AR5416 code will continuously spam NF calibrations during a periodic calibration if the longcal flag is set. The longcal flag wouldn't be cleared until the calibration method indicates that calibrations are "complete". This drops the rate of NF calibration updates down from "once every shortcal" (ie, every 100ms) during a periodic calibration, to only once per "longcal" interval. Spamming NF calibrations every 100ms caused some potentially horrific issues in noisy environments as NF calibrations can take longer than 100ms and this spamming can cause invalid NF calibration results to be read back - leading to missed beacons, and thus leading to a stuck beacon situation. Stuck beacons cause interface resets, which restart calibrations. This means that the longcal calibration runs every 100ms (shortcal) until all initial calibrations are completed. This spamming can then cause the above issues which leads to stuck beacons, leading to interface resets, etc, etc. Quite annoying. This may be a temporary hack until I shoehorn more sensible calibration stuff into the AR5416 code. It shouldn't affect the other chipsets, they don't run a calibration FSM as complicated as AR5416. Modified: user/adrian/if_ath_devel/sys/dev/ath/if_ath.c Modified: user/adrian/if_ath_devel/sys/dev/ath/if_ath.c ============================================================================== --- user/adrian/if_ath_devel/sys/dev/ath/if_ath.c Fri Jul 30 14:05:20 2010 (r210652) +++ user/adrian/if_ath_devel/sys/dev/ath/if_ath.c Fri Jul 30 14:29:54 2010 (r210653) @@ -5421,6 +5421,7 @@ ath_calibrate(void *arg) longCal = (ticks - sc->sc_lastlongcal >= ath_longcalinterval*hz); if (longCal) { sc->sc_stats.ast_per_cal++; + sc->sc_lastlongcal = ticks; if (ath_hal_getrfgain(ah) == HAL_RFGAIN_NEED_CHANGE) { /* * Rfgain is out of bounds, reset the chip @@ -5469,7 +5470,6 @@ restart: nextcal *= 10; } else { nextcal = ath_longcalinterval*hz; - sc->sc_lastlongcal = ticks; if (sc->sc_lastcalreset == 0) sc->sc_lastcalreset = sc->sc_lastlongcal; else if (ticks - sc->sc_lastcalreset >= ath_resetcalinterval*hz)