svn commit: r245185 - head/sys/dev/ath
Adrian Chadd
adrian at FreeBSD.org
Tue Jan 8 22:15:14 UTC 2013
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 */
More information about the svn-src-all
mailing list