Reset the NIC if ANI is enabled or disabled.

Although this may not be what the original sysctl was designed to do,
it feels a bit more "expected".

Before, if ANI is disabled, the initial ANI parameters are still written
to the hardware, even if they're not enabled. "ANI enabled" would then
adjust the noise immunity parameters dynamically. Disabling ANI would
simply leave the existing noise immunity parameters where they are,
and disable the dynamic part.

The problem is that disabling ANI doesn't leave the hardware in
a consistent, predictable state - so asking a user to disable ANI
wouldn't actually reset the NIC to a consistent set of PHY signal
detection parameters, resulting in an unpredictable/unreliable outcome.
This makes it difficult to get reliable debugging information from
the user.

Approved by:	re (kib)
This commit is contained in:
Adrian Chadd 2011-07-29 23:55:17 +00:00
parent 7ea00a6866
commit f9da901e77
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=224502

View File

@ -354,7 +354,21 @@ ath_sysctl_intmit(SYSCTL_HANDLER_ARGS)
error = sysctl_handle_int(oidp, &intmit, 0, req);
if (error || !req->newptr)
return error;
return !ath_hal_setintmit(sc->sc_ah, intmit) ? EINVAL : 0;
/* reusing error; 1 here means "good"; 0 means "fail" */
error = ath_hal_setintmit(sc->sc_ah, intmit);
if (! error)
return EINVAL;
/*
* Reset the hardware here - disabling ANI in the HAL
* doesn't reset ANI related registers, so it'll leave
* things in an inconsistent state.
*/
if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING)
ath_reset(sc->sc_ifp);
return 0;
}
#ifdef IEEE80211_SUPPORT_TDMA