ath10k spectral scan support
Subsystems (3)
v3 cover ath10k spectral scan support
This is the third "PATCH" patchset iteration for the ath10k spectral scan feature. It includes quite a few style fixes, the compile issues were fixed when debugfs were disabled, and sending WMI commands after a firmware crash should not happen any more. Thanks to Michal, Chun-Yeow and Kalle for reviewing!
To view the samples, please have a look at the fft_eval tool [1] which now supports both ath9k and ath10k formats.
The count issue is still open: Even when a count is specified, the hardware seems to send endless samples. It seems to work most of the time in VHT80 mode though, but in HT20 and HT40 the count value seems to be ignored. To reproduce this, start hostapd with the desired channel width and do:
echo 8 > /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_count echo manual > /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctl echo trigger > /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctl cat /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan0 >> /tmp/fft.dump
Repeating the last line and checking the filesize will easily show whether ath10k still sends samples or not. We would expect 8 samples in this configuration.
Please see the patches for more information on the changes.
Cheers,
Simon
[1] https://github.com/simonwunderlich/FFT_eval
Simon Wunderlich (1):
ath10k: add spectral scan feature
Sven Eckelmann (1):
ath: Move spectral debugfs structs to shared header
drivers/net/wireless/ath/ath10k/Kconfig | 1 + drivers/net/wireless/ath/ath10k/Makefile | 1 + drivers/net/wireless/ath/ath10k/core.c | 7 +- drivers/net/wireless/ath/ath10k/core.h | 10 + drivers/net/wireless/ath/ath10k/debug.c | 3 + drivers/net/wireless/ath/ath10k/mac.c | 7 + drivers/net/wireless/ath/ath10k/spectral.c | 557 +++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/spectral.h | 82 +++++ drivers/net/wireless/ath/ath10k/wmi.c | 104 +++++- drivers/net/wireless/ath/ath10k/wmi.h | 97 +++++ drivers/net/wireless/ath/ath9k/spectral.h | 71 +--- drivers/net/wireless/ath/spectral_common.h | 113 ++++++ 12 files changed, 982 insertions(+), 71 deletions(-) create mode 100644 drivers/net/wireless/ath/ath10k/spectral.c create mode 100644 drivers/net/wireless/ath/ath10k/spectral.h create mode 100644 drivers/net/wireless/ath/spectral_common.h
Signature · 1 line
1.9.1
PATCH v3 1/2 ath: Move spectral debugfs structs to shared header
From: Sven Eckelmann <[email protected]>
The ath9k and ath10k will share the definitions of the debugfs spectral structures and enums. Having them in the same place helps to avoid conflicts.
--- drivers/net/wireless/ath/ath9k/spectral.h | 71 +----------------------- drivers/net/wireless/ath/spectral_common.h | 88 ++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 69 deletions(-) create mode 100644 drivers/net/wireless/ath/spectral_common.h
drivers/net/wireless/ath/ath9k/spectral.h +2 -69
@@ -17,6 +17,8 @@#ifndef SPECTRAL_H #define SPECTRAL_H +#include "../spectral_common.h" +/* enum spectral_mode: * * @SPECTRAL_DISABLED: spectral mode is disabled
@@ -54,8 +56,6 @@ struct ath_ht20_mag_info {u8 max_exp; } __packed; -#define SPECTRAL_HT20_NUM_BINS 56 -/* WARNING: don't actually use this struct! MAC may vary the amount of * data by -1/+2. This struct is for reference only. */
@@ -83,8 +83,6 @@ struct ath_ht20_40_mag_info {u8 max_exp; } __packed; -#define SPECTRAL_HT20_40_NUM_BINS 128 -/* WARNING: don't actually use this struct! MAC may vary the amount of * data. This struct is for reference only. */
@@ -125,71 +123,6 @@ static inline u8 spectral_bitmap_weight(u8 *bins)return bins[0 ] &0x3f ; } -/* FFT sample format given to userspace via debugfs. -* -* Please keep the type/length at the front position and change -* other fields after adding another sample type -* -* TODO: this might need rework when switching to nl80211-based -* interface. -*/ -enum ath_fft_sample_type { -ATH_FFT_SAMPLE_HT20 =1 , -ATH_FFT_SAMPLE_HT20_40 , -}; - -struct fft_sample_tlv { -u8 type;/* see ath_fft_sample */ -__be16 length; -/* type dependent data follows */ -} __packed; - -struct fft_sample_ht20 { -struct fft_sample_tlv tlv; - -u8 max_exp; - -__be16 freq; -s8 rssi; -s8 noise; - -__be16 max_magnitude; -u8 max_index; -u8 bitmap_weight; - -__be64 tsf; - -u8 data[SPECTRAL_HT20_NUM_BINS ]; -} __packed; - -struct fft_sample_ht20_40 { -struct fft_sample_tlv tlv; - -u8 channel_type; -__be16 freq; - -s8 lower_rssi; -s8 upper_rssi; - -__be64 tsf; - -s8 lower_noise; -s8 upper_noise; - -__be16 lower_max_magnitude; -__be16 upper_max_magnitude; - -u8 lower_max_index; -u8 upper_max_index; - -u8 lower_bitmap_weight; -u8 upper_bitmap_weight; - -u8 max_exp; - -u8 data[SPECTRAL_HT20_40_NUM_BINS ]; -} __packed; -void ath9k_spectral_init_debug (struct ath_softc *sc);void ath9k_spectral_deinit_debug (struct ath_softc *sc);
drivers/net/wireless/ath/spectral_common.h new file +88 -0
88 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v3 2/2 ath10k: add spectral scan feature
In reply to Simon WunderlichAdds the spectral scan feature for ath10k. The spectral scan is triggered by configuring a mode through a debugfs control file. Samples can be gathered via another relay debugfs file.
Essentially, to try it out:
ip link set dev wlan0 up
echo background > /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctl echo trigger > /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctl iw dev wlan0 scan
echo disable > /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctl cat /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan0 > samples
This feature is still experimental. Based on the original RFC patch of Sven Eckelmann.
--
PATCHv3:
* fix compilation with debugfs disabled (Thanks Kalle)
* add trigger command to commit message (Thanks Chun-Yeow)
* change error message capitalization (Thanks Michal)
* don't send WMI on core halt (Thanks Michal)
* various style changes: indetation, empty lines before comments, moved initialization into separate function, create substruct for spectral parameters (Thanks Kalle)
PATCHv2:
* fixed usage example in commit message (Thanks Chun-Yeow Yeoh)
* adding lockdep asserts and comment (Thanks Michal)
* debug message cleanups (Michal)
* disable spectral on firmware crash (Michal)
PATCH:
* change the tlv format to a variable-length format, depending on the number of bins
* perform dc interpolation and max_exp calculation in the driver (as for ath9k)
* make fft_size configurable
* background scan will only start after beeing trigger, like in ath9k
* document at least some spectral configuration members (thanks Kathy)
* fix sparse problems
* sample bandwidth appears to be 110% of what is reported by the hardware according to the plotter (e.g. 20->22, 40->44 MHz etc), so fix that in the driver.
* disable spectral for a vif when it's beeing deleted and still active (Michals comment)
* modify ath_ prefix of function/struct/enum to ath10k_ (Michal)
* changed variable ret to res (Michal)
* added ath10k_warn messages (Michal)
* renamed wmi functions (Michal)
* use ar->conf_mutex for locking (Michal)
* renamed mhz to chan_width_mhz (Michal)
* only enable spectral scan files when ATH10K_DEBUGFS is enabled
--- drivers/net/wireless/ath/ath10k/Kconfig | 1 + drivers/net/wireless/ath/ath10k/Makefile | 1 + drivers/net/wireless/ath/ath10k/core.c | 7 +- drivers/net/wireless/ath/ath10k/core.h | 10 + drivers/net/wireless/ath/ath10k/debug.c | 3 + drivers/net/wireless/ath/ath10k/mac.c | 7 + drivers/net/wireless/ath/ath10k/spectral.c | 557 +++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/spectral.h | 82 +++++ drivers/net/wireless/ath/ath10k/wmi.c | 104 +++++- drivers/net/wireless/ath/ath10k/wmi.h | 97 +++++ drivers/net/wireless/ath/spectral_common.h | 25 ++ 11 files changed, 892 insertions(+), 2 deletions(-) create mode 100644 drivers/net/wireless/ath/ath10k/spectral.c create mode 100644 drivers/net/wireless/ath/ath10k/spectral.h
drivers/net/wireless/ath/ath10k/Kconfig +1 -0
@@ -27,6 +27,7 @@ config ATH10K_DEBUG config ATH10K_DEBUGFS bool "Atheros ath10k debugfs support" depends on ATH10K + select RELAY ---help--- Enabled debugfs support
drivers/net/wireless/ath/ath10k/Makefile +1 -0
@@ -10,6 +10,7 @@ ath10k_core-y += mac.o \ wmi.o \ bmi.o +ath10k_core-$(CPTCFG_ATH10K_DEBUGFS) += spectral.o ath10k_core-$(CPTCFG_ATH10K_TRACING) += trace.o obj-$(CPTCFG_ATH10K_PCI) += ath10k_pci.o
drivers/net/wireless/ath/ath10k/core.c +6 -1
@@ -728,6 +728,12 @@ struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,INIT_WORK (&ar->restart_work, ath10k_core_restart); +INIT_LIST_HEAD (&ar->arvifs); + +mutex_lock (&ar->conf_mutex); +ath10k_spectral_init (ar); +mutex_unlock (&ar->conf_mutex); +return ar; err_wq:
@@ -832,7 +838,6 @@ int ath10k_core_start(struct ath10k *ar) goto err_disconnect_htc; ar->free_vdev_map = (1 <<TARGET_NUM_VDEVS ) -1 ; -INIT_LIST_HEAD (&ar->arvifs);if (!test_bit (ATH10K_FLAG_FIRST_BOOT_DONE , &ar->dev_flags)) ath10k_info("%s (0x%x) fw %s api %d htt %d.%d\n",
drivers/net/wireless/ath/ath10k/core.h +10 -0
@@ -31,6 +31,7 @@#include "../ath.h" #include "../regd.h" #include "../dfs_pattern_detector.h" +#include "spectral.h" #define MS (_v, _f) (((_v) & _f##_MASK) >> _f##_LSB)#define SM (_v, _f) (((_v) << _f##_LSB) & _f##_MASK)
@@ -230,6 +231,7 @@ struct ath10k_vif {bool is_started;bool is_up; +bool spectral_enabled;u32 aid;u8 bssid[ETH_ALEN ];
@@ -469,6 +471,14 @@ struct ath10k {#ifdef CPTCFG_ATH10K_DEBUGFS struct ath10k_debug debug;#endif + +struct { +/* relay(fs) channel for spectral scan */ +struct rchan *rfs_chan_spec_scan; +/* spectral_mode and spec_config are protected by conf_mutex */ +enum ath10k_spectral_mode mode; +struct ath10k_spec_scan config; + } spectral; }; struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
drivers/net/wireless/ath/ath10k/debug.c +3 -0
@@ -853,12 +853,15 @@ int ath10k_debug_create(struct ath10k *ar) &fops_dfs_stats); } +ath10k_spectral_init_debug (ar); +return 0 ; }void ath10k_debug_destroy (struct ath10k *ar) {cancel_delayed_work_sync (&ar->debug.htt_stats_dwork); +ath10k_spectral_deinit_debug (ar); }#endif /* CPTCFG_ATH10K_DEBUGFS */
drivers/net/wireless/ath/ath10k/mac.c +7 -0
@@ -2201,6 +2201,7 @@ void ath10k_halt(struct ath10k *ar)ath10k_peer_cleanup_all (ar);ath10k_core_stop (ar);ath10k_hif_power_down (ar); +ath10k_spectral_init (ar);spin_lock_bh (&ar->data_lock);if (ar->scan.in_progress) {
@@ -2671,8 +2672,14 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,dev_kfree_skb_any (arvif->beacon); arvif->beacon =NULL ; } +spin_unlock_bh (&ar->data_lock); + ret =ath10k_spectral_stop (arvif); +if (ret) +ath10k_warn ("failed to disable spectral for vdev %i: %d\n" , + arvif->vdev_id, ret); + ar->free_vdev_map |=1 << (arvif->vdev_id);list_del (&arvif->list);
drivers/net/wireless/ath/ath10k/spectral.c new file +557 -0
557 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/spectral.h new file +82 -0
82 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/wmi.c +103 -1
116 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/wmi.h +97 -0
115 lines not on this page · raw message
drivers/net/wireless/ath/spectral_common.h +25 -0
@@ -20,6 +20,11 @@#define SPECTRAL_HT20_NUM_BINS 56#define SPECTRAL_HT20_40_NUM_BINS 128 +/* TODO: could possibly be 512, but no samples this large +* could be acquired so far. +*/ +#define SPECTRAL_ATH10K_MAX_NUM_BINS 256 +/* FFT sample format given to userspace via debugfs. * * Please keep the type/length at the front position and change
@@ -31,6 +36,7 @@enum ath_fft_sample_type {ATH_FFT_SAMPLE_HT20 =1 ,ATH_FFT_SAMPLE_HT20_40 , +ATH_FFT_SAMPLE_ATH10K , };struct fft_sample_tlv {
@@ -85,4 +91,23 @@ struct fft_sample_ht20_40 { u8 data[SPECTRAL_HT20_40_NUM_BINS]; } __packed; +struct fft_sample_ath10k { +struct fft_sample_tlv tlv; +u8 chan_width_mhz; +__be16 freq1; +__be16 freq2; +__be16 noise; +__be16 max_magnitude; +__be16 total_gain_db; +__be16 base_pwr_db; +__be64 tsf; +s8 max_index; +u8 rssi; +u8 relpwr_db; +u8 avgpwr_db; +u8 max_exp; + +u8 data[0 ]; +} __packed; +#endif /* SPECTRAL_COMMON_H */
Signature · 1 line
1.9.1
Quoted 20 lines · Simon Wunderlich
This is the third "PATCH" patchset iteration for the ath10k spectral scan feature. It includes quite a few style fixes, the compile issues were fixed when debugfs were disabled, and sending WMI commands after a firmware crash should not happen any more. Thanks to Michal, Chun-Yeow and Kalle for reviewing!
To view the samples, please have a look at the
fft_evaltool [1] which now supports both ath9k and ath10k formats.The count issue is still open: Even when a count is specified, the hardware seems to send endless samples. It seems to work most of the time in VHT80 mode though, but in HT20 and HT40 the count value seems to be ignored. To reproduce this, start hostapd with the desired channel width and do:
echo 8 >
/sys/kernel/debug/ieee80211/phy0/ath10k/spectral_countecho manual >/sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctlecho trigger >/sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctlcat/sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan0>>/tmp/fft.dump
Quoted 5 lines
Repeating the last line and checking the filesize will easily show whether ath10k still sends samples or not. We would expect 8 samples in this configuration.
Please see the patches for more information on the changes.
This one had conflicts so I'm dropping it.
Signature · 1 line
Kalle Valo
PATCH v3 2/2 ath10k: add spectral scan feature
Adds the spectral scan feature for ath10k. The spectral scan is triggered by configuring a mode through a debugfs control file. Samples can be gathered via another relay debugfs file.
Essentially, to try it out:
ip link set dev wlan0 up
echo background > /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctl echo trigger > /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctl iw dev wlan0 scan
echo disable > /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctl cat /sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan0 > samples
This feature is still experimental. Based on the original RFC patch of Sven Eckelmann.
--
PATCHv3-ath-resend:
* based on ath/master
PATCHv3:
* fix compilation with debugfs disabled (Thanks Kalle)
* add trigger command to commit message (Thanks Chun-Yeow)
* change error message capitalization (Thanks Michal)
* don't send WMI on core halt (Thanks Michal)
* various style changes: indetation, empty lines before comments, moved initialization into separate function, create substruct for spectral parameters (Thanks Kalle)
PATCHv2:
* fixed usage example in commit message (Thanks Chun-Yeow Yeoh)
* adding lockdep asserts and comment (Thanks Michal)
* debug message cleanups (Michal)
* disable spectral on firmware crash (Michal)
PATCH:
* change the tlv format to a variable-length format, depending on the number of bins
* perform dc interpolation and max_exp calculation in the driver (as for ath9k)
* make fft_size configurable
* background scan will only start after beeing trigger, like in ath9k
* document at least some spectral configuration members (thanks Kathy)
* fix sparse problems
* sample bandwidth appears to be 110% of what is reported by the hardware according to the plotter (e.g. 20->22, 40->44 MHz etc), so fix that in the driver.
* disable spectral for a vif when it's beeing deleted and still active (Michals comment)
* modify ath_ prefix of function/struct/enum to ath10k_ (Michal)
* changed variable ret to res (Michal)
* added ath10k_warn messages (Michal)
* renamed wmi functions (Michal)
* use ar->conf_mutex for locking (Michal)
* renamed mhz to chan_width_mhz (Michal)
* only enable spectral scan files when ATH10K_DEBUGFS is enabled
--- drivers/net/wireless/ath/ath10k/Kconfig | 1 + drivers/net/wireless/ath/ath10k/Makefile | 1 + drivers/net/wireless/ath/ath10k/core.c | 8 +- drivers/net/wireless/ath/ath10k/core.h | 10 + drivers/net/wireless/ath/ath10k/debug.c | 3 + drivers/net/wireless/ath/ath10k/mac.c | 7 + drivers/net/wireless/ath/ath10k/spectral.c | 557 +++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/spectral.h | 82 +++++ drivers/net/wireless/ath/ath10k/wmi.c | 104 +++++- drivers/net/wireless/ath/ath10k/wmi.h | 97 +++++ drivers/net/wireless/ath/spectral_common.h | 25 ++ 11 files changed, 892 insertions(+), 3 deletions(-) create mode 100644 drivers/net/wireless/ath/ath10k/spectral.c create mode 100644 drivers/net/wireless/ath/ath10k/spectral.h
drivers/net/wireless/ath/ath10k/Kconfig +1 -0
@@ -25,6 +25,7 @@ config ATH10K_DEBUG config ATH10K_DEBUGFS bool "Atheros ath10k debugfs support" depends on ATH10K + select RELAY ---help--- Enabled debugfs support
drivers/net/wireless/ath/ath10k/Makefile +1 -0
@@ -10,6 +10,7 @@ ath10k_core-y += mac.o \ wmi.o \ bmi.o +ath10k_core-$(CPTCFG_ATH10K_DEBUGFS) += spectral.o ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o obj-$(CONFIG_ATH10K_PCI) += ath10k_pci.o
drivers/net/wireless/ath/ath10k/core.c +6 -2
@@ -800,8 +800,6 @@ int ath10k_core_start(struct ath10k *ar)else ar->free_vdev_map = (1 <<TARGET_NUM_VDEVS ) -1 ; -INIT_LIST_HEAD (&ar->arvifs); -if (!test_bit (ATH10K_FLAG_FIRST_BOOT_DONE , &ar->dev_flags)) { ath10k_info("%s (0x%08x, 0x%08x) fw %s api %d htt %d.%d\n", ar->hw_params.name,
@@ -1084,6 +1082,12 @@ struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,INIT_WORK (&ar->register_work, ath10k_core_register_work);INIT_WORK (&ar->restart_work, ath10k_core_restart); +INIT_LIST_HEAD (&ar->arvifs); + +mutex_lock (&ar->conf_mutex); +ath10k_spectral_init (ar); +mutex_unlock (&ar->conf_mutex); +return ar; err_wq:
drivers/net/wireless/ath/ath10k/core.h +10 -0
@@ -31,6 +31,7 @@#include "../ath.h" #include "../regd.h" #include "../dfs_pattern_detector.h" +#include "spectral.h" #define MS (_v, _f) (((_v) & _f##_MASK) >> _f##_LSB)#define SM (_v, _f) (((_v) << _f##_LSB) & _f##_MASK)
@@ -237,6 +238,7 @@ struct ath10k_vif {bool is_started;bool is_up; +bool spectral_enabled;u32 aid;u8 bssid[ETH_ALEN ];
@@ -494,6 +496,14 @@ struct ath10k {#ifdef CONFIG_ATH10K_DEBUGFS struct ath10k_debug debug;#endif + +struct { +/* relay(fs) channel for spectral scan */ +struct rchan *rfs_chan_spec_scan; +/* spectral_mode and spec_config are protected by conf_mutex */ +enum ath10k_spectral_mode mode; +struct ath10k_spec_scan config; + } spectral; }; struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
drivers/net/wireless/ath/ath10k/debug.c +3 -0
@@ -957,12 +957,15 @@ int ath10k_debug_create(struct ath10k *ar) &fops_dfs_stats); } +ath10k_spectral_init_debug (ar); +return 0 ; }void ath10k_debug_destroy (struct ath10k *ar) {cancel_delayed_work_sync (&ar->debug.htt_stats_dwork); +ath10k_spectral_deinit_debug (ar); }#endif /* CONFIG_ATH10K_DEBUGFS */
drivers/net/wireless/ath/ath10k/mac.c +7 -0
@@ -2330,6 +2330,7 @@ void ath10k_halt(struct ath10k *ar)ath10k_peer_cleanup_all (ar);ath10k_core_stop (ar);ath10k_hif_power_down (ar); +ath10k_spectral_init (ar);spin_lock_bh (&ar->data_lock);list_for_each_entry (arvif, &ar->arvifs, list) {
@@ -2892,8 +2893,14 @@ static void ath10k_remove_interface(struct ieee80211_hw *hw,dev_kfree_skb_any (arvif->beacon); arvif->beacon =NULL ; } +spin_unlock_bh (&ar->data_lock); + ret =ath10k_spectral_stop (arvif); +if (ret) +ath10k_warn ("failed to disable spectral for vdev %i: %d\n" , + arvif->vdev_id, ret); + ar->free_vdev_map |=1 << (arvif->vdev_id);list_del (&arvif->list);
drivers/net/wireless/ath/ath10k/spectral.c new file +557 -0
557 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/spectral.h new file +82 -0
82 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/wmi.c +103 -1
116 lines not on this page · raw message
drivers/net/wireless/ath/ath10k/wmi.h +97 -0
115 lines not on this page · raw message
drivers/net/wireless/ath/spectral_common.h +25 -0
@@ -20,6 +20,11 @@#define SPECTRAL_HT20_NUM_BINS 56#define SPECTRAL_HT20_40_NUM_BINS 128 +/* TODO: could possibly be 512, but no samples this large +* could be acquired so far. +*/ +#define SPECTRAL_ATH10K_MAX_NUM_BINS 256 +/* FFT sample format given to userspace via debugfs. * * Please keep the type/length at the front position and change
@@ -31,6 +36,7 @@enum ath_fft_sample_type {ATH_FFT_SAMPLE_HT20 =1 ,ATH_FFT_SAMPLE_HT20_40 , +ATH_FFT_SAMPLE_ATH10K , };struct fft_sample_tlv {
@@ -85,4 +91,23 @@ struct fft_sample_ht20_40 { u8 data[SPECTRAL_HT20_40_NUM_BINS]; } __packed; +struct fft_sample_ath10k { +struct fft_sample_tlv tlv; +u8 chan_width_mhz; +__be16 freq1; +__be16 freq2; +__be16 noise; +__be16 max_magnitude; +__be16 total_gain_db; +__be16 base_pwr_db; +__be64 tsf; +s8 max_index; +u8 rssi; +u8 relpwr_db; +u8 avgpwr_db; +u8 max_exp; + +u8 data[0 ]; +} __packed; +#endif /* SPECTRAL_COMMON_H */
Signature · 1 line
1.9.1
Re: [PATCHv3-ath-resend 2/2] ath10k: add spectral scan feature
Quoted 18 lines · Simon Wunderlich
Adds the spectral scan feature for ath10k. The spectral scan is triggered by configuring a mode through a debugfs control file. Samples can be gathered via another relay debugfs file.
Essentially, to try it out:
ip link set dev wlan0 up
echo background >/sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctlecho trigger >/sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctliw dev wlan0 scan
echo disable >/sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan_ctlcat/sys/kernel/debug/ieee80211/phy0/ath10k/spectral_scan0> samplesThis feature is still experimental. Based on the original RFC patch of Sven Eckelmann.
Signed-off-by Simon Wunderlich <[email protected]>Signed-off-by Mathias Kretschmer <[email protected]>
[...]
drivers/net/wireless/ath/ath10k/Makefile ath10k_core-y += mac.o \ · line 13
Quoted 9 lines
drivers/net/wireless/ath/ath10k/Makefile +1
-0@@ -10,6 +10,7 @@ ath10k_core-y += mac.o \ wmi.o \ bmi.o +ath10k_core-$(CPTCFG_ATH10K_DEBUGFS) += spectral.o
This one still uses CPTCFG_ prefix, I'll fix those.
Quoted 10 lines
drivers/net/wireless/ath/ath10k/Makefile +0
-2@@ -800,8 +800,6 @@ int ath10k_core_start(struct ath10k *ar) else ar->free_vdev_map = (1 << TARGET_NUM_VDEVS) - 1; - INIT_LIST_HEAD(&ar->arvifs); - if (!test_bit(ATH10K_FLAG_FIRST_BOOT_DONE, &ar->dev_flags)) { ath10k_info("%s (0x%08x, 0x%08x) fw %s api %d htt %d.%d\n", ar->hw_params.name,
drivers/net/wireless/ath/ath10k/Makefile struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev, · line 1085
Quoted 4 lines
drivers/net/wireless/ath/ath10k/Makefile +1
-0@@ -1084,6 +1082,12 @@ struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev, INIT_WORK(&ar->register_work, ath10k_core_register_work); INIT_WORK(&ar->restart_work, ath10k_core_restart); + INIT_LIST_HEAD(&ar->arvifs);
I'm a bit suspicious about this, why is it needed?
Signature · 1 line
Kalle Valo
Re: [PATCHv3-ath-resend 2/2] ath10k: add spectral scan feature
Quoted 6 lines · Kalle Valo
Quoted 4 lines · Simon Wunderlich
Adds the spectral scan feature for ath10k. The spectral scan is triggered by configuring a mode through a debugfs control file. Samples can be gathered via another relay debugfs file.
[...]
Quoted 13 lines
Quoted 13 lines
drivers/net/wireless/ath/ath10k/core.c +0
-2@@ -800,8 +800,6 @@ int ath10k_core_start(struct ath10k *ar)else ar->free_vdev_map = (1 <<TARGET_NUM_VDEVS ) -1 ; -INIT_LIST_HEAD (&ar->arvifs); -if (!test_bit (ATH10K_FLAG_FIRST_BOOT_DONE , &ar->dev_flags)) { ath10k_info("%s (0x%08x, 0x%08x) fw %s api %d htt %d.%d\n", ar->hw_params.name,@@ -1084,6 +1082,12 @@ struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,INIT_WORK (&ar->register_work, ath10k_core_register_work);INIT_WORK (&ar->restart_work, ath10k_core_restart);
Quoted 3 lines
drivers/net/wireless/ath/ath10k/core.c struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev, · line 1085
Quoted 1 line
drivers/net/wireless/ath/ath10k/core.c +1
-0+INIT_LIST_HEAD (&ar->arvifs);I'm a bit suspicious about this, why is it needed?
Good hunch. ar->arvifs must be re-initialized in core_start for recovery to work correctly.
Michał
Re: [PATCHv3-ath-resend 2/2] ath10k: add spectral scan feature
Quoted 21 lines · Michal Kazior
Quoted 6 lines · Kalle Valo
Quoted 4 lines · Simon Wunderlich
Adds the spectral scan feature for ath10k. The spectral scan is triggered by configuring a mode through a debugfs control file. Samples can be gathered via another relay debugfs file.
[...]
Quoted 13 lines
Quoted 13 lines
drivers/net/wireless/ath/ath10k/core.c +0
-2@@ -800,8 +800,6 @@ int ath10k_core_start(struct ath10k *ar)else ar->free_vdev_map = (1 <<TARGET_NUM_VDEVS ) -1 ; -INIT_LIST_HEAD (&ar->arvifs); -if (!test_bit (ATH10K_FLAG_FIRST_BOOT_DONE , &ar->dev_flags)) { ath10k_info("%s (0x%08x, 0x%08x) fw %s api %d htt %d.%d\n", ar->hw_params.name,@@ -1084,6 +1082,12 @@ struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,INIT_WORK (&ar->register_work, ath10k_core_register_work);INIT_WORK (&ar->restart_work, ath10k_core_restart);
Quoted 6 lines
Quoted 3 lines
drivers/net/wireless/ath/ath10k/core.c struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev, · line 1085
Quoted 1 line
drivers/net/wireless/ath/ath10k/core.c +1
-0+INIT_LIST_HEAD (&ar->arvifs);I'm a bit suspicious about this, why is it needed?
Good hunch.
ar->arvifsmust be re-initialized incore_startfor recovery to work correctly.
Thanks for the confirmation. I think I found a way to rework the spectral initialisation which also fixes this issue, I'll send a new version later today. Need to run some tests first.
Signature · 1 line
Kalle Valo
Re: [PATCHv3-ath-resend 2/2] ath10k: add spectral scan feature
In reply to Kalle ValoQuoted 4 lines
Quoted 1 line
+ath10k_core-$(CPTCFG_ATH10K_DEBUGFS) += spectral.o
This one still uses
CPTCFG_prefix, I'll fix those.
Argh, OK, thanks!
Quoted 18 lines
Quoted 18 lines
drivers/net/wireless/ath/ath10k/core.c +0
-2@@ -800,8 +800,6 @@ int ath10k_core_start(struct ath10k *ar)else ar->free_vdev_map = (1 <<TARGET_NUM_VDEVS ) -1 ; -INIT_LIST_HEAD (&ar->arvifs); -drivers/net/wireless/ath/ath10k/core.c +0
-0if (!test_bit (ATH10K_FLAG_FIRST_BOOT_DONE , &ar->dev_flags)) { ath10k_info("%s (0x%08x, 0x%08x) fw %s api %d htt %d.%d\n", ar->hw_params.name,@@ -1084,6 +1082,12 @@ struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
Quoted 6 lines
drivers/net/wireless/ath/ath10k/core.c struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev, · line 1085
Quoted 4 lines
drivers/net/wireless/ath/ath10k/core.c +1
-0INIT_WORK (&ar->register_work, ath10k_core_register_work);INIT_WORK (&ar->restart_work, ath10k_core_restart); +INIT_LIST_HEAD (&ar->arvifs);I'm a bit suspicious about this, why is it needed?
ath10k_spectral_init() clears the spectral_enabled bit for each vif, and therefore needs the list to be initialized ... it is also called on firmware crash by ath10k_halt, where checking the list is more useful.
Thanks,
Simon
Re: [PATCHv3-ath-resend 2/2] ath10k: add spectral scan feature
Quoted 21 lines · Simon Wunderlich
Quoted 21 lines
Quoted 21 lines
drivers/net/wireless/ath/ath10k/core.c +0
-2@@ -800,8 +800,6 @@ int ath10k_core_start(struct ath10k *ar)else ar->free_vdev_map = (1 <<TARGET_NUM_VDEVS ) -1 ; -INIT_LIST_HEAD (&ar->arvifs); -if (!test_bit(ATH10K_FLAG_FIRST_BOOT_DONE, &ar->dev_flags)) { ath10k_info("%s (0x%08x, 0x%08x) fw %s api %d htt %d.%d\n", ar->hw_params.name,drivers/net/wireless/ath/ath10k/core.c +0
-0@@ -1084,6 +1082,12 @@ struct ath10k *ath10k_core_create(void *hif_priv,struct device *dev, INIT_WORK(&ar->register_work, ath10k_core_register_work);INIT_WORK (&ar->restart_work, ath10k_core_restart);
Quoted 7 lines
Quoted 3 lines
drivers/net/wireless/ath/ath10k/core.c struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev, · line 1085
Quoted 1 line
drivers/net/wireless/ath/ath10k/core.c +1
-0+INIT_LIST_HEAD (&ar->arvifs);I'm a bit suspicious about this, why is it needed?
ath10k_spectral_init()clears thespectral_enabledbit for each vif, and therefore needs the list to be initialized ... it is also called on firmware crash byath10k_halt, where checking the list is more useful.
You don't really need to clear arvif->spectral_enabled on crash. arvif's are re-inserted by mac80211 via ath10k_add_interface which uses memset() to clear everything before adding to ar->arvifs.
Michał