svn commit: r211136 - head/sys/dev/ath

Adrian Chadd adrian at
Tue Aug 10 07:56:57 UTC 2010

Author: adrian
Date: Tue Aug 10 07:56:56 2010
New Revision: 211136

  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.


Modified: head/sys/dev/ath/if_ath.c
--- head/sys/dev/ath/if_ath.c	Tue Aug 10 07:48:13 2010	(r211135)
+++ head/sys/dev/ath/if_ath.c	Tue Aug 10 07:56:56 2010	(r211136)
@@ -5418,6 +5418,7 @@ ath_calibrate(void *arg)
 	longCal = (ticks - sc->sc_lastlongcal >= ath_longcalinterval*hz);
 	if (longCal) {
+		sc->sc_lastlongcal = ticks;
 		if (ath_hal_getrfgain(ah) == HAL_RFGAIN_NEED_CHANGE) {
 			 * Rfgain is out of bounds, reset the chip
@@ -5466,7 +5467,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)

More information about the svn-src-all mailing list