Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Jul 2011 23:55:17 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r224502 - head/sys/dev/ath
Message-ID:  <201107292355.p6TNtHcA071275@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107292355.p6TNtHcA071275>