From owner-svn-src-all@FreeBSD.ORG Fri Jul 29 23:55:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBD9A106566B; Fri, 29 Jul 2011 23:55:17 +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 CCB438FC13; Fri, 29 Jul 2011 23:55:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p6TNtHIp071277; Fri, 29 Jul 2011 23:55:17 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p6TNtHcA071275; Fri, 29 Jul 2011 23:55:17 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201107292355.p6TNtHcA071275@svn.freebsd.org> From: Adrian Chadd Date: Fri, 29 Jul 2011 23:55:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224502 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2011 23:55:18 -0000 Author: adrian Date: Fri Jul 29 23:55:17 2011 New Revision: 224502 URL: http://svn.freebsd.org/changeset/base/224502 Log: 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) Modified: head/sys/dev/ath/if_ath_sysctl.c Modified: head/sys/dev/ath/if_ath_sysctl.c ============================================================================== --- head/sys/dev/ath/if_ath_sysctl.c Fri Jul 29 22:11:05 2011 (r224501) +++ head/sys/dev/ath/if_ath_sysctl.c Fri Jul 29 23:55:17 2011 (r224502) @@ -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