* [ath9k-devel] [PATCH] Adding support for spectral scan for the ath9k_htc driver. Tested the patch on with 9271 chipset to generate spectral scans.
@ 2014-04-06 23:23 Ashish Patro
2014-04-07 13:47 ` Oleksij Rempel
0 siblings, 1 reply; 8+ messages in thread
From: Ashish Patro @ 2014-04-06 23:23 UTC (permalink / raw)
To: ath9k-devel
- Used the same mechanism to collect spectral scan data as used by the existing ath9k code.
- Minor refactoring done to the code to separate the ath9k and ath9k_htc related spectral scan functions into separate files.
This work was done at the WiNGS Lab at the University of Wisconsin Madison.
---
drivers/net/wireless/ath/ath9k/Makefile | 2 +-
drivers/net/wireless/ath/ath9k/ar9002_phy.c | 13 +-
drivers/net/wireless/ath/ath9k/ath9k.h | 1 +
drivers/net/wireless/ath/ath9k/htc.h | 7 +
drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 3 +
drivers/net/wireless/ath/ath9k/htc_drv_init.c | 8 +
drivers/net/wireless/ath/ath9k/htc_drv_main.c | 81 ++++-
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 14 +
drivers/net/wireless/ath/ath9k/spectral.h | 19 -
drivers/net/wireless/ath/ath9k/spectral_ath9k.h | 39 ++
drivers/net/wireless/ath/ath9k/spectral_htc.c | 549 +++++++++++++++++++++++
drivers/net/wireless/ath/ath9k/spectral_htc.h | 40 ++
12 files changed, 752 insertions(+), 24 deletions(-)
create mode 100644 drivers/net/wireless/ath/ath9k/spectral_ath9k.h
create mode 100644 drivers/net/wireless/ath/ath9k/spectral_htc.c
create mode 100644 drivers/net/wireless/ath/ath9k/spectral_htc.h
diff --git a/drivers/net/wireless/ath/ath9k/Makefile b/drivers/net/wireless/ath/ath9k/Makefile
index 8e1c7b0..56555a9 100644
--- a/drivers/net/wireless/ath/ath9k/Makefile
+++ b/drivers/net/wireless/ath/ath9k/Makefile
@@ -64,6 +64,6 @@ ath9k_htc-y += htc_hst.o \
htc_drv_init.o \
htc_drv_gpio.o
-ath9k_htc-$(CONFIG_ATH9K_HTC_DEBUGFS) += htc_drv_debug.o
+ath9k_htc-$(CONFIG_ATH9K_HTC_DEBUGFS) += htc_drv_debug.o spectral_htc.o
obj-$(CONFIG_ATH9K_HTC) += ath9k_htc.o
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_phy.c b/drivers/net/wireless/ath/ath9k/ar9002_phy.c
index 9a2afa2..21340c9 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c
@@ -622,7 +622,7 @@ static void ar9002_hw_spectral_scan_config(struct ath_hw *ah,
struct ath_spec_scan *param)
{
u8 count;
-
+
if (!param->enabled) {
REG_CLR_BIT(ah, AR_PHY_SPECTRAL_SCAN,
AR_PHY_SPECTRAL_SCAN_ENABLE);
@@ -641,13 +641,20 @@ static void ar9002_hw_spectral_scan_config(struct ath_hw *ah,
/* on AR92xx, the highest bit of count will make the the chip send
* spectral samples endlessly. Check if this really was intended,
* and fix otherwise.
+ *
+ * For AR9271 chipsets, set count = 0 using the debugfs mechanism.
*/
count = param->count;
- if (param->endless)
+ if (param->endless) {
count = 0x80;
- else if (count & 0x80)
+
+ if (AR_SREV_9271(ah)) {
+ count = 0;
+ }
+ } else if (count & 0x80)
count = 0x7f;
+
REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
AR_PHY_SPECTRAL_SCAN_COUNT, count);
REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 44d7449..8b59901 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -28,6 +28,7 @@
#include "mci.h"
#include "dfs.h"
#include "spectral.h"
+#include "spectral_ath9k.h"
struct ath_node;
diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h
index dab1f0c..5fb778e 100644
--- a/drivers/net/wireless/ath/ath9k/htc.h
+++ b/drivers/net/wireless/ath/ath9k/htc.h
@@ -31,6 +31,8 @@
#include "htc_hst.h"
#include "hif_usb.h"
#include "wmi.h"
+#include "spectral.h"
+#include "spectral_htc.h"
#define ATH_STA_SHORT_CALINTERVAL 1000 /* 1 second */
#define ATH_AP_SHORT_CALINTERVAL 100 /* 100 ms */
@@ -529,6 +531,11 @@ struct ath9k_htc_priv {
struct ath9k_debug debug;
#endif
struct mutex mutex;
+
+ /* relay(fs) channel for spectral scan */
+ struct rchan *rfs_chan_spec_scan;
+ enum spectral_mode spectral_mode;
+ struct ath_spec_scan spec_config;
};
static inline void ath_read_cachesize(struct ath_common *common, int *csz)
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
index fb071ee..e63bab3 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
@@ -992,6 +992,9 @@ int ath9k_htc_init_debug(struct ath_hw *ah)
priv->hw->wiphy->debugfsdir);
if (!priv->debug.debugfs_phy)
return -ENOMEM;
+
+ /* Initialize the debugFS files for the spectral scans */
+ ath9k_htc_spectral_init_debug(priv);
debugfs_create_file("tgt_int_stats", S_IRUSR, priv->debug.debugfs_phy,
priv, &fops_tgt_int_stats);
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index 8a3bd5f..71a80ba 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -449,6 +449,14 @@ static void ath9k_init_misc(struct ath9k_htc_priv *priv)
common->last_rssi = ATH_RSSI_DUMMY_MARKER;
priv->ah->opmode = NL80211_IFTYPE_STATION;
+
+ priv->spec_config.enabled = 0;
+ /* Set false for AR9271. */
+ priv->spec_config.short_repeat = false;
+ priv->spec_config.count = 8;
+ priv->spec_config.endless = false;
+ priv->spec_config.period = 18;
+ priv->spec_config.fft_period = 0x02;
}
static int ath9k_init_priv(struct ath9k_htc_priv *priv,
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index f46cd02..d9312a4 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -310,7 +310,11 @@ static int ath9k_htc_set_channel(struct ath9k_htc_priv *priv,
mod_timer(&priv->tx.cleanup_timer,
jiffies + msecs_to_jiffies(ATH9K_HTC_TX_CLEANUP_INTERVAL));
-
+
+ /* perform spectral scan if requested. */
+ if (test_bit(ATH_OP_SCANNING, &priv->op_flags) &&
+ priv->spectral_mode == SPECTRAL_CHANSCAN)
+ ath9k_htc_spectral_scan_trigger(hw);
err:
ath9k_htc_ps_restore(priv);
return ret;
@@ -1158,6 +1162,81 @@ static void ath9k_htc_remove_interface(struct ieee80211_hw *hw,
mutex_unlock(&priv->mutex);
}
+/* Start generating the spectral scans. */
+void ath9k_htc_spectral_scan_trigger(struct ieee80211_hw *hw)
+{
+ struct ath9k_htc_priv *priv = hw->priv;
+ struct ath_hw *ah = priv->ah;
+ struct ath_common *common = ath9k_hw_common(ah);
+ u32 rxfilter;
+
+ /* TODO: Is this condition required?
+ if (config_enabled(CONFIG_ATH9K_TX99))
+ return;
+ */
+
+ if (!ath9k_hw_ops(ah)->spectral_scan_trigger) {
+ ath_err(common, "spectrum analyzer not implemented on this hardware\n");
+ return;
+ }
+
+ ath9k_htc_ps_wakeup(priv);
+ rxfilter = ath9k_hw_getrxfilter(ah);
+ ath9k_hw_setrxfilter(ah, rxfilter |
+ ATH9K_RX_FILTER_PHYRADAR |
+ ATH9K_RX_FILTER_PHYERR);
+
+ /* TODO: usually this should not be neccesary, but for some reason
+ * (or in some mode?) the trigger must be called after the
+ * configuration, otherwise the register will have its values reset
+ * (on my ar9220 to value 0x01002310)
+ */
+ ath9k_htc_spectral_scan_config(hw, priv->spectral_mode);
+ ath9k_hw_ops(ah)->spectral_scan_trigger(ah);
+ ath9k_htc_ps_restore(priv);
+}
+
+/* Configure the status of the spectral scan feature. */
+int ath9k_htc_spectral_scan_config(struct ieee80211_hw *hw,
+ enum spectral_mode spectral_mode)
+{
+ struct ath9k_htc_priv *priv = hw->priv;
+ struct ath_hw *ah = priv->ah;
+ struct ath_common *common = ath9k_hw_common(ah);
+
+ if (!ath9k_hw_ops(ah)->spectral_scan_trigger) {
+ ath_err(common, "spectrum analyzer not implemented on this hardware\n");
+ return -1;
+ }
+
+ switch (spectral_mode) {
+ case SPECTRAL_DISABLED:
+ priv->spec_config.enabled = 0;
+ break;
+ case SPECTRAL_BACKGROUND:
+ /* send endless samples.
+ */
+ priv->spec_config.endless = 1;
+ priv->spec_config.enabled = 1;
+ break;
+ case SPECTRAL_CHANSCAN:
+ case SPECTRAL_MANUAL:
+ priv->spec_config.endless = 0;
+ priv->spec_config.enabled = 1;
+ break;
+ default:
+ return -1;
+ }
+
+ ath9k_htc_ps_wakeup(priv);
+ ath9k_hw_ops(ah)->spectral_scan_config(ah, &priv->spec_config);
+ ath9k_htc_ps_restore(priv);
+
+ priv->spectral_mode = spectral_mode;
+
+ return 0;
+}
+
static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed)
{
struct ath9k_htc_priv *priv = hw->priv;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index e8149e3..d77a6b7 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -1010,6 +1010,20 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,
* separately to avoid doing two lookups for a rate for each frame.
*/
hdr = (struct ieee80211_hdr *)skb->data;
+
+ /*
+ * Process PHY errors and return so that the packet
+ * can be dropped.
+ */
+ if (rx_stats.rs_status & ATH9K_RXERR_PHY) {
+ /* TODO: Not using DFS processing now. */
+ if (ath_htc_process_fft(priv, hdr, &rx_stats, rx_status->mactime)) {
+ /* TODO: Add code for collecting statistics about spectral scan */
+ }
+
+ goto rx_next;
+ }
+
if (!ath9k_cmn_rx_accept(common, hdr, rx_status, &rx_stats,
&decrypt_error, priv->rxfilter))
goto rx_next;
diff --git a/drivers/net/wireless/ath/ath9k/spectral.h b/drivers/net/wireless/ath/ath9k/spectral.h
index ead6341..d321f7f 100644
--- a/drivers/net/wireless/ath/ath9k/spectral.h
+++ b/drivers/net/wireless/ath/ath9k/spectral.h
@@ -190,23 +190,4 @@ struct fft_sample_ht20_40 {
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);
-
-void ath9k_spectral_scan_trigger(struct ieee80211_hw *hw);
-int ath9k_spectral_scan_config(struct ieee80211_hw *hw,
- enum spectral_mode spectral_mode);
-
-#ifdef CONFIG_ATH9K_DEBUGFS
-int ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr,
- struct ath_rx_status *rs, u64 tsf);
-#else
-static inline int ath_process_fft(struct ath_softc *sc,
- struct ieee80211_hdr *hdr,
- struct ath_rx_status *rs, u64 tsf)
-{
- return 0;
-}
-#endif /* CONFIG_ATH9K_DEBUGFS */
-
#endif /* SPECTRAL_H */
diff --git a/drivers/net/wireless/ath/ath9k/spectral_ath9k.h b/drivers/net/wireless/ath/ath9k/spectral_ath9k.h
new file mode 100644
index 0000000..08ae2c3
--- /dev/null
+++ b/drivers/net/wireless/ath/ath9k/spectral_ath9k.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef SPECTRAL_ATH9K_H
+#define SPECTRAL_ATH9K_H
+
+void ath9k_spectral_init_debug(struct ath_softc *sc);
+void ath9k_spectral_deinit_debug(struct ath_softc *sc);
+
+void ath9k_spectral_scan_trigger(struct ieee80211_hw *hw);
+int ath9k_spectral_scan_config(struct ieee80211_hw *hw,
+ enum spectral_mode spectral_mode);
+
+#ifdef CONFIG_ATH9K_DEBUGFS
+int ath_process_fft(struct ath_softc *sc, struct ieee80211_hdr *hdr,
+ struct ath_rx_status *rs, u64 tsf);
+#else
+static inline int ath_process_fft(struct ath_softc *sc,
+ struct ieee80211_hdr *hdr,
+ struct ath_rx_status *rs, u64 tsf)
+{
+ return 0;
+}
+#endif /* CONFIG_ATH9K_DEBUGFS */
+
+#endif /* SPECTRAL_ATH9K_H */
diff --git a/drivers/net/wireless/ath/ath9k/spectral_htc.c b/drivers/net/wireless/ath/ath9k/spectral_htc.c
new file mode 100644
index 0000000..0e72c1a
--- /dev/null
+++ b/drivers/net/wireless/ath/ath9k/spectral_htc.c
@@ -0,0 +1,549 @@
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <linux/relay.h>
+#include "htc.h"
+
+static s8 fix_rssi_inv_only(u8 rssi_val)
+{
+ if (rssi_val == 128)
+ rssi_val = 0;
+ return (s8) rssi_val;
+}
+
+static void ath_debug_send_fft_sample(struct ath9k_htc_priv *priv,
+ struct fft_sample_tlv *fft_sample_tlv)
+{
+ int length;
+
+ if (!priv->rfs_chan_spec_scan)
+ return;
+
+ length = __be16_to_cpu(fft_sample_tlv->length) +
+ sizeof(*fft_sample_tlv);
+
+ relay_write(priv->rfs_chan_spec_scan, fft_sample_tlv, length);
+}
+
+/* returns 1 if this was a spectral frame, even if not handled. */
+int ath_htc_process_fft(struct ath9k_htc_priv *priv,
+ struct ieee80211_hdr *hdr,
+ struct ath_rx_status *rs, u64 tsf)
+{
+ struct ath_hw *ah = priv->ah;
+ u8 num_bins, *bins, *vdata = (u8 *)hdr;
+ struct fft_sample_ht20 fft_sample_20;
+ struct fft_sample_ht20_40 fft_sample_40;
+ struct fft_sample_tlv *tlv;
+ struct ath_radar_info *radar_info;
+ int len = be16_to_cpu(rs->rs_datalen);
+ int dc_pos;
+ u16 fft_len, length, freq = ah->curchan->chan->center_freq;
+ enum nl80211_channel_type chan_type;
+
+ /* AR9280 and before report via ATH9K_PHYERR_RADAR, AR93xx and newer
+ * via ATH9K_PHYERR_SPECTRAL. Haven't seen ATH9K_PHYERR_FALSE_RADAR_EXT
+ * yet, but this is supposed to be possible as well.
+ */
+ if (rs->rs_phyerr != ATH9K_PHYERR_RADAR &&
+ rs->rs_phyerr != ATH9K_PHYERR_FALSE_RADAR_EXT &&
+ rs->rs_phyerr != ATH9K_PHYERR_SPECTRAL)
+ return 0;
+
+ /* check if spectral scan bit is set. This does not have to be checked
+ * if received through a SPECTRAL phy error, but shouldn't hurt.
+ */
+ radar_info = ((struct ath_radar_info *)&vdata[len]) - 1;
+
+ if (!(radar_info->pulse_bw_info & SPECTRAL_SCAN_BITMASK))
+ return 0;
+
+ chan_type = cfg80211_get_chandef_type(&priv->hw->conf.chandef);
+ if ((chan_type == NL80211_CHAN_HT40MINUS) ||
+ (chan_type == NL80211_CHAN_HT40PLUS)) {
+ fft_len = SPECTRAL_HT20_40_TOTAL_DATA_LEN;
+ num_bins = SPECTRAL_HT20_40_NUM_BINS;
+ bins = (u8 *)fft_sample_40.data;
+ } else {
+ fft_len = SPECTRAL_HT20_TOTAL_DATA_LEN;
+ num_bins = SPECTRAL_HT20_NUM_BINS;
+ bins = (u8 *)fft_sample_20.data;
+ }
+
+ /* Variation in the data length is possible and will be fixed later */
+ if ((len > fft_len + 2) || (len < fft_len - 1))
+ return 1;
+
+ switch (len - fft_len) {
+ case 0:
+ /* length correct, nothing to do. */
+ memcpy(bins, vdata, num_bins);
+ break;
+ case -1:
+ /* first byte missing, duplicate it. */
+ memcpy(&bins[1], vdata, num_bins - 1);
+ bins[0] = vdata[0];
+ break;
+ case 2:
+ /* MAC added 2 extra bytes@bin 30 and 32, remove them. */
+ memcpy(bins, vdata, 30);
+ bins[30] = vdata[31];
+ memcpy(&bins[31], &vdata[33], num_bins - 31);
+ break;
+ case 1:
+ /* MAC added 2 extra bytes AND first byte is missing. */
+ bins[0] = vdata[0];
+ memcpy(&bins[1], vdata, 30);
+ bins[31] = vdata[31];
+ memcpy(&bins[32], &vdata[33], num_bins - 32);
+ break;
+ default:
+ return 1;
+ }
+
+ /* DC value (value in the middle) is the blind spot of the spectral
+ * sample and invalid, interpolate it.
+ */
+ dc_pos = num_bins / 2;
+ bins[dc_pos] = (bins[dc_pos + 1] + bins[dc_pos - 1]) / 2;
+
+ if ((chan_type == NL80211_CHAN_HT40MINUS) ||
+ (chan_type == NL80211_CHAN_HT40PLUS)) {
+ s8 lower_rssi, upper_rssi;
+ s16 ext_nf;
+ u8 lower_max_index, upper_max_index;
+ u8 lower_bitmap_w, upper_bitmap_w;
+ u16 lower_mag, upper_mag;
+ struct ath9k_hw_cal_data *caldata = ah->caldata;
+ struct ath_ht20_40_mag_info *mag_info;
+
+ if (caldata)
+ ext_nf = ath9k_hw_getchan_noise(ah, ah->curchan,
+ caldata->nfCalHist[3].privNF);
+ else
+ ext_nf = ATH_DEFAULT_NOISE_FLOOR;
+
+ length = sizeof(fft_sample_40) - sizeof(struct fft_sample_tlv);
+ fft_sample_40.tlv.type = ATH_FFT_SAMPLE_HT20_40;
+ fft_sample_40.tlv.length = __cpu_to_be16(length);
+ fft_sample_40.freq = __cpu_to_be16(freq);
+ fft_sample_40.channel_type = chan_type;
+
+ if (chan_type == NL80211_CHAN_HT40PLUS) {
+ lower_rssi = fix_rssi_inv_only(rs->rs_rssi_ctl[0]);
+ upper_rssi = fix_rssi_inv_only(rs->rs_rssi_ext[0]);
+
+ fft_sample_40.lower_noise = ah->noise;
+ fft_sample_40.upper_noise = ext_nf;
+ } else {
+ lower_rssi = fix_rssi_inv_only(rs->rs_rssi_ext[0]);
+ upper_rssi = fix_rssi_inv_only(rs->rs_rssi_ctl[0]);
+
+ fft_sample_40.lower_noise = ext_nf;
+ fft_sample_40.upper_noise = ah->noise;
+ }
+ fft_sample_40.lower_rssi = lower_rssi;
+ fft_sample_40.upper_rssi = upper_rssi;
+
+ mag_info = ((struct ath_ht20_40_mag_info *)radar_info) - 1;
+ lower_mag = spectral_max_magnitude(mag_info->lower_bins);
+ upper_mag = spectral_max_magnitude(mag_info->upper_bins);
+ fft_sample_40.lower_max_magnitude = __cpu_to_be16(lower_mag);
+ fft_sample_40.upper_max_magnitude = __cpu_to_be16(upper_mag);
+ lower_max_index = spectral_max_index(mag_info->lower_bins);
+ upper_max_index = spectral_max_index(mag_info->upper_bins);
+ fft_sample_40.lower_max_index = lower_max_index;
+ fft_sample_40.upper_max_index = upper_max_index;
+ lower_bitmap_w = spectral_bitmap_weight(mag_info->lower_bins);
+ upper_bitmap_w = spectral_bitmap_weight(mag_info->upper_bins);
+ fft_sample_40.lower_bitmap_weight = lower_bitmap_w;
+ fft_sample_40.upper_bitmap_weight = upper_bitmap_w;
+ fft_sample_40.max_exp = mag_info->max_exp & 0xf;
+
+ fft_sample_40.tsf = __cpu_to_be64(tsf);
+
+ tlv = (struct fft_sample_tlv *)&fft_sample_40;
+ } else {
+ u8 max_index, bitmap_w;
+ u16 magnitude;
+ struct ath_ht20_mag_info *mag_info;
+
+ length = sizeof(fft_sample_20) - sizeof(struct fft_sample_tlv);
+ fft_sample_20.tlv.type = ATH_FFT_SAMPLE_HT20;
+ fft_sample_20.tlv.length = __cpu_to_be16(length);
+ fft_sample_20.freq = __cpu_to_be16(freq);
+
+ fft_sample_20.rssi = fix_rssi_inv_only(rs->rs_rssi_ctl[0]);
+ fft_sample_20.noise = ah->noise;
+
+ mag_info = ((struct ath_ht20_mag_info *)radar_info) - 1;
+ magnitude = spectral_max_magnitude(mag_info->all_bins);
+ fft_sample_20.max_magnitude = __cpu_to_be16(magnitude);
+ max_index = spectral_max_index(mag_info->all_bins);
+ fft_sample_20.max_index = max_index;
+ bitmap_w = spectral_bitmap_weight(mag_info->all_bins);
+ fft_sample_20.bitmap_weight = bitmap_w;
+ fft_sample_20.max_exp = mag_info->max_exp & 0xf;
+
+ fft_sample_20.tsf = __cpu_to_be64(tsf);
+
+ tlv = (struct fft_sample_tlv *)&fft_sample_20;
+ }
+
+ ath_debug_send_fft_sample(priv, tlv);
+
+ return 1;
+}
+
+/*********************/
+/* spectral_scan_ctl */
+/*********************/
+
+static ssize_t read_file_spec_scan_ctl(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath9k_htc_priv *priv = file->private_data;
+ char *mode = "";
+ unsigned int len;
+
+ switch (priv->spectral_mode) {
+ case SPECTRAL_DISABLED:
+ mode = "disable";
+ break;
+ case SPECTRAL_BACKGROUND:
+ mode = "background";
+ break;
+ case SPECTRAL_CHANSCAN:
+ mode = "chanscan";
+ break;
+ case SPECTRAL_MANUAL:
+ mode = "manual";
+ break;
+ }
+ len = strlen(mode);
+ return simple_read_from_buffer(user_buf, count, ppos, mode, len);
+}
+
+static ssize_t write_file_spec_scan_ctl(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath9k_htc_priv *priv = file->private_data;
+ struct ath_common *common = ath9k_hw_common(priv->ah);
+ char buf[32];
+ ssize_t len;
+
+ /* TODO: Is it required for ath9k_htc??
+ if (config_enabled(CONFIG_ATH9K_TX99))
+ return -EOPNOTSUPP;
+ */
+
+ len = min(count, sizeof(buf) - 1);
+ if (copy_from_user(buf, user_buf, len))
+ return -EFAULT;
+
+ buf[len] = '\0';
+
+ if (strncmp("trigger", buf, 7) == 0) {
+ ath9k_htc_spectral_scan_trigger(priv->hw);
+ } else if (strncmp("background", buf, 9) == 0) {
+ ath9k_htc_spectral_scan_config(priv->hw, SPECTRAL_BACKGROUND);
+ ath_dbg(common, CONFIG, "spectral scan: background mode enabled\n");
+ } else if (strncmp("chanscan", buf, 8) == 0) {
+ ath9k_htc_spectral_scan_config(priv->hw, SPECTRAL_CHANSCAN);
+ ath_dbg(common, CONFIG, "spectral scan: channel scan mode enabled\n");
+ } else if (strncmp("manual", buf, 6) == 0) {
+ ath9k_htc_spectral_scan_config(priv->hw, SPECTRAL_MANUAL);
+ ath_dbg(common, CONFIG, "spectral scan: manual mode enabled\n");
+ } else if (strncmp("disable", buf, 7) == 0) {
+ ath9k_htc_spectral_scan_config(priv->hw, SPECTRAL_DISABLED);
+ ath_dbg(common, CONFIG, "spectral scan: disabled\n");
+ } else {
+ return -EINVAL;
+ }
+
+ return count;
+}
+
+static const struct file_operations fops_spec_scan_ctl = {
+ .read = read_file_spec_scan_ctl,
+ .write = write_file_spec_scan_ctl,
+ .open = simple_open,
+ .owner = THIS_MODULE,
+ .llseek = default_llseek,
+};
+
+/*************************/
+/* spectral_short_repeat */
+/*************************/
+
+static ssize_t read_file_spectral_short_repeat(struct file *file,
+ char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath9k_htc_priv *priv = file->private_data;
+ char buf[32];
+ unsigned int len;
+
+ len = sprintf(buf, "%d\n", priv->spec_config.short_repeat);
+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static ssize_t write_file_spectral_short_repeat(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath9k_htc_priv *priv = file->private_data;
+ unsigned long val;
+ char buf[32];
+ ssize_t len;
+
+ len = min(count, sizeof(buf) - 1);
+ if (copy_from_user(buf, user_buf, len))
+ return -EFAULT;
+
+ buf[len] = '\0';
+ if (kstrtoul(buf, 0, &val))
+ return -EINVAL;
+
+ if (val < 0 || val > 1)
+ return -EINVAL;
+
+ priv->spec_config.short_repeat = val;
+ return count;
+}
+
+static const struct file_operations fops_spectral_short_repeat = {
+ .read = read_file_spectral_short_repeat,
+ .write = write_file_spectral_short_repeat,
+ .open = simple_open,
+ .owner = THIS_MODULE,
+ .llseek = default_llseek,
+};
+
+/******************/
+/* spectral_count */
+/******************/
+
+static ssize_t read_file_spectral_count(struct file *file,
+ char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath9k_htc_priv *priv = file->private_data;
+ char buf[32];
+ unsigned int len;
+
+ len = sprintf(buf, "%d\n", priv->spec_config.count);
+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static ssize_t write_file_spectral_count(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath9k_htc_priv *priv = file->private_data;
+ unsigned long val;
+ char buf[32];
+ ssize_t len;
+
+ len = min(count, sizeof(buf) - 1);
+ if (copy_from_user(buf, user_buf, len))
+ return -EFAULT;
+
+ buf[len] = '\0';
+ if (kstrtoul(buf, 0, &val))
+ return -EINVAL;
+
+ if (val < 0 || val > 255)
+ return -EINVAL;
+
+ priv->spec_config.count = val;
+ return count;
+}
+
+static const struct file_operations fops_spectral_count = {
+ .read = read_file_spectral_count,
+ .write = write_file_spectral_count,
+ .open = simple_open,
+ .owner = THIS_MODULE,
+ .llseek = default_llseek,
+};
+
+/*******************/
+/* spectral_period */
+/*******************/
+
+static ssize_t read_file_spectral_period(struct file *file,
+ char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath9k_htc_priv *priv = file->private_data;
+ char buf[32];
+ unsigned int len;
+
+ len = sprintf(buf, "%d\n", priv->spec_config.period);
+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static ssize_t write_file_spectral_period(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath9k_htc_priv *priv = file->private_data;
+ unsigned long val;
+ char buf[32];
+ ssize_t len;
+
+ len = min(count, sizeof(buf) - 1);
+ if (copy_from_user(buf, user_buf, len))
+ return -EFAULT;
+
+ buf[len] = '\0';
+ if (kstrtoul(buf, 0, &val))
+ return -EINVAL;
+
+ if (val < 0 || val > 255)
+ return -EINVAL;
+
+ priv->spec_config.period = val;
+ return count;
+}
+
+static const struct file_operations fops_spectral_period = {
+ .read = read_file_spectral_period,
+ .write = write_file_spectral_period,
+ .open = simple_open,
+ .owner = THIS_MODULE,
+ .llseek = default_llseek,
+};
+
+/***********************/
+/* spectral_fft_period */
+/***********************/
+
+static ssize_t read_file_spectral_fft_period(struct file *file,
+ char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath9k_htc_priv *priv = file->private_data;
+ char buf[32];
+ unsigned int len;
+
+ len = sprintf(buf, "%d\n", priv->spec_config.fft_period);
+ return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static ssize_t write_file_spectral_fft_period(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct ath9k_htc_priv *priv = file->private_data;
+ unsigned long val;
+ char buf[32];
+ ssize_t len;
+
+ len = min(count, sizeof(buf) - 1);
+ if (copy_from_user(buf, user_buf, len))
+ return -EFAULT;
+
+ buf[len] = '\0';
+ if (kstrtoul(buf, 0, &val))
+ return -EINVAL;
+
+ if (val < 0 || val > 15)
+ return -EINVAL;
+
+ priv->spec_config.fft_period = val;
+ return count;
+}
+
+static const struct file_operations fops_spectral_fft_period = {
+ .read = read_file_spectral_fft_period,
+ .write = write_file_spectral_fft_period,
+ .open = simple_open,
+ .owner = THIS_MODULE,
+ .llseek = default_llseek,
+};
+
+/*******************/
+/* Relay interface */
+/*******************/
+
+static struct dentry *create_buf_file_handler(const char *filename,
+ struct dentry *parent,
+ umode_t mode,
+ struct rchan_buf *buf,
+ int *is_global)
+{
+ struct dentry *buf_file;
+
+ buf_file = debugfs_create_file(filename, mode, parent, buf,
+ &relay_file_operations);
+ *is_global = 1;
+ return buf_file;
+}
+
+static int remove_buf_file_handler(struct dentry *dentry)
+{
+ debugfs_remove(dentry);
+
+ return 0;
+}
+
+static struct rchan_callbacks rfs_spec_scan_cb = {
+ .create_buf_file = create_buf_file_handler,
+ .remove_buf_file = remove_buf_file_handler,
+};
+
+/*********************/
+/* Debug Init/Deinit */
+/*********************/
+
+void ath9k_htc_spectral_deinit_debug(struct ath9k_htc_priv *priv)
+{
+ if (config_enabled(CONFIG_ATH9K_DEBUGFS) && priv->rfs_chan_spec_scan) {
+ relay_close(priv->rfs_chan_spec_scan);
+ priv->rfs_chan_spec_scan = NULL;
+ }
+}
+
+void ath9k_htc_spectral_init_debug(struct ath9k_htc_priv *priv)
+{
+ priv->rfs_chan_spec_scan = relay_open("spectral_scan",
+ priv->debug.debugfs_phy,
+ 1024, 256, &rfs_spec_scan_cb,
+ NULL);
+ debugfs_create_file("spectral_scan_ctl",
+ S_IRUSR | S_IWUSR,
+ priv->debug.debugfs_phy, priv,
+ &fops_spec_scan_ctl);
+ debugfs_create_file("spectral_short_repeat",
+ S_IRUSR | S_IWUSR,
+ priv->debug.debugfs_phy, priv,
+ &fops_spectral_short_repeat);
+ debugfs_create_file("spectral_count",
+ S_IRUSR | S_IWUSR,
+ priv->debug.debugfs_phy, priv,
+ &fops_spectral_count);
+ debugfs_create_file("spectral_period",
+ S_IRUSR | S_IWUSR,
+ priv->debug.debugfs_phy, priv,
+ &fops_spectral_period);
+ debugfs_create_file("spectral_fft_period",
+ S_IRUSR | S_IWUSR,
+ priv->debug.debugfs_phy, priv,
+ &fops_spectral_fft_period);
+}
diff --git a/drivers/net/wireless/ath/ath9k/spectral_htc.h b/drivers/net/wireless/ath/ath9k/spectral_htc.h
new file mode 100644
index 0000000..546a8ac
--- /dev/null
+++ b/drivers/net/wireless/ath/ath9k/spectral_htc.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef SPECTRAL_HTC_H
+#define SPECTRAL_HTC_H
+
+/* Added a separate set of spectral scan functions for the ath9k_htc driver */
+void ath9k_htc_spectral_init_debug(struct ath9k_htc_priv *priv);
+void ath9k_htc_spectral_deinit_debug(struct ath9k_htc_priv *priv);
+
+void ath9k_htc_spectral_scan_trigger(struct ieee80211_hw *hw);
+int ath9k_htc_spectral_scan_config(struct ieee80211_hw *hw,
+ enum spectral_mode spectral_mode);
+
+#ifdef CONFIG_ATH9K_HTC_DEBUGFS
+int ath_htc_process_fft(struct ath9k_htc_priv *priv, struct ieee80211_hdr *hdr,
+ struct ath_rx_status *rs, u64 tsf);
+#else
+static inline int ath_htc_process_fft(struct ath9k_htc_priv *priv,
+ struct ieee80211_hdr *hdr,
+ struct ath_rx_status *rs, u64 tsf)
+{
+ return 0;
+}
+#endif /* CONFIG_ATH9K_HTC_DEBUGFS */
+
+#endif /* SPECTRAL_HTC_H */
--
1.7.5.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [ath9k-devel] [PATCH] Adding support for spectral scan for the ath9k_htc driver. Tested the patch on with 9271 chipset to generate spectral scans.
2014-04-06 23:23 [ath9k-devel] [PATCH] Adding support for spectral scan for the ath9k_htc driver. Tested the patch on with 9271 chipset to generate spectral scans Ashish Patro
@ 2014-04-07 13:47 ` Oleksij Rempel
2014-04-07 17:21 ` Ashish Patro
0 siblings, 1 reply; 8+ messages in thread
From: Oleksij Rempel @ 2014-04-07 13:47 UTC (permalink / raw)
To: ath9k-devel
Am 07.04.2014 01:23, schrieb Ashish Patro:
> - Used the same mechanism to collect spectral scan data as used by the existing ath9k code.
> - Minor refactoring done to the code to separate the ath9k and ath9k_htc related spectral scan functions into separate files.
>
> This work was done at the WiNGS Lab at the University of Wisconsin Madison.
Current patch produce lots of duplicated code with ath9k. It will
increase work later. I guess you plan to fix? ;)
--
Regards,
Oleksij
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 278 bytes
Desc: OpenPGP digital signature
Url : http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20140407/1c53356a/attachment.pgp
^ permalink raw reply [flat|nested] 8+ messages in thread
* [ath9k-devel] [PATCH] Adding support for spectral scan for the ath9k_htc driver. Tested the patch on with 9271 chipset to generate spectral scans.
2014-04-07 13:47 ` Oleksij Rempel
@ 2014-04-07 17:21 ` Ashish Patro
2014-04-07 18:10 ` Oleksij Rempel
0 siblings, 1 reply; 8+ messages in thread
From: Ashish Patro @ 2014-04-07 17:21 UTC (permalink / raw)
To: ath9k-devel
Hi Oleksij,
I didn't want to poke too much into the ath9k part of the driver code, so I
wrote it in the current way. All the duplicated code is currently present
in spectral_htc.c. The debugFS related code needs to be mostly duplicated
to provide the same interface for ath9k and ath9k_htc drivers.
The common code can be later moved into ath_common. The main issue is that
the current ath9k code is using references to ath_softc, so the common code
needs to be written to be independent of ath_softc and ath9k_htc_priv data
structures.
Thanks
Ashish
On Mon, Apr 7, 2014 at 8:47 AM, Oleksij Rempel <linux@rempel-privat.de>wrote:
> Am 07.04.2014 01:23, schrieb Ashish Patro:
> > - Used the same mechanism to collect spectral scan data as used by the
> existing ath9k code.
> > - Minor refactoring done to the code to separate the ath9k and ath9k_htc
> related spectral scan functions into separate files.
> >
> > This work was done at the WiNGS Lab at the University of Wisconsin
> Madison.
>
> Current patch produce lots of duplicated code with ath9k. It will
> increase work later. I guess you plan to fix? ;)
>
> --
> Regards,
> Oleksij
>
>
> _______________________________________________
> ath9k-devel mailing list
> ath9k-devel at lists.ath9k.org
> https://lists.ath9k.org/mailman/listinfo/ath9k-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20140407/225fb056/attachment.htm
^ permalink raw reply [flat|nested] 8+ messages in thread
* [ath9k-devel] [PATCH] Adding support for spectral scan for the ath9k_htc driver. Tested the patch on with 9271 chipset to generate spectral scans.
2014-04-07 17:21 ` Ashish Patro
@ 2014-04-07 18:10 ` Oleksij Rempel
2014-04-08 7:51 ` Ashish Patro
0 siblings, 1 reply; 8+ messages in thread
From: Oleksij Rempel @ 2014-04-07 18:10 UTC (permalink / raw)
To: ath9k-devel
Am 07.04.2014 19:21, schrieb Ashish Patro:
> Hi Oleksij,
>
> I didn't want to poke too much into the ath9k part of the driver code,
> so I wrote it in the current way. All the duplicated code is currently
> present in spectral_htc.c. The debugFS related code needs to be mostly
> duplicated to provide the same interface for ath9k and ath9k_htc drivers.
>
> The common code can be later moved into ath_common. The main issue is
> that the current ath9k code is using references to ath_softc, so the
> common code needs to be written to be independent of ath_softc and
> ath9k_htc_priv data structures.
Correct. spectral.c has no too deep ath_softc dependencies, it can be
solved.
I don't like the idea of having patch which i already know, that i will
need rework it. Ath9k-htc has not enough developers, the goal is to
reduce work, not increase it.
> On Mon, Apr 7, 2014 at 8:47 AM, Oleksij Rempel <linux@rempel-privat.de
> <mailto:linux@rempel-privat.de>> wrote:
>
> Am 07.04.2014 01:23, schrieb Ashish Patro:
> > - Used the same mechanism to collect spectral scan data as used by
> the existing ath9k code.
> > - Minor refactoring done to the code to separate the ath9k and
> ath9k_htc related spectral scan functions into separate files.
> >
> > This work was done at the WiNGS Lab at the University of Wisconsin
> Madison.
>
> Current patch produce lots of duplicated code with ath9k. It will
> increase work later. I guess you plan to fix? ;)
>
> --
> Regards,
> Oleksij
>
>
> _______________________________________________
> ath9k-devel mailing list
> ath9k-devel at lists.ath9k.org <mailto:ath9k-devel@lists.ath9k.org>
> https://lists.ath9k.org/mailman/listinfo/ath9k-devel
>
>
--
Regards,
Oleksij
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 278 bytes
Desc: OpenPGP digital signature
Url : http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20140407/03c50324/attachment.pgp
^ permalink raw reply [flat|nested] 8+ messages in thread
* [ath9k-devel] [PATCH] Adding support for spectral scan for the ath9k_htc driver. Tested the patch on with 9271 chipset to generate spectral scans.
2014-04-07 18:10 ` Oleksij Rempel
@ 2014-04-08 7:51 ` Ashish Patro
2014-04-08 8:16 ` Oleksij Rempel
0 siblings, 1 reply; 8+ messages in thread
From: Ashish Patro @ 2014-04-08 7:51 UTC (permalink / raw)
To: ath9k-devel
Hi Oleksij,
I can take a pass at the code to reduce the duplicate code between ath9k and ath9k_htc. I?ll need to make changes to the current spectral.c code and add code into ath_common. Will it be ok for me to do this code refactoring? I?ve so far avoided doing significant refactoring of the existing code in the ath9k driver.
Thanks
Ashish
On Apr 7, 2014, at 1:10 PM, Oleksij Rempel <linux@rempel-privat.de> wrote:
> Am 07.04.2014 19:21, schrieb Ashish Patro:
>> Hi Oleksij,
>>
>> I didn't want to poke too much into the ath9k part of the driver code,
>> so I wrote it in the current way. All the duplicated code is currently
>> present in spectral_htc.c. The debugFS related code needs to be mostly
>> duplicated to provide the same interface for ath9k and ath9k_htc drivers.
>>
>> The common code can be later moved into ath_common. The main issue is
>> that the current ath9k code is using references to ath_softc, so the
>> common code needs to be written to be independent of ath_softc and
>> ath9k_htc_priv data structures.
>
> Correct. spectral.c has no too deep ath_softc dependencies, it can be
> solved.
> I don't like the idea of having patch which i already know, that i will
> need rework it. Ath9k-htc has not enough developers, the goal is to
> reduce work, not increase it.
>
>> On Mon, Apr 7, 2014 at 8:47 AM, Oleksij Rempel <linux@rempel-privat.de
>> <mailto:linux@rempel-privat.de>> wrote:
>>
>> Am 07.04.2014 01:23, schrieb Ashish Patro:
>>> - Used the same mechanism to collect spectral scan data as used by
>> the existing ath9k code.
>>> - Minor refactoring done to the code to separate the ath9k and
>> ath9k_htc related spectral scan functions into separate files.
>>>
>>> This work was done at the WiNGS Lab at the University of Wisconsin
>> Madison.
>>
>> Current patch produce lots of duplicated code with ath9k. It will
>> increase work later. I guess you plan to fix? ;)
>>
>> --
>> Regards,
>> Oleksij
>>
>>
>> _______________________________________________
>> ath9k-devel mailing list
>> ath9k-devel at lists.ath9k.org <mailto:ath9k-devel@lists.ath9k.org>
>> https://lists.ath9k.org/mailman/listinfo/ath9k-devel
>>
>>
>
>
> --
> Regards,
> Oleksij
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [ath9k-devel] [PATCH] Adding support for spectral scan for the ath9k_htc driver. Tested the patch on with 9271 chipset to generate spectral scans.
2014-04-08 7:51 ` Ashish Patro
@ 2014-04-08 8:16 ` Oleksij Rempel
2014-04-14 18:32 ` Ashish Patro
0 siblings, 1 reply; 8+ messages in thread
From: Oleksij Rempel @ 2014-04-08 8:16 UTC (permalink / raw)
To: ath9k-devel
Am 08.04.2014 09:51, schrieb Ashish Patro:
> Hi Oleksij,
>
> I can take a pass at the code to reduce the duplicate code between ath9k and ath9k_htc. I?ll need to make changes to the current spectral.c code and add code into ath_common. Will it be ok for me to do this code refactoring? I?ve so far avoided doing significant refactoring of the existing code in the ath9k driver.
It will be great if you 'll do it. If patches are ok, they will be accepted.
Please separate all you stages to different patches. It will make
bisection easier. End result should looks some way like this:
PATCH 1 - move spectralscan related data from ath_softc to some common
struct and make all related changes in ath9k driver.
PATCH 2 - move all common spectral related functions to common-spectral.c
PATCH 3 - make use of common-spectral.c in ath9k_htc.
After each patch source should be compilable and driver should work.
> Thanks
> Ashish
>
> On Apr 7, 2014, at 1:10 PM, Oleksij Rempel <linux@rempel-privat.de> wrote:
>
>> Am 07.04.2014 19:21, schrieb Ashish Patro:
>>> Hi Oleksij,
>>>
>>> I didn't want to poke too much into the ath9k part of the driver code,
>>> so I wrote it in the current way. All the duplicated code is currently
>>> present in spectral_htc.c. The debugFS related code needs to be mostly
>>> duplicated to provide the same interface for ath9k and ath9k_htc drivers.
>>>
>>> The common code can be later moved into ath_common. The main issue is
>>> that the current ath9k code is using references to ath_softc, so the
>>> common code needs to be written to be independent of ath_softc and
>>> ath9k_htc_priv data structures.
>>
>> Correct. spectral.c has no too deep ath_softc dependencies, it can be
>> solved.
>> I don't like the idea of having patch which i already know, that i will
>> need rework it. Ath9k-htc has not enough developers, the goal is to
>> reduce work, not increase it.
>>
>>> On Mon, Apr 7, 2014 at 8:47 AM, Oleksij Rempel <linux@rempel-privat.de
>>> <mailto:linux@rempel-privat.de>> wrote:
>>>
>>> Am 07.04.2014 01:23, schrieb Ashish Patro:
>>>> - Used the same mechanism to collect spectral scan data as used by
>>> the existing ath9k code.
>>>> - Minor refactoring done to the code to separate the ath9k and
>>> ath9k_htc related spectral scan functions into separate files.
>>>>
>>>> This work was done at the WiNGS Lab at the University of Wisconsin
>>> Madison.
>>>
>>> Current patch produce lots of duplicated code with ath9k. It will
>>> increase work later. I guess you plan to fix? ;)
>>>
>>> --
>>> Regards,
>>> Oleksij
>>>
>>>
>>> _______________________________________________
>>> ath9k-devel mailing list
>>> ath9k-devel at lists.ath9k.org <mailto:ath9k-devel@lists.ath9k.org>
>>> https://lists.ath9k.org/mailman/listinfo/ath9k-devel
>>>
>>>
>>
>>
>> --
>> Regards,
>> Oleksij
>>
>
--
Regards,
Oleksij
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 278 bytes
Desc: OpenPGP digital signature
Url : http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20140408/4c5fcdc4/attachment-0001.pgp
^ permalink raw reply [flat|nested] 8+ messages in thread
* [ath9k-devel] [PATCH] Adding support for spectral scan for the ath9k_htc driver. Tested the patch on with 9271 chipset to generate spectral scans.
2014-04-08 8:16 ` Oleksij Rempel
@ 2014-04-14 18:32 ` Ashish Patro
2014-04-14 20:23 ` Oleksij Rempel
0 siblings, 1 reply; 8+ messages in thread
From: Ashish Patro @ 2014-04-14 18:32 UTC (permalink / raw)
To: ath9k-devel
Hi Oleksij,
I've resubmitted three new patches to refactor the code and spectral scan
support to ath9k_htc as discussed earlier.
Thanks
Ashish
On Tue, Apr 8, 2014 at 3:16 AM, Oleksij Rempel <linux@rempel-privat.de>wrote:
> Am 08.04.2014 09:51, schrieb Ashish Patro:
> > Hi Oleksij,
> >
> > I can take a pass at the code to reduce the duplicate code between ath9k
> and ath9k_htc. I?ll need to make changes to the current spectral.c code and
> add code into ath_common. Will it be ok for me to do this code refactoring?
> I?ve so far avoided doing significant refactoring of the existing code in
> the ath9k driver.
>
> It will be great if you 'll do it. If patches are ok, they will be
> accepted.
> Please separate all you stages to different patches. It will make
> bisection easier. End result should looks some way like this:
> PATCH 1 - move spectralscan related data from ath_softc to some common
> struct and make all related changes in ath9k driver.
> PATCH 2 - move all common spectral related functions to common-spectral.c
> PATCH 3 - make use of common-spectral.c in ath9k_htc.
>
> After each patch source should be compilable and driver should work.
>
> > Thanks
> > Ashish
> >
> > On Apr 7, 2014, at 1:10 PM, Oleksij Rempel <linux@rempel-privat.de>
> wrote:
> >
> >> Am 07.04.2014 19:21, schrieb Ashish Patro:
> >>> Hi Oleksij,
> >>>
> >>> I didn't want to poke too much into the ath9k part of the driver code,
> >>> so I wrote it in the current way. All the duplicated code is currently
> >>> present in spectral_htc.c. The debugFS related code needs to be mostly
> >>> duplicated to provide the same interface for ath9k and ath9k_htc
> drivers.
> >>>
> >>> The common code can be later moved into ath_common. The main issue is
> >>> that the current ath9k code is using references to ath_softc, so the
> >>> common code needs to be written to be independent of ath_softc and
> >>> ath9k_htc_priv data structures.
> >>
> >> Correct. spectral.c has no too deep ath_softc dependencies, it can be
> >> solved.
> >> I don't like the idea of having patch which i already know, that i will
> >> need rework it. Ath9k-htc has not enough developers, the goal is to
> >> reduce work, not increase it.
> >>
> >>> On Mon, Apr 7, 2014 at 8:47 AM, Oleksij Rempel <linux@rempel-privat.de
> >>> <mailto:linux@rempel-privat.de>> wrote:
> >>>
> >>> Am 07.04.2014 01:23, schrieb Ashish Patro:
> >>>> - Used the same mechanism to collect spectral scan data as used by
> >>> the existing ath9k code.
> >>>> - Minor refactoring done to the code to separate the ath9k and
> >>> ath9k_htc related spectral scan functions into separate files.
> >>>>
> >>>> This work was done at the WiNGS Lab at the University of Wisconsin
> >>> Madison.
> >>>
> >>> Current patch produce lots of duplicated code with ath9k. It will
> >>> increase work later. I guess you plan to fix? ;)
> >>>
> >>> --
> >>> Regards,
> >>> Oleksij
> >>>
> >>>
> >>> _______________________________________________
> >>> ath9k-devel mailing list
> >>> ath9k-devel at lists.ath9k.org <mailto:ath9k-devel@lists.ath9k.org>
> >>> https://lists.ath9k.org/mailman/listinfo/ath9k-devel
> >>>
> >>>
> >>
> >>
> >> --
> >> Regards,
> >> Oleksij
> >>
> >
>
>
> --
> Regards,
> Oleksij
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20140414/ff41643a/attachment.htm
^ permalink raw reply [flat|nested] 8+ messages in thread
* [ath9k-devel] [PATCH] Adding support for spectral scan for the ath9k_htc driver. Tested the patch on with 9271 chipset to generate spectral scans.
2014-04-14 18:32 ` Ashish Patro
@ 2014-04-14 20:23 ` Oleksij Rempel
0 siblings, 0 replies; 8+ messages in thread
From: Oleksij Rempel @ 2014-04-14 20:23 UTC (permalink / raw)
To: ath9k-devel
Am 14.04.2014 20:32, schrieb Ashish Patro:
> Hi Oleksij,
>
> I've resubmitted three new patches to refactor the code and spectral
> scan support to ath9k_htc as discussed earlier.
>
> Thanks
> Ashish
>
Thank you,
i'll write some comments.
>
> On Tue, Apr 8, 2014 at 3:16 AM, Oleksij Rempel <linux@rempel-privat.de
> <mailto:linux@rempel-privat.de>> wrote:
>
> Am 08.04.2014 09:51, schrieb Ashish Patro:
> > Hi Oleksij,
> >
> > I can take a pass at the code to reduce the duplicate code between
> ath9k and ath9k_htc. I?ll need to make changes to the current
> spectral.c code and add code into ath_common. Will it be ok for me
> to do this code refactoring? I?ve so far avoided doing significant
> refactoring of the existing code in the ath9k driver.
>
> It will be great if you 'll do it. If patches are ok, they will be
> accepted.
> Please separate all you stages to different patches. It will make
> bisection easier. End result should looks some way like this:
> PATCH 1 - move spectralscan related data from ath_softc to some common
> struct and make all related changes in ath9k driver.
> PATCH 2 - move all common spectral related functions to
> common-spectral.c
> PATCH 3 - make use of common-spectral.c in ath9k_htc.
>
> After each patch source should be compilable and driver should work.
>
> > Thanks
> > Ashish
> >
> > On Apr 7, 2014, at 1:10 PM, Oleksij Rempel <linux@rempel-privat.de
> <mailto:linux@rempel-privat.de>> wrote:
> >
> >> Am 07.04.2014 19:21, schrieb Ashish Patro:
> >>> Hi Oleksij,
> >>>
> >>> I didn't want to poke too much into the ath9k part of the driver
> code,
> >>> so I wrote it in the current way. All the duplicated code is
> currently
> >>> present in spectral_htc.c. The debugFS related code needs to be
> mostly
> >>> duplicated to provide the same interface for ath9k and ath9k_htc
> drivers.
> >>>
> >>> The common code can be later moved into ath_common. The main
> issue is
> >>> that the current ath9k code is using references to ath_softc, so the
> >>> common code needs to be written to be independent of ath_softc and
> >>> ath9k_htc_priv data structures.
> >>
> >> Correct. spectral.c has no too deep ath_softc dependencies, it can be
> >> solved.
> >> I don't like the idea of having patch which i already know, that
> i will
> >> need rework it. Ath9k-htc has not enough developers, the goal is to
> >> reduce work, not increase it.
> >>
> >>> On Mon, Apr 7, 2014 at 8:47 AM, Oleksij Rempel
> <linux at rempel-privat.de <mailto:linux@rempel-privat.de>
> >>> <mailto:linux at rempel-privat.de <mailto:linux@rempel-privat.de>>>
> wrote:
> >>>
> >>> Am 07.04.2014 01:23, schrieb Ashish Patro:
> >>>> - Used the same mechanism to collect spectral scan data as used by
> >>> the existing ath9k code.
> >>>> - Minor refactoring done to the code to separate the ath9k and
> >>> ath9k_htc related spectral scan functions into separate files.
> >>>>
> >>>> This work was done at the WiNGS Lab at the University of Wisconsin
> >>> Madison.
> >>>
--
Regards,
Oleksij
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 278 bytes
Desc: OpenPGP digital signature
Url : http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20140414/e3766eeb/attachment.pgp
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-04-14 20:23 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-06 23:23 [ath9k-devel] [PATCH] Adding support for spectral scan for the ath9k_htc driver. Tested the patch on with 9271 chipset to generate spectral scans Ashish Patro
2014-04-07 13:47 ` Oleksij Rempel
2014-04-07 17:21 ` Ashish Patro
2014-04-07 18:10 ` Oleksij Rempel
2014-04-08 7:51 ` Ashish Patro
2014-04-08 8:16 ` Oleksij Rempel
2014-04-14 18:32 ` Ashish Patro
2014-04-14 20:23 ` Oleksij Rempel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox