From owner-svn-src-all@FreeBSD.ORG Tue Jan 8 22:15:14 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 41607FC3; Tue, 8 Jan 2013 22:15:14 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 348B9EEA; Tue, 8 Jan 2013 22:15:14 +0000 (UTC) Received: from svn.freebsd.org (svn.FreeBSD.org [8.8.178.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r08MFEq3025139; Tue, 8 Jan 2013 22:15:14 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r08MFDt6025137; Tue, 8 Jan 2013 22:15:13 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201301082215.r08MFDt6025137@svn.freebsd.org> From: Adrian Chadd Date: Tue, 8 Jan 2013 22:15:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r245185 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 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: Tue, 08 Jan 2013 22:15:14 -0000 Author: adrian Date: Tue Jan 8 22:15:13 2013 New Revision: 245185 URL: http://svnweb.freebsd.org/changeset/base/245185 Log: Add support for triggering spectral scan upon a channel reset/change. This is intended to support reporting FFT results during active channel scans, for users who would like to fiddle around with writing applications that do both FFT visualisation _and_ AP scanning. * add a new ioctl to enable/trigger spectral scan at channel change/reset; * set do_spectral consistently if it's enabled, so a channel set/reset will carry forth the correct PHY error configuration so frames are actually received; * for NICs that don't do spectral scan, don't bother checking the spectral scan state on channel change/reset. Tested: * AR9280 - STA and scanning; * AR5416 - STA, ensured that the SS code doesn't panic Modified: head/sys/dev/ath/if_ath_spectral.c head/sys/dev/ath/if_athioctl.h Modified: head/sys/dev/ath/if_ath_spectral.c ============================================================================== --- head/sys/dev/ath/if_ath_spectral.c Tue Jan 8 22:14:45 2013 (r245184) +++ head/sys/dev/ath/if_ath_spectral.c Tue Jan 8 22:15:13 2013 (r245185) @@ -73,8 +73,21 @@ __FBSDID("$FreeBSD$"); struct ath_spectral_state { HAL_SPECTRAL_PARAM spectral_state; - int spectral_active; - int spectral_enabled; + + /* + * Should we enable spectral scan upon + * each network interface reset/change? + * + * This is intended to allow spectral scan + * frame reporting during channel scans. + * + * Later on it can morph into a larger + * scale config method where it pushes + * a "channel scan" config into the hardware + * rather than just the spectral_state + * config. + */ + int spectral_enable_after_reset; }; /* @@ -135,7 +148,20 @@ ath_spectral_detach(struct ath_softc *sc int ath_spectral_enable(struct ath_softc *sc, struct ieee80211_channel *ch) { + struct ath_spectral_state *ss = sc->sc_spectral; + /* Default to disable spectral PHY reporting */ + sc->sc_dospectral = 0; + + if (ss == NULL) + return (0); + + if (ss->spectral_enable_after_reset) { + ath_hal_spectral_configure(sc->sc_ah, + &ss->spectral_state); + (void) ath_hal_spectral_start(sc->sc_ah); + sc->sc_dospectral = 1; + } return (0); } @@ -158,6 +184,7 @@ ath_ioctl_spectral(struct ath_softc *sc, HAL_SPECTRAL_PARAM peout; HAL_SPECTRAL_PARAM *pe; struct ath_spectral_state *ss = sc->sc_spectral; + int val; if (! ath_hal_spectral_supported(sc->sc_ah)) return (EINVAL); @@ -212,9 +239,32 @@ ath_ioctl_spectral(struct ath_softc *sc, ath_hal_spectral_configure(sc->sc_ah, &ss->spectral_state); (void) ath_hal_spectral_start(sc->sc_ah); + sc->sc_dospectral = 1; + /* XXX need to update the PHY mask in the driver */ break; case SPECTRAL_CONTROL_STOP: (void) ath_hal_spectral_stop(sc->sc_ah); + sc->sc_dospectral = 0; + /* XXX need to update the PHY mask in the driver */ + break; + case SPECTRAL_CONTROL_ENABLE_AT_RESET: + if (insize < sizeof(int)) { + device_printf(sc->sc_dev, "%d != %d\n", + insize, + sizeof(int)); + error = EINVAL; + break; + } + if (indata == NULL) { + device_printf(sc->sc_dev, "indata=NULL\n"); + error = EINVAL; + break; + } + val = * ((int *) indata); + if (val == 0) + ss->spectral_enable_after_reset = 0; + else + ss->spectral_enable_after_reset = 1; break; case SPECTRAL_CONTROL_ENABLE: /* XXX TODO */ Modified: head/sys/dev/ath/if_athioctl.h ============================================================================== --- head/sys/dev/ath/if_athioctl.h Tue Jan 8 22:14:45 2013 (r245184) +++ head/sys/dev/ath/if_athioctl.h Tue Jan 8 22:15:13 2013 (r245185) @@ -427,5 +427,7 @@ struct ath_tx_radiotap_header { #define SPECTRAL_CONTROL_STOP 5 #define SPECTRAL_CONTROL_GET_PARAMS 6 #define SPECTRAL_CONTROL_SET_PARAMS 7 +#define SPECTRAL_CONTROL_ENABLE_AT_RESET 8 +#define SPECTRAL_CONTROL_DISABLE_AT_RESET 9 #endif /* _DEV_ATH_ATHIOCTL_H */