Skip to contentSkip to conversation

make spectral code common for both ath9k drivers

PATCH In review Oleksij Rempel 2 participants 25 messages Nov 6, 2014 – Nov 12, 2014

Subsystems (2)
lore
Share & tools
lore
#4 lore raw

PATCH 4/21 ath9k: use struct dentry by ath9k_spectral_init_debug

In reply to Oleksij Rempel

this will alow us to make ath_softc independent code.

---
 drivers/net/wireless/ath/ath9k/debug.c    |  2 +-
 drivers/net/wireless/ath/ath9k/spectral.c | 14 +++++++-------
 drivers/net/wireless/ath/ath9k/spectral.h |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath9k/debug.c +1 -1
index 2a2a17d..f0a802e 100644
@@ -1330,7 +1330,7 @@ int ath9k_init_debug(struct ath_hw *ah)
 
 	ath9k_dfs_init_debug(sc);
 	ath9k_tx99_init_debug(sc);
-	ath9k_spectral_init_debug(sc);
+	ath9k_spectral_init_debug(sc, sc->debug.debugfs_phy);
 
 	debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, sc,
 			    &fops_dma);
drivers/net/wireless/ath/ath9k/spectral.c +7 -7
index 555fc2a..d272380 100644
@@ -514,30 +514,30 @@ void ath9k_spectral_deinit_debug(struct ath_softc *sc)
 	}
 }
 
-void ath9k_spectral_init_debug(struct ath_softc *sc)
+void ath9k_spectral_init_debug(struct ath_softc *sc, struct dentry *debugfs_phy)
 {
 	sc->spec_priv.rfs_chan_spec_scan = relay_open("spectral_scan",
-					    sc->debug.debugfs_phy,
+					    debugfs_phy,
 					    1024, 256, &rfs_spec_scan_cb,
 					    NULL);
 	debugfs_create_file("spectral_scan_ctl",
 			    S_IRUSR | S_IWUSR,
-			    sc->debug.debugfs_phy, sc,
+			    debugfs_phy, sc,
 			    &fops_spec_scan_ctl);
 	debugfs_create_file("spectral_short_repeat",
 			    S_IRUSR | S_IWUSR,
-			    sc->debug.debugfs_phy, sc,
+			    debugfs_phy, sc,
 			    &fops_spectral_short_repeat);
 	debugfs_create_file("spectral_count",
 			    S_IRUSR | S_IWUSR,
-			    sc->debug.debugfs_phy, sc,
+			    debugfs_phy, sc,
 			    &fops_spectral_count);
 	debugfs_create_file("spectral_period",
 			    S_IRUSR | S_IWUSR,
-			    sc->debug.debugfs_phy, sc,
+			    debugfs_phy, sc,
 			    &fops_spectral_period);
 	debugfs_create_file("spectral_fft_period",
 			    S_IRUSR | S_IWUSR,
-			    sc->debug.debugfs_phy, sc,
+			    debugfs_phy, sc,
 			    &fops_spectral_fft_period);
 }
drivers/net/wireless/ath/ath9k/spectral.h +1 -1
index dfe6f68..2269589 100644
@@ -129,7 +129,7 @@ static inline u8 spectral_bitmap_weight(u8 *bins)
 	return bins[0] & 0x3f;
 }
 
-void ath9k_spectral_init_debug(struct ath_softc *sc);
+void ath9k_spectral_init_debug(struct ath_softc *sc, struct dentry *debugfs_phy);
 void ath9k_spectral_deinit_debug(struct ath_softc *sc);
 
 void ath9k_spectral_scan_trigger(struct ieee80211_hw *hw);
Signature · 1 line
1.9.1
#8 lore raw

PATCH 8/21 ath9k: add ath_ps_ops bindings

In reply to Oleksij Rempel
---
 drivers/net/wireless/ath/ath9k/init.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/net/wireless/ath/ath9k/init.c +16 -0
index fe811b3..61232d0 100644
@@ -88,6 +88,21 @@ static const struct ieee80211_tpt_blink ath9k_tpt_blink[] = {
 
 static void ath9k_deinit_softc(struct ath_softc *sc);
 
+void ath9k_op_ps_wakeup(struct ath_common *common)
+{
+	ath9k_ps_wakeup((struct ath_softc *) common->priv);
+}
+
+void ath9k_op_ps_restore(struct ath_common *common)
+{
+	ath9k_ps_restore((struct ath_softc *) common->priv);
+}
+
+struct ath_ps_ops ath9k_ps_ops = {
+	.wakeup = ath9k_op_ps_wakeup,
+	.restore = ath9k_op_ps_restore,
+};
+
 /*
  * Read and write, they both share the same lock. We do this to serialize
  * reads and writes on Atheros 802.11n PCI devices only. This is required
@@ -540,6 +555,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
 
 	common->ops = &ah->reg_ops;
 	common->bus_ops = bus_ops;
+	common->ps_ops = &ath9k_ps_ops;
 	common->ah = ah;
 	common->hw = sc->hw;
 	common->priv = sc;
Signature · 1 line
1.9.1
#12 lore raw

PATCH 12/21 ath9k: move ath9k_spectral_scan_ from main.c to spectral.c

In reply to Oleksij Rempel

Now we should be ready to make this code common.

---
 drivers/net/wireless/ath/ath9k/main.c     | 70 -------------------------------
 drivers/net/wireless/ath/ath9k/spectral.c | 70 +++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 70 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +0 -70
index ec1ebf9..2f0eec2 100644
@@ -1339,76 +1339,6 @@ static void ath9k_disable_ps(struct ath_softc *sc)
 	ath_dbg(common, PS, "PowerSave disabled\n");
 }
 
-void ath9k_spectral_scan_trigger(struct ath_common *common,
-				 struct ath_spec_scan_priv *spec_priv)
-{
-	struct ath_hw *ah = spec_priv->ah;
-	u32 rxfilter;
-
-	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;
-	}
-
-	ath_ps_ops(common)->wakeup(common);
-	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_spectral_scan_config(common, spec_priv, spec_priv->spectral_mode);
-	ath9k_hw_ops(ah)->spectral_scan_trigger(ah);
-	ath_ps_ops(common)->restore(common);
-}
-
-int ath9k_spectral_scan_config(struct ath_common *common,
-			       struct ath_spec_scan_priv *spec_priv,
-			       enum spectral_mode spectral_mode)
-{
-	struct ath_hw *ah = spec_priv->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:
-		spec_priv->spec_config.enabled = 0;
-		break;
-	case SPECTRAL_BACKGROUND:
-		/* send endless samples.
-		 * TODO: is this really useful for "background"?
-		 */
-		spec_priv->spec_config.endless = 1;
-		spec_priv->spec_config.enabled = 1;
-		break;
-	case SPECTRAL_CHANSCAN:
-	case SPECTRAL_MANUAL:
-		spec_priv->spec_config.endless = 0;
-		spec_priv->spec_config.enabled = 1;
-		break;
-	default:
-		return -1;
-	}
-
-	ath_ps_ops(common)->wakeup(common);
-	ath9k_hw_ops(ah)->spectral_scan_config(ah, &spec_priv->spec_config);
-	ath_ps_ops(common)->restore(common);
-
-	spec_priv->spectral_mode = spectral_mode;
-
-	return 0;
-}
-
 static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
 {
 	struct ath_softc *sc = hw->priv;
drivers/net/wireless/ath/ath9k/spectral.c +70 -0

76 lines not on this page · raw message

Signature · 1 line
1.9.1
#0 lore raw

cover make spectral code common for both ath9k drivers

- makes spectral scan code common for both ath9k and ath9k_htc.
- add spectral scan support to ath9k_htc.

Oleksij Rempel (21):
ath9k: add struct ath_spec_scan_priv
ath9k: move spectral_mode to ath_spec_scan_priv
ath9k: move spec_config to ath_spec_scan_priv
ath9k: use struct dentry by ath9k_spectral_init_debug
ath9k: add ath_hw to ath_spec_scan_priv
ath9k: remove all struct ath_softc dependencies from spectral code
ath: add struct ath_ps_ops
ath9k: add ath_ps_ops bindings
ath9k: use ath_ps_ops in ath9k_spectral_scan_
ath9k: use ath_common instead of ieee80211_hw in ath9k_spectral_scan_
ath9k: make ath9k_spectral_scan_ do not depend on ath_softc
ath9k: move ath9k_spectral_scan_ from main.c to spectral.c
ath9k: move spectral.* to common-spectral.*
ath9k: For AR9271 chipsets, set count = 0 for endless samples.
ath9k_htc: fix rs_datalen conversation
ath9k_htc: add ath_ps_ops bindings
ath9k_htc: add struct ath_spec_scan_priv to ath9k_htc_priv
ath9k_htc: set initial spec_config values
ath9k_htc: trigger spectral scan on set_channel
ath9k_htc: process rx spectral packets
ath9k_htc: add spectral scan debug interface

 drivers/net/wireless/ath/ath.h                   |  11 +
 drivers/net/wireless/ath/ath9k/Makefile          |   6 +-
 drivers/net/wireless/ath/ath9k/ar9002_phy.c      |   9 +-
 drivers/net/wireless/ath/ath9k/ath9k.h           |   7 +-
 drivers/net/wireless/ath/ath9k/channel.c         |   4 +-
 drivers/net/wireless/ath/ath9k/common-spectral.c | 620 +++++++++++++++++++++++
 drivers/net/wireless/ath/ath9k/common-spectral.h | 154 ++++++
 drivers/net/wireless/ath/ath9k/common.h          |   1 +
 drivers/net/wireless/ath/ath9k/debug.c           |   4 +-
 drivers/net/wireless/ath/ath9k/htc.h             |   3 +
 drivers/net/wireless/ath/ath9k/htc_drv_debug.c   |   6 +
 drivers/net/wireless/ath/ath9k/htc_drv_init.c    |  25 +
 drivers/net/wireless/ath/ath9k/htc_drv_main.c    |   4 +
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c    |  16 +-
 drivers/net/wireless/ath/ath9k/init.c            |  29 +-
 drivers/net/wireless/ath/ath9k/main.c            |  72 ---
 drivers/net/wireless/ath/ath9k/recv.c            |   2 +-
 drivers/net/wireless/ath/ath9k/spectral.c        | 543 --------------------
 drivers/net/wireless/ath/ath9k/spectral.h        | 145 ------
 19 files changed, 878 insertions(+), 783 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath9k/common-spectral.c
 create mode 100644 drivers/net/wireless/ath/ath9k/common-spectral.h
 delete mode 100644 drivers/net/wireless/ath/ath9k/spectral.c
 delete mode 100644 drivers/net/wireless/ath/ath9k/spectral.h
Signature · 1 line
1.9.1
#18 lore raw

PATCH 18/21 ath9k_htc: set initial spec_config values

use values provided by Ashish Patro <[email protected]>

---
 drivers/net/wireless/ath/ath9k/htc_drv_init.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/wireless/ath/ath9k/htc_drv_init.c +8 -0
index f91b8e6..285d0ad 100644
@@ -464,6 +464,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_priv.ah = priv->ah;
+	priv->spec_priv.spec_config.enabled = 0;
+	priv->spec_priv.spec_config.short_repeat = false;
+	priv->spec_priv.spec_config.count = 8;
+	priv->spec_priv.spec_config.endless = false;
+	priv->spec_priv.spec_config.period = 0x12;
+	priv->spec_priv.spec_config.fft_period = 0x02;
 }
 
 static int ath9k_init_priv(struct ath9k_htc_priv *priv,
Signature · 1 line
1.9.1
#19 lore raw

PATCH 19/21 ath9k_htc: trigger spectral scan on set_channel

In reply to Oleksij Rempel
---
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/ath9k/htc_drv_main.c +4 -0
index 994fff1..689ac99 100644
@@ -314,6 +314,10 @@ 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, &common->op_flags) &&
+		     priv->spec_priv.spectral_mode == SPECTRAL_CHANSCAN)
+		ath9k_cmn_spectral_scan_trigger(common, &priv->spec_priv);
 err:
 	ath9k_htc_ps_restore(priv);
 	return ret;
Signature · 1 line
1.9.1
#7 lore raw

PATCH 7/21 ath: add struct ath_ps_ops

In reply to Oleksij Rempel

we will need it to make common code

---
 drivers/net/wireless/ath/ath.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/net/wireless/ath/ath.h +11 -0
index 999d24f..ccba4fe 100644
@@ -135,6 +135,11 @@ struct ath_ops {
 struct ath_common;
 struct ath_bus_ops;
 
+struct ath_ps_ops {
+	void (*wakeup)(struct ath_common *common);
+	void (*restore)(struct ath_common *common);
+};
+
 struct ath_common {
 	void *ah;
 	void *priv;
@@ -169,6 +174,7 @@ struct ath_common {
 	struct ath_regulatory reg_world_copy;
 	const struct ath_ops *ops;
 	const struct ath_bus_ops *bus_ops;
+	const struct ath_ps_ops *ps_ops;
 
 	bool btcoex_enabled;
 	bool disable_ani;
@@ -178,6 +184,11 @@ struct ath_common {
 	struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
 };
 
+static inline const struct ath_ps_ops *ath_ps_ops(struct ath_common *common)
+{
+	return common->ps_ops;
+}
+
 struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
 				u32 len,
 				gfp_t gfp_mask);
Signature · 1 line
1.9.1
#14 lore raw

PATCH 14/21 ath9k: For AR9271 chipsets, set count = 0 for endless samples.

In reply to Oleksij Rempel

not sure why.
Initially provided by Ashish Patro <[email protected]>

---
 drivers/net/wireless/ath/ath9k/ar9002_phy.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath9k/ar9002_phy.c +6 -3
index 9a2afa2..fc08162 100644
@@ -643,9 +643,12 @@ static void ar9002_hw_spectral_scan_config(struct ath_hw *ah,
 	 * and fix otherwise.
 	 */
 	count = param->count;
-	if (param->endless)
-		count = 0x80;
-	else if (count & 0x80)
+	if (param->endless) {
+		if (AR_SREV_9271(ah))
+			count = 0;
+		else
+			count = 0x80;
+	} else if (count & 0x80)
 		count = 0x7f;
 
 	REG_RMW_FIELD(ah, AR_PHY_SPECTRAL_SCAN,
Signature · 1 line
1.9.1
#20 lore raw

PATCH 20/21 ath9k_htc: process rx spectral packets

In reply to Oleksij Rempel

use code provided by Ashish Patro <[email protected]>

---
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +14 -0
index 2622002..a0f58e2 100644
@@ -1012,6 +1012,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_cmn_process_fft(&priv->spec_priv, hdr,
+				    &rx_stats, rx_status->mactime)) {
+			/* TODO: Code to collect spectral scan statistics */
+		}
+		goto rx_next;
+	}
+
 	if (!ath9k_cmn_rx_accept(common, hdr, rx_status, &rx_stats,
 			&decrypt_error, priv->rxfilter))
 		goto rx_next;
Signature · 1 line
1.9.1
#17 lore raw

PATCH 17/21 ath9k_htc: add struct ath_spec_scan_priv to ath9k_htc_priv

In reply to Oleksij Rempel
---
 drivers/net/wireless/ath/ath9k/htc.h | 1 +
 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath9k/htc.h +1 -0
index 09a5d72..1f019aa 100644
@@ -481,6 +481,7 @@ struct ath9k_htc_priv {
 	unsigned long op_flags;
 
 	struct ath9k_hw_cal_data caldata;
+	struct ath_spec_scan_priv spec_priv;
 
 	spinlock_t beacon_lock;
 	struct ath_beacon_config cur_beacon_conf;
Signature · 1 line
1.9.1
#16 lore raw

PATCH 16/21 ath9k_htc: add ath_ps_ops bindings

In reply to Oleksij Rempel
---
 drivers/net/wireless/ath/ath9k/htc_drv_init.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/net/wireless/ath/ath9k/htc_drv_init.c +16 -0
index 4014c4b..f91b8e6 100644
@@ -53,6 +53,21 @@ static const struct ieee80211_tpt_blink ath9k_htc_tpt_blink[] = {
 };
 #endif
 
+void ath9k_htc_op_ps_wakeup(struct ath_common *common)
+{
+	ath9k_htc_ps_wakeup((struct ath9k_htc_priv *) common->priv);
+}
+
+void ath9k_htc_op_ps_restore(struct ath_common *common)
+{
+	ath9k_htc_ps_restore((struct ath9k_htc_priv *) common->priv);
+}
+
+struct ath_ps_ops ath9k_htc_ps_ops = {
+	.wakeup = ath9k_htc_op_ps_wakeup,
+	.restore = ath9k_htc_op_ps_restore,
+};
+
 static int ath9k_htc_wait_for_target(struct ath9k_htc_priv *priv)
 {
 	int time_left;
@@ -478,6 +493,7 @@ static int ath9k_init_priv(struct ath9k_htc_priv *priv,
 
 	common = ath9k_hw_common(ah);
 	common->ops = &ah->reg_ops;
+	common->ps_ops = &ath9k_htc_ps_ops;
 	common->bus_ops = &ath9k_usb_bus_ops;
 	common->ah = ah;
 	common->hw = priv->hw;
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/21 ath9k: move spectral_mode to ath_spec_scan_priv

In reply to Oleksij Rempel
---
 drivers/net/wireless/ath/ath9k/ath9k.h    | 1 -
 drivers/net/wireless/ath/ath9k/channel.c  | 2 +-
 drivers/net/wireless/ath/ath9k/main.c     | 4 ++--
 drivers/net/wireless/ath/ath9k/spectral.c | 2 +-
 drivers/net/wireless/ath/ath9k/spectral.h | 1 +
 5 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -1
index 65feda3..b80e789 100644
@@ -1029,7 +1029,6 @@ struct ath_softc {
 	u64 dfs_prev_pulse_ts;
 	u32 wow_enabled;
 	/* relay(fs) channel for spectral scan */
-	enum spectral_mode spectral_mode;
 	struct ath_spec_scan spec_config;
 	struct ath_spec_scan_priv spec_priv;
 
drivers/net/wireless/ath/ath9k/channel.c +1 -1
index c7234d5..25a21fa 100644
@@ -92,7 +92,7 @@ static int ath_set_channel(struct ath_softc *sc)
 	} else {
 		/* perform spectral scan if requested. */
 		if (test_bit(ATH_OP_SCANNING, &common->op_flags) &&
-			sc->spectral_mode == SPECTRAL_CHANSCAN)
+			sc->spec_priv.spectral_mode == SPECTRAL_CHANSCAN)
 			ath9k_spectral_scan_trigger(hw);
 	}
 
drivers/net/wireless/ath/ath9k/main.c +2 -2
index a91ee92..cf7a215 100644
@@ -1365,7 +1365,7 @@ void ath9k_spectral_scan_trigger(struct ieee80211_hw *hw)
 	 * configuration, otherwise the register will have its values reset
 	 * (on my ar9220 to value 0x01002310)
 	 */
-	ath9k_spectral_scan_config(hw, sc->spectral_mode);
+	ath9k_spectral_scan_config(hw, sc->spec_priv.spectral_mode);
 	ath9k_hw_ops(ah)->spectral_scan_trigger(ah);
 	ath9k_ps_restore(sc);
 }
@@ -1406,7 +1406,7 @@ int ath9k_spectral_scan_config(struct ieee80211_hw *hw,
 	ath9k_hw_ops(ah)->spectral_scan_config(ah, &sc->spec_config);
 	ath9k_ps_restore(sc);
 
-	sc->spectral_mode = spectral_mode;
+	sc->spec_priv.spectral_mode = spectral_mode;
 
 	return 0;
 }
drivers/net/wireless/ath/ath9k/spectral.c +1 -1
index 348dddd..3a394e1 100644
@@ -215,7 +215,7 @@ static ssize_t read_file_spec_scan_ctl(struct file *file, char __user *user_buf,
 	char *mode = "";
 	unsigned int len;
 
-	switch (sc->spectral_mode) {
+	switch (sc->spec_priv.spectral_mode) {
 	case SPECTRAL_DISABLED:
 		mode = "disable";
 		break;
drivers/net/wireless/ath/ath9k/spectral.h +1 -0
index 533d8a1..0acdc43 100644
@@ -94,6 +94,7 @@ struct ath_ht20_40_fft_packet {
 
 struct ath_spec_scan_priv {
 	struct rchan *rfs_chan_spec_scan;
+	enum spectral_mode spectral_mode;
 };
 
 #define SPECTRAL_HT20_40_TOTAL_DATA_LEN	(sizeof(struct ath_ht20_40_fft_packet))
Signature · 1 line
1.9.1
#21 lore raw

PATCH 21/21 ath9k_htc: add spectral scan debug interface

In reply to Oleksij Rempel
---
 drivers/net/wireless/ath/ath9k/htc.h           | 2 ++
 drivers/net/wireless/ath/ath9k/htc_drv_debug.c | 6 ++++++
 drivers/net/wireless/ath/ath9k/htc_drv_init.c  | 1 +
 3 files changed, 9 insertions(+)
drivers/net/wireless/ath/ath9k/htc.h +2 -0
index 1f019aa..b34acde 100644
@@ -626,8 +626,10 @@ int ath9k_htc_resume(struct htc_target *htc_handle);
 #endif
 #ifdef CONFIG_ATH9K_HTC_DEBUGFS
 int ath9k_htc_init_debug(struct ath_hw *ah);
+void ath9k_htc_deinit_debug(struct ath9k_htc_priv *priv);
 #else
 static inline int ath9k_htc_init_debug(struct ath_hw *ah) { return 0; };
+static inline void ath9k_htc_deinit_debug(struct ath9k_htc_priv *priv) { return 0; };
 #endif /* CONFIG_ATH9K_HTC_DEBUGFS */
 
 #endif /* HTC_H */
drivers/net/wireless/ath/ath9k/htc_drv_debug.c +6 -0
index 8b529e4..8cef1ed 100644
@@ -490,6 +490,10 @@ void ath9k_htc_get_et_stats(struct ieee80211_hw *hw,
 	WARN_ON(i != ATH9K_HTC_SSTATS_LEN);
 }
 
+void ath9k_htc_deinit_debug(struct ath9k_htc_priv *priv)
+{
+	ath9k_cmn_spectral_deinit_debug(&priv->spec_priv);
+}
 
 int ath9k_htc_init_debug(struct ath_hw *ah)
 {
@@ -501,6 +505,8 @@ int ath9k_htc_init_debug(struct ath_hw *ah)
 	if (!priv->debug.debugfs_phy)
 		return -ENOMEM;
 
+	ath9k_cmn_spectral_init_debug(&priv->spec_priv, priv->debug.debugfs_phy);
+
 	debugfs_create_file("tgt_int_stats", S_IRUSR, priv->debug.debugfs_phy,
 			    priv, &fops_tgt_int_stats);
 	debugfs_create_file("tgt_tx_stats", S_IRUSR, priv->debug.debugfs_phy,
drivers/net/wireless/ath/ath9k/htc_drv_init.c +1 -0
index 285d0ad..ad8f1dc 100644
@@ -102,6 +102,7 @@ static void ath9k_deinit_device(struct ath9k_htc_priv *priv)
 
 	wiphy_rfkill_stop_polling(hw->wiphy);
 	ath9k_deinit_leds(priv);
+	ath9k_htc_deinit_debug(priv);
 	ieee80211_unregister_hw(hw);
 	ath9k_rx_cleanup(priv);
 	ath9k_tx_cleanup(priv);
Signature · 1 line
1.9.1
#15 lore raw

PATCH 15/21 ath9k_htc: fix rs_datalen conversation

In reply to Oleksij Rempel

For some reason it didn't coused obvious problems.

---
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +1 -1
index f0484b1..2622002 100644
@@ -946,7 +946,7 @@ static inline void convert_htc_flag(struct ath_rx_status *rx_stats,
 static void rx_status_htc_to_ath(struct ath_rx_status *rx_stats,
 				 struct ath_htc_rx_status *rxstatus)
 {
-	rx_stats->rs_datalen	= rxstatus->rs_datalen;
+	rx_stats->rs_datalen	= be16_to_cpu(rxstatus->rs_datalen);
 	rx_stats->rs_status	= rxstatus->rs_status;
 	rx_stats->rs_phyerr	= rxstatus->rs_phyerr;
 	rx_stats->rs_rssi	= rxstatus->rs_rssi;
Signature · 1 line
1.9.1
#6 lore raw

PATCH 6/21 ath9k: remove all struct ath_softc dependencies from spectral code

In reply to Oleksij Rempel
---
 drivers/net/wireless/ath/ath9k/debug.c    |  4 +-
 drivers/net/wireless/ath/ath9k/recv.c     |  2 +-
 drivers/net/wireless/ath/ath9k/spectral.c | 87 ++++++++++++++++---------------
 drivers/net/wireless/ath/ath9k/spectral.h |  8 +--
 4 files changed, 51 insertions(+), 50 deletions(-)
drivers/net/wireless/ath/ath9k/debug.c +2 -2
index f0a802e..6492619 100644
@@ -1310,7 +1310,7 @@ void ath9k_get_et_stats(struct ieee80211_hw *hw,
 
 void ath9k_deinit_debug(struct ath_softc *sc)
 {
-	ath9k_spectral_deinit_debug(sc);
+	ath9k_spectral_deinit_debug(&sc->spec_priv);
 }
 
 int ath9k_init_debug(struct ath_hw *ah)
@@ -1330,7 +1330,7 @@ int ath9k_init_debug(struct ath_hw *ah)
 
 	ath9k_dfs_init_debug(sc);
 	ath9k_tx99_init_debug(sc);
-	ath9k_spectral_init_debug(sc, sc->debug.debugfs_phy);
+	ath9k_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy);
 
 	debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, sc,
 			    &fops_dma);
drivers/net/wireless/ath/ath9k/recv.c +1 -1
index 6914e21..e97c693 100644
@@ -870,7 +870,7 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc,
 	 */
 	if (rx_stats->rs_status & ATH9K_RXERR_PHY) {
 		ath9k_dfs_process_phyerr(sc, hdr, rx_stats, rx_status->mactime);
-		if (ath_process_fft(sc, hdr, rx_stats, rx_status->mactime))
+		if (ath_process_fft(&sc->spec_priv, hdr, rx_stats, rx_status->mactime))
 			RX_STAT_INC(rx_spectral);
 
 		return -EINVAL;
drivers/net/wireless/ath/ath9k/spectral.c +44 -43

256 lines not on this page · raw message

drivers/net/wireless/ath/ath9k/spectral.h +4 -4
index 638320d..555fcbb 100644
@@ -130,18 +130,18 @@ static inline u8 spectral_bitmap_weight(u8 *bins)
 	return bins[0] & 0x3f;
 }
 
-void ath9k_spectral_init_debug(struct ath_softc *sc, struct dentry *debugfs_phy);
-void ath9k_spectral_deinit_debug(struct ath_softc *sc);
+void ath9k_spectral_init_debug(struct ath_spec_scan_priv *spec_priv, struct dentry *debugfs_phy);
+void ath9k_spectral_deinit_debug(struct ath_spec_scan_priv *spec_priv);
 
 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,
+int ath_process_fft(struct ath_spec_scan_priv *spec_priv, struct ieee80211_hdr *hdr,
 		    struct ath_rx_status *rs, u64 tsf);
 #else
-static inline int ath_process_fft(struct ath_softc *sc,
+static inline int ath_process_fft(struct ath_spec_scan_priv *spec_priv,
 				  struct ieee80211_hdr *hdr,
 				  struct ath_rx_status *rs, u64 tsf)
 {
Signature · 1 line
1.9.1
#11 lore raw

PATCH 11/21 ath9k: make ath9k_spectral_scan_ do not depend on ath_softc

In reply to Oleksij Rempel

last preparation before moving ath9k_spectral_scan_ to spectral.c

---
 drivers/net/wireless/ath/ath9k/channel.c  |  2 +-
 drivers/net/wireless/ath/ath9k/main.c     | 26 +++++++++++++-------------
 drivers/net/wireless/ath/ath9k/spectral.c | 10 +++++-----
 drivers/net/wireless/ath/ath9k/spectral.h |  4 +++-
 4 files changed, 22 insertions(+), 20 deletions(-)
drivers/net/wireless/ath/ath9k/channel.c +1 -1
index 814178a..32ce931 100644
@@ -93,7 +93,7 @@ static int ath_set_channel(struct ath_softc *sc)
 		/* perform spectral scan if requested. */
 		if (test_bit(ATH_OP_SCANNING, &common->op_flags) &&
 			sc->spec_priv.spectral_mode == SPECTRAL_CHANSCAN)
-			ath9k_spectral_scan_trigger(common);
+			ath9k_spectral_scan_trigger(common, &sc->spec_priv);
 	}
 
 	return 0;
drivers/net/wireless/ath/ath9k/main.c +13 -13
index 6edd4d3..ec1ebf9 100644
@@ -1339,10 +1339,10 @@ static void ath9k_disable_ps(struct ath_softc *sc)
 	ath_dbg(common, PS, "PowerSave disabled\n");
 }
 
-void ath9k_spectral_scan_trigger(struct ath_common *common)
+void ath9k_spectral_scan_trigger(struct ath_common *common,
+				 struct ath_spec_scan_priv *spec_priv)
 {
-	struct ath_softc *sc = common->priv;
-	struct ath_hw *ah = sc->sc_ah;
+	struct ath_hw *ah = spec_priv->ah;
 	u32 rxfilter;
 
 	if (config_enabled(CONFIG_ATH9K_TX99))
@@ -1364,16 +1364,16 @@ void ath9k_spectral_scan_trigger(struct ath_common *common)
 	 * configuration, otherwise the register will have its values reset
 	 * (on my ar9220 to value 0x01002310)
 	 */
-	ath9k_spectral_scan_config(common, sc->spec_priv.spectral_mode);
+	ath9k_spectral_scan_config(common, spec_priv, spec_priv->spectral_mode);
 	ath9k_hw_ops(ah)->spectral_scan_trigger(ah);
 	ath_ps_ops(common)->restore(common);
 }
 
 int ath9k_spectral_scan_config(struct ath_common *common,
+			       struct ath_spec_scan_priv *spec_priv,
 			       enum spectral_mode spectral_mode)
 {
-	struct ath_softc *sc = common->priv;
-	struct ath_hw *ah = sc->sc_ah;
+	struct ath_hw *ah = spec_priv->ah;
 
 	if (!ath9k_hw_ops(ah)->spectral_scan_trigger) {
 		ath_err(common, "spectrum analyzer not implemented on this hardware\n");
@@ -1382,29 +1382,29 @@ int ath9k_spectral_scan_config(struct ath_common *common,
 
 	switch (spectral_mode) {
 	case SPECTRAL_DISABLED:
-		sc->spec_priv.spec_config.enabled = 0;
+		spec_priv->spec_config.enabled = 0;
 		break;
 	case SPECTRAL_BACKGROUND:
 		/* send endless samples.
 		 * TODO: is this really useful for "background"?
 		 */
-		sc->spec_priv.spec_config.endless = 1;
-		sc->spec_priv.spec_config.enabled = 1;
+		spec_priv->spec_config.endless = 1;
+		spec_priv->spec_config.enabled = 1;
 		break;
 	case SPECTRAL_CHANSCAN:
 	case SPECTRAL_MANUAL:
-		sc->spec_priv.spec_config.endless = 0;
-		sc->spec_priv.spec_config.enabled = 1;
+		spec_priv->spec_config.endless = 0;
+		spec_priv->spec_config.enabled = 1;
 		break;
 	default:
 		return -1;
 	}
 
 	ath_ps_ops(common)->wakeup(common);
-	ath9k_hw_ops(ah)->spectral_scan_config(ah, &sc->spec_priv.spec_config);
+	ath9k_hw_ops(ah)->spectral_scan_config(ah, &spec_priv->spec_config);
 	ath_ps_ops(common)->restore(common);
 
-	sc->spec_priv.spectral_mode = spectral_mode;
+	spec_priv->spectral_mode = spectral_mode;
 
 	return 0;
 }
drivers/net/wireless/ath/ath9k/spectral.c +5 -5
index 4549dce..756d63e 100644
@@ -253,18 +253,18 @@ static ssize_t write_file_spec_scan_ctl(struct file *file,
 	buf[len] = '\0';
 
 	if (strncmp("trigger", buf, 7) == 0) {
-		ath9k_spectral_scan_trigger(common);
+		ath9k_spectral_scan_trigger(common, spec_priv);
 	} else if (strncmp("background", buf, 10) == 0) {
-		ath9k_spectral_scan_config(common, SPECTRAL_BACKGROUND);
+		ath9k_spectral_scan_config(common, spec_priv, SPECTRAL_BACKGROUND);
 		ath_dbg(common, CONFIG, "spectral scan: background mode enabled\n");
 	} else if (strncmp("chanscan", buf, 8) == 0) {
-		ath9k_spectral_scan_config(common, SPECTRAL_CHANSCAN);
+		ath9k_spectral_scan_config(common, spec_priv, SPECTRAL_CHANSCAN);
 		ath_dbg(common, CONFIG, "spectral scan: channel scan mode enabled\n");
 	} else if (strncmp("manual", buf, 6) == 0) {
-		ath9k_spectral_scan_config(common, SPECTRAL_MANUAL);
+		ath9k_spectral_scan_config(common, spec_priv, SPECTRAL_MANUAL);
 		ath_dbg(common, CONFIG, "spectral scan: manual mode enabled\n");
 	} else if (strncmp("disable", buf, 7) == 0) {
-		ath9k_spectral_scan_config(common, SPECTRAL_DISABLED);
+		ath9k_spectral_scan_config(common, spec_priv, SPECTRAL_DISABLED);
 		ath_dbg(common, CONFIG, "spectral scan: disabled\n");
 	} else {
 		return -EINVAL;
drivers/net/wireless/ath/ath9k/spectral.h +3 -1
index 53660e6..77582cf 100644
@@ -133,8 +133,10 @@ static inline u8 spectral_bitmap_weight(u8 *bins)
 void ath9k_spectral_init_debug(struct ath_spec_scan_priv *spec_priv, struct dentry *debugfs_phy);
 void ath9k_spectral_deinit_debug(struct ath_spec_scan_priv *spec_priv);
 
-void ath9k_spectral_scan_trigger(struct ath_common *common);
+void ath9k_spectral_scan_trigger(struct ath_common *common,
+				 struct ath_spec_scan_priv *spec_priv);
 int ath9k_spectral_scan_config(struct ath_common *common,
+			       struct ath_spec_scan_priv *spec_priv,
 			       enum spectral_mode spectral_mode);
 
 #ifdef CONFIG_ATH9K_DEBUGFS
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/21 ath9k: move spec_config to ath_spec_scan_priv

In reply to Oleksij Rempel
---
 drivers/net/wireless/ath/ath9k/ath9k.h    |  3 +--
 drivers/net/wireless/ath/ath9k/init.c     | 12 ++++++------
 drivers/net/wireless/ath/ath9k/main.c     | 12 ++++++------
 drivers/net/wireless/ath/ath9k/spectral.c | 16 ++++++++--------
 drivers/net/wireless/ath/ath9k/spectral.h |  2 ++
 5 files changed, 23 insertions(+), 22 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -2
index b80e789..a0fa3e6 100644
@@ -1028,8 +1028,7 @@ struct ath_softc {
 	struct dfs_pattern_detector *dfs_detector;
 	u64 dfs_prev_pulse_ts;
 	u32 wow_enabled;
-	/* relay(fs) channel for spectral scan */
-	struct ath_spec_scan spec_config;
+
 	struct ath_spec_scan_priv spec_priv;
 
 	struct ieee80211_vif *tx99_vif;
drivers/net/wireless/ath/ath9k/init.c +6 -6
index a4d69a0..34687f4 100644
@@ -348,12 +348,12 @@ static void ath9k_init_misc(struct ath_softc *sc)
 	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB)
 		sc->ant_comb.count = ATH_ANT_DIV_COMB_INIT_COUNT;
 
-	sc->spec_config.enabled = 0;
-	sc->spec_config.short_repeat = true;
-	sc->spec_config.count = 8;
-	sc->spec_config.endless = false;
-	sc->spec_config.period = 0xFF;
-	sc->spec_config.fft_period = 0xF;
+	sc->spec_priv.spec_config.enabled = 0;
+	sc->spec_priv.spec_config.short_repeat = true;
+	sc->spec_priv.spec_config.count = 8;
+	sc->spec_priv.spec_config.endless = false;
+	sc->spec_priv.spec_config.period = 0xFF;
+	sc->spec_priv.spec_config.fft_period = 0xF;
 }
 
 static void ath9k_init_pcoem_platform(struct ath_softc *sc)
drivers/net/wireless/ath/ath9k/main.c +6 -6
index cf7a215..83a1d13 100644
@@ -1384,26 +1384,26 @@ int ath9k_spectral_scan_config(struct ieee80211_hw *hw,
 
 	switch (spectral_mode) {
 	case SPECTRAL_DISABLED:
-		sc->spec_config.enabled = 0;
+		sc->spec_priv.spec_config.enabled = 0;
 		break;
 	case SPECTRAL_BACKGROUND:
 		/* send endless samples.
 		 * TODO: is this really useful for "background"?
 		 */
-		sc->spec_config.endless = 1;
-		sc->spec_config.enabled = 1;
+		sc->spec_priv.spec_config.endless = 1;
+		sc->spec_priv.spec_config.enabled = 1;
 		break;
 	case SPECTRAL_CHANSCAN:
 	case SPECTRAL_MANUAL:
-		sc->spec_config.endless = 0;
-		sc->spec_config.enabled = 1;
+		sc->spec_priv.spec_config.endless = 0;
+		sc->spec_priv.spec_config.enabled = 1;
 		break;
 	default:
 		return -1;
 	}
 
 	ath9k_ps_wakeup(sc);
-	ath9k_hw_ops(ah)->spectral_scan_config(ah, &sc->spec_config);
+	ath9k_hw_ops(ah)->spectral_scan_config(ah, &sc->spec_priv.spec_config);
 	ath9k_ps_restore(sc);
 
 	sc->spec_priv.spectral_mode = spectral_mode;
drivers/net/wireless/ath/ath9k/spectral.c +8 -8
index 3a394e1..555fc2a 100644
@@ -292,7 +292,7 @@ static ssize_t read_file_spectral_short_repeat(struct file *file,
 	char buf[32];
 	unsigned int len;
 
-	len = sprintf(buf, "%d\n", sc->spec_config.short_repeat);
+	len = sprintf(buf, "%d\n", sc->spec_priv.spec_config.short_repeat);
 	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
 }
 
@@ -316,7 +316,7 @@ static ssize_t write_file_spectral_short_repeat(struct file *file,
 	if (val > 1)
 		return -EINVAL;
 
-	sc->spec_config.short_repeat = val;
+	sc->spec_priv.spec_config.short_repeat = val;
 	return count;
 }
 
@@ -340,7 +340,7 @@ static ssize_t read_file_spectral_count(struct file *file,
 	char buf[32];
 	unsigned int len;
 
-	len = sprintf(buf, "%d\n", sc->spec_config.count);
+	len = sprintf(buf, "%d\n", sc->spec_priv.spec_config.count);
 	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
 }
 
@@ -364,7 +364,7 @@ static ssize_t write_file_spectral_count(struct file *file,
 	if (val > 255)
 		return -EINVAL;
 
-	sc->spec_config.count = val;
+	sc->spec_priv.spec_config.count = val;
 	return count;
 }
 
@@ -388,7 +388,7 @@ static ssize_t read_file_spectral_period(struct file *file,
 	char buf[32];
 	unsigned int len;
 
-	len = sprintf(buf, "%d\n", sc->spec_config.period);
+	len = sprintf(buf, "%d\n", sc->spec_priv.spec_config.period);
 	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
 }
 
@@ -412,7 +412,7 @@ static ssize_t write_file_spectral_period(struct file *file,
 	if (val > 255)
 		return -EINVAL;
 
-	sc->spec_config.period = val;
+	sc->spec_priv.spec_config.period = val;
 	return count;
 }
 
@@ -436,7 +436,7 @@ static ssize_t read_file_spectral_fft_period(struct file *file,
 	char buf[32];
 	unsigned int len;
 
-	len = sprintf(buf, "%d\n", sc->spec_config.fft_period);
+	len = sprintf(buf, "%d\n", sc->spec_priv.spec_config.fft_period);
 	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
 }
 
@@ -460,7 +460,7 @@ static ssize_t write_file_spectral_fft_period(struct file *file,
 	if (val > 15)
 		return -EINVAL;
 
-	sc->spec_config.fft_period = val;
+	sc->spec_priv.spec_config.fft_period = val;
 	return count;
 }
 
drivers/net/wireless/ath/ath9k/spectral.h +2 -0
index 0acdc43..dfe6f68 100644
@@ -93,8 +93,10 @@ struct ath_ht20_40_fft_packet {
 } __packed;
 
 struct ath_spec_scan_priv {
+	/* relay(fs) channel for spectral scan */
 	struct rchan *rfs_chan_spec_scan;
 	enum spectral_mode spectral_mode;
+	struct ath_spec_scan spec_config;
 };
 
 #define SPECTRAL_HT20_40_TOTAL_DATA_LEN	(sizeof(struct ath_ht20_40_fft_packet))
Signature · 1 line
1.9.1
#5 lore raw

PATCH 5/21 ath9k: add ath_hw to ath_spec_scan_priv

In reply to Oleksij Rempel

spectral code mostly depends on ath_hw, not on ath_softc

---
 drivers/net/wireless/ath/ath9k/init.c     | 1 +
 drivers/net/wireless/ath/ath9k/spectral.h | 1 +
 2 files changed, 2 insertions(+)
drivers/net/wireless/ath/ath9k/init.c +1 -0
index 34687f4..fe811b3 100644
@@ -348,6 +348,7 @@ static void ath9k_init_misc(struct ath_softc *sc)
 	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_ANT_DIV_COMB)
 		sc->ant_comb.count = ATH_ANT_DIV_COMB_INIT_COUNT;
 
+	sc->spec_priv.ah = sc->sc_ah;
 	sc->spec_priv.spec_config.enabled = 0;
 	sc->spec_priv.spec_config.short_repeat = true;
 	sc->spec_priv.spec_config.count = 8;
drivers/net/wireless/ath/ath9k/spectral.h +1 -0
index 2269589..638320d 100644
@@ -93,6 +93,7 @@ struct ath_ht20_40_fft_packet {
 } __packed;
 
 struct ath_spec_scan_priv {
+	struct ath_hw *ah;
 	/* relay(fs) channel for spectral scan */
 	struct rchan *rfs_chan_spec_scan;
 	enum spectral_mode spectral_mode;
Signature · 1 line
1.9.1
#13 lore raw

PATCH 13/21 ath9k: move spectral.* to common-spectral.*

In reply to Oleksij Rempel

and rename exports from ath9k_spectral_* to ath9k_cmn_spectral_*

---
 drivers/net/wireless/ath/ath9k/Makefile          |   6 +-
 drivers/net/wireless/ath/ath9k/ath9k.h           |   1 -
 drivers/net/wireless/ath/ath9k/channel.c         |   2 +-
 drivers/net/wireless/ath/ath9k/common-spectral.c | 620 +++++++++++++++++++++++
 drivers/net/wireless/ath/ath9k/common-spectral.h | 154 ++++++
 drivers/net/wireless/ath/ath9k/common.h          |   1 +
 drivers/net/wireless/ath/ath9k/debug.c           |   4 +-
 drivers/net/wireless/ath/ath9k/recv.c            |   2 +-
 drivers/net/wireless/ath/ath9k/spectral.c        | 614 ----------------------
 drivers/net/wireless/ath/ath9k/spectral.h        | 154 ------
 10 files changed, 782 insertions(+), 776 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath9k/common-spectral.c
 create mode 100644 drivers/net/wireless/ath/ath9k/common-spectral.h
 delete mode 100644 drivers/net/wireless/ath/ath9k/spectral.c
 delete mode 100644 drivers/net/wireless/ath/ath9k/spectral.h
drivers/net/wireless/ath/ath9k/Makefile +3 -3
index 22b934b..4739722 100644
@@ -16,8 +16,7 @@ ath9k-$(CONFIG_ATH9K_DFS_CERTIFIED) += dfs.o
 ath9k-$(CONFIG_ATH9K_TX99) += tx99.o
 ath9k-$(CONFIG_ATH9K_WOW) += wow.o
 
-ath9k-$(CONFIG_ATH9K_DEBUGFS) += debug.o \
-				 spectral.o
+ath9k-$(CONFIG_ATH9K_DEBUGFS) += debug.o
 
 ath9k-$(CONFIG_ATH9K_STATION_STATISTICS) += debug_sta.o
 
@@ -59,7 +58,8 @@ obj-$(CONFIG_ATH9K_COMMON) += ath9k_common.o
 ath9k_common-y:=	common.o \
 			common-init.o \
 			common-beacon.o \
-			common-debug.o
+			common-debug.o \
+			common-spectral.o
 
 ath9k_htc-y +=	htc_hst.o \
 		hif_usb.o \
drivers/net/wireless/ath/ath9k/ath9k.h +0 -1
index a0fa3e6..0844980 100644
@@ -28,7 +28,6 @@
 #include "debug.h"
 #include "mci.h"
 #include "dfs.h"
-#include "spectral.h"
 
 struct ath_node;
 struct ath_vif;
drivers/net/wireless/ath/ath9k/channel.c +1 -1
index 32ce931..1dadf6d 100644
@@ -93,7 +93,7 @@ static int ath_set_channel(struct ath_softc *sc)
 		/* perform spectral scan if requested. */
 		if (test_bit(ATH_OP_SCANNING, &common->op_flags) &&
 			sc->spec_priv.spectral_mode == SPECTRAL_CHANSCAN)
-			ath9k_spectral_scan_trigger(common, &sc->spec_priv);
+			ath9k_cmn_spectral_scan_trigger(common, &sc->spec_priv);
 	}
 
 	return 0;
drivers/net/wireless/ath/ath9k/common-spectral.c new file +620 -0

620 lines not on this page · raw message

drivers/net/wireless/ath/ath9k/common-spectral.h new file +154 -0

154 lines not on this page · raw message

drivers/net/wireless/ath/ath9k/common.h +1 -0
index ffc454b..2b79a56 100644
@@ -24,6 +24,7 @@
 #include "common-init.h"
 #include "common-beacon.h"
 #include "common-debug.h"
+#include "common-spectral.h"
 
 /* Common header for Atheros 802.11n base driver cores */
 
drivers/net/wireless/ath/ath9k/debug.c +2 -2
index 6492619..db38840 100644
@@ -1310,7 +1310,7 @@ void ath9k_get_et_stats(struct ieee80211_hw *hw,
 
 void ath9k_deinit_debug(struct ath_softc *sc)
 {
-	ath9k_spectral_deinit_debug(&sc->spec_priv);
+	ath9k_cmn_spectral_deinit_debug(&sc->spec_priv);
 }
 
 int ath9k_init_debug(struct ath_hw *ah)
@@ -1330,7 +1330,7 @@ int ath9k_init_debug(struct ath_hw *ah)
 
 	ath9k_dfs_init_debug(sc);
 	ath9k_tx99_init_debug(sc);
-	ath9k_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy);
+	ath9k_cmn_spectral_init_debug(&sc->spec_priv, sc->debug.debugfs_phy);
 
 	debugfs_create_file("dma", S_IRUSR, sc->debug.debugfs_phy, sc,
 			    &fops_dma);
drivers/net/wireless/ath/ath9k/recv.c +1 -1
index e97c693..7395afb 100644
@@ -870,7 +870,7 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc,
 	 */
 	if (rx_stats->rs_status & ATH9K_RXERR_PHY) {
 		ath9k_dfs_process_phyerr(sc, hdr, rx_stats, rx_status->mactime);
-		if (ath_process_fft(&sc->spec_priv, hdr, rx_stats, rx_status->mactime))
+		if (ath_cmn_process_fft(&sc->spec_priv, hdr, rx_stats, rx_status->mactime))
 			RX_STAT_INC(rx_spectral);
 
 		return -EINVAL;
drivers/net/wireless/ath/ath9k/spectral.c deleted +0 -614

614 lines not on this page · raw message

drivers/net/wireless/ath/ath9k/spectral.h deleted +0 -154

154 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/21 ath9k: add struct ath_spec_scan_priv

In reply to Oleksij Rempel

and move rfs_chan_spec_scan to this struct. We will need it for common spectral scan code.

---
 drivers/net/wireless/ath/ath9k/ath9k.h    |  2 +-
 drivers/net/wireless/ath/ath9k/spectral.c | 12 ++++++------
 drivers/net/wireless/ath/ath9k/spectral.h |  3 +++
 3 files changed, 10 insertions(+), 7 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -1
index 85d74ff..65feda3 100644
@@ -1029,9 +1029,9 @@ struct ath_softc {
 	u64 dfs_prev_pulse_ts;
 	u32 wow_enabled;
 	/* relay(fs) channel for spectral scan */
-	struct rchan *rfs_chan_spec_scan;
 	enum spectral_mode spectral_mode;
 	struct ath_spec_scan spec_config;
+	struct ath_spec_scan_priv spec_priv;
 
 	struct ieee80211_vif *tx99_vif;
 	struct sk_buff *tx99_skb;
drivers/net/wireless/ath/ath9k/spectral.c +6 -6
index 8f68426..348dddd 100644
@@ -28,12 +28,12 @@ static void ath_debug_send_fft_sample(struct ath_softc *sc,
 				      struct fft_sample_tlv *fft_sample_tlv)
 {
 	int length;
-	if (!sc->rfs_chan_spec_scan)
+	if (!sc->spec_priv.rfs_chan_spec_scan)
 		return;
 
 	length = __be16_to_cpu(fft_sample_tlv->length) +
 		 sizeof(*fft_sample_tlv);
-	relay_write(sc->rfs_chan_spec_scan, fft_sample_tlv, length);
+	relay_write(sc->spec_priv.rfs_chan_spec_scan, fft_sample_tlv, length);
 }
 
 /* returns 1 if this was a spectral frame, even if not handled. */
@@ -508,15 +508,15 @@ static struct rchan_callbacks rfs_spec_scan_cb = {
 
 void ath9k_spectral_deinit_debug(struct ath_softc *sc)
 {
-	if (config_enabled(CONFIG_ATH9K_DEBUGFS) && sc->rfs_chan_spec_scan) {
-		relay_close(sc->rfs_chan_spec_scan);
-		sc->rfs_chan_spec_scan = NULL;
+	if (config_enabled(CONFIG_ATH9K_DEBUGFS) && sc->spec_priv.rfs_chan_spec_scan) {
+		relay_close(sc->spec_priv.rfs_chan_spec_scan);
+		sc->spec_priv.rfs_chan_spec_scan = NULL;
 	}
 }
 
 void ath9k_spectral_init_debug(struct ath_softc *sc)
 {
-	sc->rfs_chan_spec_scan = relay_open("spectral_scan",
+	sc->spec_priv.rfs_chan_spec_scan = relay_open("spectral_scan",
 					    sc->debug.debugfs_phy,
 					    1024, 256, &rfs_spec_scan_cb,
 					    NULL);
drivers/net/wireless/ath/ath9k/spectral.h +3 -0
index 7b410c6..533d8a1 100644
@@ -92,6 +92,9 @@ struct ath_ht20_40_fft_packet {
 	struct ath_radar_info radar_info;
 } __packed;
 
+struct ath_spec_scan_priv {
+	struct rchan *rfs_chan_spec_scan;
+};
 
 #define SPECTRAL_HT20_40_TOTAL_DATA_LEN	(sizeof(struct ath_ht20_40_fft_packet))
 
Signature · 1 line
1.9.1
#10 lore raw

PATCH 10/21 ath9k: use ath_common instead of ieee80211_hw in ath9k_spectral_scan_

In reply to Oleksij Rempel

we don't have here any ieee80211_hw dependencies any way.

---
 drivers/net/wireless/ath/ath9k/channel.c  |  2 +-
 drivers/net/wireless/ath/ath9k/main.c     | 12 +++++-------
 drivers/net/wireless/ath/ath9k/spectral.c | 10 +++++-----
 drivers/net/wireless/ath/ath9k/spectral.h |  4 ++--
 4 files changed, 13 insertions(+), 15 deletions(-)
drivers/net/wireless/ath/ath9k/channel.c +1 -1
index 25a21fa..814178a 100644
@@ -93,7 +93,7 @@ static int ath_set_channel(struct ath_softc *sc)
 		/* perform spectral scan if requested. */
 		if (test_bit(ATH_OP_SCANNING, &common->op_flags) &&
 			sc->spec_priv.spectral_mode == SPECTRAL_CHANSCAN)
-			ath9k_spectral_scan_trigger(hw);
+			ath9k_spectral_scan_trigger(common);
 	}
 
 	return 0;
drivers/net/wireless/ath/ath9k/main.c +5 -7
index 747dd5a..6edd4d3 100644
@@ -1339,11 +1339,10 @@ static void ath9k_disable_ps(struct ath_softc *sc)
 	ath_dbg(common, PS, "PowerSave disabled\n");
 }
 
-void ath9k_spectral_scan_trigger(struct ieee80211_hw *hw)
+void ath9k_spectral_scan_trigger(struct ath_common *common)
 {
-	struct ath_softc *sc = hw->priv;
+	struct ath_softc *sc = common->priv;
 	struct ath_hw *ah = sc->sc_ah;
-	struct ath_common *common = ath9k_hw_common(ah);
 	u32 rxfilter;
 
 	if (config_enabled(CONFIG_ATH9K_TX99))
@@ -1365,17 +1364,16 @@ void ath9k_spectral_scan_trigger(struct ieee80211_hw *hw)
 	 * configuration, otherwise the register will have its values reset
 	 * (on my ar9220 to value 0x01002310)
 	 */
-	ath9k_spectral_scan_config(hw, sc->spec_priv.spectral_mode);
+	ath9k_spectral_scan_config(common, sc->spec_priv.spectral_mode);
 	ath9k_hw_ops(ah)->spectral_scan_trigger(ah);
 	ath_ps_ops(common)->restore(common);
 }
 
-int ath9k_spectral_scan_config(struct ieee80211_hw *hw,
+int ath9k_spectral_scan_config(struct ath_common *common,
 			       enum spectral_mode spectral_mode)
 {
-	struct ath_softc *sc = hw->priv;
+	struct ath_softc *sc = common->priv;
 	struct ath_hw *ah = sc->sc_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");
drivers/net/wireless/ath/ath9k/spectral.c +5 -5
index 50af6bc..4549dce 100644
@@ -253,18 +253,18 @@ static ssize_t write_file_spec_scan_ctl(struct file *file,
 	buf[len] = '\0';
 
 	if (strncmp("trigger", buf, 7) == 0) {
-		ath9k_spectral_scan_trigger(common->hw);
+		ath9k_spectral_scan_trigger(common);
 	} else if (strncmp("background", buf, 10) == 0) {
-		ath9k_spectral_scan_config(common->hw, SPECTRAL_BACKGROUND);
+		ath9k_spectral_scan_config(common, SPECTRAL_BACKGROUND);
 		ath_dbg(common, CONFIG, "spectral scan: background mode enabled\n");
 	} else if (strncmp("chanscan", buf, 8) == 0) {
-		ath9k_spectral_scan_config(common->hw, SPECTRAL_CHANSCAN);
+		ath9k_spectral_scan_config(common, SPECTRAL_CHANSCAN);
 		ath_dbg(common, CONFIG, "spectral scan: channel scan mode enabled\n");
 	} else if (strncmp("manual", buf, 6) == 0) {
-		ath9k_spectral_scan_config(common->hw, SPECTRAL_MANUAL);
+		ath9k_spectral_scan_config(common, SPECTRAL_MANUAL);
 		ath_dbg(common, CONFIG, "spectral scan: manual mode enabled\n");
 	} else if (strncmp("disable", buf, 7) == 0) {
-		ath9k_spectral_scan_config(common->hw, SPECTRAL_DISABLED);
+		ath9k_spectral_scan_config(common, SPECTRAL_DISABLED);
 		ath_dbg(common, CONFIG, "spectral scan: disabled\n");
 	} else {
 		return -EINVAL;
drivers/net/wireless/ath/ath9k/spectral.h +2 -2
index 555fcbb..53660e6 100644
@@ -133,8 +133,8 @@ static inline u8 spectral_bitmap_weight(u8 *bins)
 void ath9k_spectral_init_debug(struct ath_spec_scan_priv *spec_priv, struct dentry *debugfs_phy);
 void ath9k_spectral_deinit_debug(struct ath_spec_scan_priv *spec_priv);
 
-void ath9k_spectral_scan_trigger(struct ieee80211_hw *hw);
-int ath9k_spectral_scan_config(struct ieee80211_hw *hw,
+void ath9k_spectral_scan_trigger(struct ath_common *common);
+int ath9k_spectral_scan_config(struct ath_common *common,
 			       enum spectral_mode spectral_mode);
 
 #ifdef CONFIG_ATH9K_DEBUGFS
Signature · 1 line
1.9.1
#9 lore raw

PATCH 9/21 ath9k: use ath_ps_ops in ath9k_spectral_scan_

In reply to Oleksij Rempel
---
 drivers/net/wireless/ath/ath9k/main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +4 -4
index 83a1d13..747dd5a 100644
@@ -1354,7 +1354,7 @@ void ath9k_spectral_scan_trigger(struct ieee80211_hw *hw)
 		return;
 	}
 
-	ath9k_ps_wakeup(sc);
+	ath_ps_ops(common)->wakeup(common);
 	rxfilter = ath9k_hw_getrxfilter(ah);
 	ath9k_hw_setrxfilter(ah, rxfilter |
 				 ATH9K_RX_FILTER_PHYRADAR |
@@ -1367,7 +1367,7 @@ void ath9k_spectral_scan_trigger(struct ieee80211_hw *hw)
 	 */
 	ath9k_spectral_scan_config(hw, sc->spec_priv.spectral_mode);
 	ath9k_hw_ops(ah)->spectral_scan_trigger(ah);
-	ath9k_ps_restore(sc);
+	ath_ps_ops(common)->restore(common);
 }
 
 int ath9k_spectral_scan_config(struct ieee80211_hw *hw,
@@ -1402,9 +1402,9 @@ int ath9k_spectral_scan_config(struct ieee80211_hw *hw,
 		return -1;
 	}
 
-	ath9k_ps_wakeup(sc);
+	ath_ps_ops(common)->wakeup(common);
 	ath9k_hw_ops(ah)->spectral_scan_config(ah, &sc->spec_priv.spec_config);
-	ath9k_ps_restore(sc);
+	ath_ps_ops(common)->restore(common);
 
 	sc->spec_priv.spectral_mode = spectral_mode;
 
Signature · 1 line
1.9.1
#23 lore raw
In reply to Oleksij Rempel
Quoted 2 lines · Oleksij Rempel

- makes spectral scan code common for both ath9k and ath9k_htc.
- add spectral scan support to ath9k_htc.

This has been merged, but I am getting a build error.

../drivers/net/wireless/ath/ath9k/common-spectral.c:40:5: error: redefinition of ‘ath_cmn_process_fft’
int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv, struct ieee80211_hdr *hdr,

     ^
In file included from ../drivers/net/wireless/ath/ath9k/common.h:27:0,
                 from ../drivers/net/wireless/ath/ath9k/ath9k.h:27,
                 from ../drivers/net/wireless/ath/ath9k/common-spectral.c:18:
../drivers/net/wireless/ath/ath9k/common-spectral.h:146:19: note: previous definition of ‘ath_cmn_process_fft’ was here
 static inline int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv,
                   ^

../scripts/Makefile.build:257: recipe for target 'drivers/net/wireless/ath/ath9k/common-spectral.o' failed make[10]: *** [drivers/net/wireless/ath/ath9k/common-spectral.o] Error 1
make[10]: *** Waiting for unfinished jobs....
CC [M] drivers/target/iscsi/iscsi_target_erl0.o
CC drivers/thermal/thermal_core.o
In file included from ../drivers/net/wireless/ath/ath9k/htc_hst.c:19:0:
../drivers/net/wireless/ath/ath9k/htc.h: In function ‘ath9k_htc_deinit_debug’:
../drivers/net/wireless/ath/ath9k/htc.h:632:74: warning: ‘return’ with a value, in function returning void

 static inline void ath9k_htc_deinit_debug(struct ath9k_htc_priv *priv) { return 0; };
                                                                          ^

../scripts/Makefile.build:402: recipe for target 'drivers/net/wireless/ath/ath9k' failed make[9]: *** [drivers/net/wireless/ath/ath9k] Error 2 ../scripts/Makefile.build:402: recipe for target 'drivers/net/wireless/ath' failed make[8]: *** [drivers/net/wireless/ath] Error 2
make[8]: *** Waiting for unfinished jobs....

Sujith

#24 lore raw

Am 12.11.2014 um 01:10 schrieb Sujith Manoharan:

Quoted 23 lines
Quoted 2 lines · Oleksij Rempel

- makes spectral scan code common for both ath9k and ath9k_htc.
- add spectral scan support to ath9k_htc.

This has been merged, but I am getting a build error.

../drivers/net/wireless/ath/ath9k/common-spectral.c:40:5: error: redefinition of ‘ath_cmn_process_fft’
int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv, struct ieee80211_hdr *hdr,

     ^
In file included from ../drivers/net/wireless/ath/ath9k/common.h:27:0,
                 from ../drivers/net/wireless/ath/ath9k/ath9k.h:27,
                 from ../drivers/net/wireless/ath/ath9k/common-spectral.c:18:
../drivers/net/wireless/ath/ath9k/common-spectral.h:146:19: note: previous definition of ‘ath_cmn_process_fft’ was here
 static inline int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv,
                   ^

../scripts/Makefile.build:257: recipe for target 'drivers/net/wireless/ath/ath9k/common-spectral.o' failed make[10]: *** [drivers/net/wireless/ath/ath9k/common-spectral.o] Error 1
make[10]: *** Waiting for unfinished jobs....
CC [M] drivers/target/iscsi/iscsi_target_erl0.o
CC drivers/thermal/thermal_core.o
In file included from ../drivers/net/wireless/ath/ath9k/htc_hst.c:19:0:
../drivers/net/wireless/ath/ath9k/htc.h: In function ‘ath9k_htc_deinit_debug’:
../drivers/net/wireless/ath/ath9k/htc.h:632:74: warning: ‘return’ with a value, in function returning void

Quoted 7 lines
 static inline void ath9k_htc_deinit_debug(struct ath9k_htc_priv *priv) { return 0; };
                                                                          ^

../scripts/Makefile.build:402: recipe for target 'drivers/net/wireless/ath/ath9k' failed make[9]: *** [drivers/net/wireless/ath/ath9k] Error 2 ../scripts/Makefile.build:402: recipe for target 'drivers/net/wireless/ath' failed make[8]: *** [drivers/net/wireless/ath] Error 2
make[8]: *** Waiting for unfinished jobs....

Hi,

thank you for testing.
John already provided patch for this.

Signature · 2 lines
Regards,
Oleksij