Skip to contentSkip to conversation

ath9k patches

PATCH Superseded Sujith Manoharan 1 participant 9 messages Aug 22, 2014

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover ath9k patches

From: Sujith Manoharan <[email protected]>

Pending patches for ath9k, rebased over 3.17-rc1.

Sujith

Sujith Manoharan (8):
ath9k: Add a debug level for channel context
ath9k: Handle failure to allocate HW timer
ath9k: Move channel operations to channel.c
ath9k: Add debug information
ath9k: Add a config option for channel context
ath9k: Move P2P functions to channel.c
ath9k: Isolate P2P powersave routines
ath9k: Isolate ath9k_use_chanctx module parameter

 drivers/net/wireless/ath/ath.h           |   1 +
 drivers/net/wireless/ath/ath9k/Kconfig   |   9 +
 drivers/net/wireless/ath/ath9k/ath9k.h   |  50 +++-
 drivers/net/wireless/ath/ath9k/channel.c | 412 ++++++++++++++++++++++++++++++-
 drivers/net/wireless/ath/ath9k/init.c    |  70 +++---
 drivers/net/wireless/ath/ath9k/main.c    | 392 ++++++-----------------------
 drivers/net/wireless/ath/ath9k/recv.c    |   6 +-
 7 files changed, 586 insertions(+), 354 deletions(-)
Signature · 1 line
2.0.4
#1 lore raw

PATCH v2 1/8 ath9k: Add a debug level for channel context

From: Sujith Manoharan <[email protected]>

---
 drivers/net/wireless/ath/ath.h        | 1 +
 drivers/net/wireless/ath/ath9k/init.c | 2 ++
 2 files changed, 3 insertions(+)
drivers/net/wireless/ath/ath.h +1 -0
index fd9e530..c1a4ade 100644
@@ -261,6 +261,7 @@ enum ATH_DEBUG {
 	ATH_DBG_MCI		= 0x00008000,
 	ATH_DBG_DFS		= 0x00010000,
 	ATH_DBG_WOW		= 0x00020000,
+	ATH_DBG_CHAN_CTX	= 0x00040000,
 	ATH_DBG_ANY		= 0xffffffff
 };
 
drivers/net/wireless/ath/ath9k/init.c +2 -0
index 39419ea..76771f3 100644
@@ -778,6 +778,8 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
 			hw->chanctx_data_size = sizeof(void *);
 			hw->extra_beacon_tailroom =
 				sizeof(struct ieee80211_p2p_noa_attr) + 9;
+
+			ath_dbg(common, CHAN_CTX, "Use channel contexts\n");
 		}
 	}
 
Signature · 1 line
2.0.4
#2 lore raw

PATCH v2 2/8 ath9k: Handle failure to allocate HW timer

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

---
 drivers/net/wireless/ath/ath9k/init.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/init.c +3 -1
index 76771f3..4219e7b 100644
@@ -601,7 +601,9 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
 		goto err_btcoex;
 
 	sc->p2p_ps_timer = ath_gen_timer_alloc(sc->sc_ah, ath9k_p2p_ps_timer,
-		NULL, sc, AR_FIRST_NDP_TIMER);
+					       NULL, sc, AR_FIRST_NDP_TIMER);
+	if (!sc->p2p_ps_timer)
+		goto err_btcoex;
 
 	ath9k_cmn_init_crypto(sc->sc_ah);
 	ath9k_init_misc(sc);
Signature · 1 line
2.0.4
#3 lore raw

PATCH v2 3/8 ath9k: Move channel operations to channel.c

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

This reduces clutter in main.c

---
 drivers/net/wireless/ath/ath9k/ath9k.h   |   3 +
 drivers/net/wireless/ath/ath9k/channel.c | 202 +++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath9k/main.c    | 202 -------------------------------
 3 files changed, 205 insertions(+), 202 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +3 -0
index 7fc13a8..17b198e 100644
@@ -432,6 +432,9 @@ struct ath_chanctx *ath_chanctx_get_oper_chan(struct ath_softc *sc,
 void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif,
 		       enum ath_chanctx_event ev);
 void ath_chanctx_timer(unsigned long data);
+void ath_offchannel_next(struct ath_softc *sc);
+void ath_scan_complete(struct ath_softc *sc, bool abort);
+void ath_roc_complete(struct ath_softc *sc, bool abort);
 
 int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan);
 int ath_startrecv(struct ath_softc *sc);
drivers/net/wireless/ath/ath9k/channel.c +202 -0

205 lines not on this page · raw message

drivers/net/wireless/ath/ath9k/main.c +0 -202

208 lines not on this page · raw message

Signature · 1 line
2.0.4
#4 lore raw

PATCH v2 4/8 ath9k: Add debug information

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

Add a few statements to debug channel context operation.

---
 drivers/net/wireless/ath/ath9k/channel.c | 61 +++++++++++++++++++++++++-
 drivers/net/wireless/ath/ath9k/main.c    | 73 +++++++++++++++++++++++++++-----
 2 files changed, 122 insertions(+), 12 deletions(-)
drivers/net/wireless/ath/ath9k/channel.c +60 -1
index 0ce9e40..2f10b0c 100644
@@ -16,6 +16,23 @@
 
 #include "ath9k.h"
 
+static const char *offchannel_state_string(enum ath_offchannel_state state)
+{
+#define case_rtn_string(val) case val: return #val
+
+	switch (state) {
+		case_rtn_string(ATH_OFFCHANNEL_IDLE);
+		case_rtn_string(ATH_OFFCHANNEL_PROBE_SEND);
+		case_rtn_string(ATH_OFFCHANNEL_PROBE_WAIT);
+		case_rtn_string(ATH_OFFCHANNEL_SUSPEND);
+		case_rtn_string(ATH_OFFCHANNEL_ROC_START);
+		case_rtn_string(ATH_OFFCHANNEL_ROC_WAIT);
+		case_rtn_string(ATH_OFFCHANNEL_ROC_DONE);
+	default:
+		return "unknown";
+	}
+}
+
 /* Set/change channels.  If the channel is really being changed, it's done
  * by reseting the chip.  To accomplish this we must first cleanup any pending
  * DMA, then restart stuff.
@@ -373,13 +390,23 @@ void ath_chanctx_switch(struct ath_softc *sc, struct ath_chanctx *ctx,
 	}
 
 	sc->next_chan = ctx;
-	if (chandef)
+	if (chandef) {
 		ctx->chandef = *chandef;
+		ath_dbg(common, CHAN_CTX,
+			"Assigned next_chan to %d MHz\n", chandef->center_freq1);
+	}
 
 	if (sc->next_chan == &sc->offchannel.chan) {
 		sc->sched.offchannel_duration =
 			TU_TO_USEC(sc->offchannel.duration) +
 			sc->sched.channel_switch_time;
+
+		if (chandef) {
+			ath_dbg(common, CHAN_CTX,
+				"Offchannel duration for chan %d MHz : %u\n",
+				chandef->center_freq1,
+				sc->sched.offchannel_duration);
+		}
 	}
 	spin_unlock_bh(&sc->chan_lock);
 	ieee80211_queue_work(sc->hw, &sc->chanctx_work);
@@ -422,9 +449,12 @@ struct ath_chanctx *ath_chanctx_get_oper_chan(struct ath_softc *sc, bool active)
 void ath_chanctx_offchan_switch(struct ath_softc *sc,
 				struct ieee80211_channel *chan)
 {
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct cfg80211_chan_def chandef;
 
 	cfg80211_chandef_create(&chandef, chan, NL80211_CHAN_NO_HT);
+	ath_dbg(common, CHAN_CTX,
+		"Channel definition created: %d MHz\n", chandef.center_freq1);
 
 	ath_chanctx_switch(sc, &sc->offchannel.chan, &chandef);
 }
@@ -698,19 +728,30 @@ static int ath_scan_channel_duration(struct ath_softc *sc,
 static void
 ath_scan_next_channel(struct ath_softc *sc)
 {
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct cfg80211_scan_request *req = sc->offchannel.scan_req;
 	struct ieee80211_channel *chan;
 
 	if (sc->offchannel.scan_idx >= req->n_channels) {
+		ath_dbg(common, CHAN_CTX,
+			"Moving to ATH_OFFCHANNEL_IDLE state, scan_idx: %d, n_channels: %d\n",
+			sc->offchannel.scan_idx,
+			req->n_channels);
+
 		sc->offchannel.state = ATH_OFFCHANNEL_IDLE;
 		ath_chanctx_switch(sc, ath_chanctx_get_oper_chan(sc, false),
 				   NULL);
 		return;
 	}
 
+	ath_dbg(common, CHAN_CTX,
+		"Moving to ATH_OFFCHANNEL_PROBE_SEND state, scan_idx: %d\n",
+		sc->offchannel.scan_idx);
+
 	chan = req->channels[sc->offchannel.scan_idx++];
 	sc->offchannel.duration = ath_scan_channel_duration(sc, chan);
 	sc->offchannel.state = ATH_OFFCHANNEL_PROBE_SEND;
+
 	ath_chanctx_offchan_switch(sc, chan);
 }
 
@@ -751,6 +792,11 @@ void ath_scan_complete(struct ath_softc *sc, bool abort)
 {
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 
+	if (abort)
+		ath_dbg(common, CHAN_CTX, "HW scan aborted\n");
+	else
+		ath_dbg(common, CHAN_CTX, "HW scan complete\n");
+
 	sc->offchannel.scan_req = NULL;
 	sc->offchannel.scan_vif = NULL;
 	sc->offchannel.state = ATH_OFFCHANNEL_IDLE;
@@ -800,6 +846,7 @@ error:
 
 static void ath_scan_channel_start(struct ath_softc *sc)
 {
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct cfg80211_scan_request *req = sc->offchannel.scan_req;
 	int i;
 
@@ -810,12 +857,20 @@ static void ath_scan_channel_start(struct ath_softc *sc)
 
 	}
 
+	ath_dbg(common, CHAN_CTX,
+		"Moving to ATH_OFFCHANNEL_PROBE_WAIT state\n");
+
 	sc->offchannel.state = ATH_OFFCHANNEL_PROBE_WAIT;
 	mod_timer(&sc->offchannel.timer, jiffies + sc->offchannel.duration);
 }
 
 void ath_offchannel_channel_change(struct ath_softc *sc)
 {
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+
+	ath_dbg(common, CHAN_CTX, "%s: state: %s\n",
+		__func__, offchannel_state_string(sc->offchannel.state));
+
 	switch (sc->offchannel.state) {
 	case ATH_OFFCHANNEL_PROBE_SEND:
 		if (!sc->offchannel.scan_req)
@@ -854,6 +909,10 @@ void ath_offchannel_timer(unsigned long data)
 {
 	struct ath_softc *sc = (struct ath_softc *)data;
 	struct ath_chanctx *ctx;
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+
+	ath_dbg(common, CHAN_CTX, "%s: state: %s\n",
+		__func__, offchannel_state_string(sc->offchannel.state));
 
 	switch (sc->offchannel.state) {
 	case ATH_OFFCHANNEL_PROBE_WAIT:
drivers/net/wireless/ath/ath9k/main.c +62 -11

184 lines not on this page · raw message

Signature · 1 line
2.0.4
#5 lore raw

PATCH v2 5/8 ath9k: Add a config option for channel context

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

Channel contexts are supported only for P2P right now, so make sure that the 'normal' path remains unaffected by using a config option. This will also reduce the size of the driver.

---
 drivers/net/wireless/ath/ath9k/Kconfig | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/net/wireless/ath/ath9k/Kconfig +9 -0
index 8fcc029..b8f570e 100644
@@ -130,6 +130,15 @@ config ATH9K_RFKILL
 	  seconds. Turn off to save power, but enable it if you have
 	  a platform that can toggle the RF-Kill GPIO.
 
+config ATH9K_CHANNEL_CONTEXT
+       bool "Channel Context support"
+       depends on ATH9K
+       default n
+       ---help---
+         This option enables channel context support in ath9k, which is needed
+	 for multi-channel concurrency. Enable this if P2P PowerSave support
+	 is required.
+
 config ATH9K_HTC
        tristate "Atheros HTC based wireless cards support"
        depends on USB && MAC80211
Signature · 1 line
2.0.4
#6 lore raw

PATCH v2 6/8 ath9k: Move P2P functions to channel.c

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

---
 drivers/net/wireless/ath/ath9k/ath9k.h   |  1 +
 drivers/net/wireless/ath/ath9k/channel.c | 86 +++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath9k/main.c    | 87 --------------------------------
 3 files changed, 87 insertions(+), 87 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -0
index 17b198e..aea3979 100644
@@ -601,6 +601,7 @@ void ath_update_survey_nf(struct ath_softc *sc, int channel);
 void ath9k_queue_reset(struct ath_softc *sc, enum ath_reset_type type);
 void ath_ps_full_sleep(unsigned long data);
 void ath9k_p2p_ps_timer(void *priv);
+void ath9k_update_p2p_ps_timer(struct ath_softc *sc, struct ath_vif *avp);
 void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif);
 void __ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop);
 
drivers/net/wireless/ath/ath9k/channel.c +86 -0

89 lines not on this page · raw message

drivers/net/wireless/ath/ath9k/main.c +0 -87

99 lines not on this page · raw message

Signature · 1 line
2.0.4
#7 lore raw

PATCH v2 7/8 ath9k: Isolate P2P powersave routines

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

Use CONFIG_ATH9K_CHANNEL_CONTEXT to conditionally
compile P2P-PS code.

---
 drivers/net/wireless/ath/ath9k/ath9k.h   | 38 ++++++++++++++--
 drivers/net/wireless/ath/ath9k/channel.c | 78 ++++++++++++++++++++++++++++----
 drivers/net/wireless/ath/ath9k/init.c    |  9 ++--
 drivers/net/wireless/ath/ath9k/main.c    | 18 ++------
 drivers/net/wireless/ath/ath9k/recv.c    |  4 +-
 5 files changed, 111 insertions(+), 36 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +35 -3
index aea3979..642cc19 100644
@@ -436,6 +436,39 @@ void ath_offchannel_next(struct ath_softc *sc);
 void ath_scan_complete(struct ath_softc *sc, bool abort);
 void ath_roc_complete(struct ath_softc *sc, bool abort);
 
+#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
+int ath9k_init_p2p(struct ath_softc *sc);
+void ath9k_deinit_p2p(struct ath_softc *sc);
+void ath9k_p2p_remove_vif(struct ath_softc *sc,
+			  struct ieee80211_vif *vif);
+void ath9k_p2p_beacon_sync(struct ath_softc *sc);
+void ath9k_p2p_bss_info_changed(struct ath_softc *sc,
+				struct ieee80211_vif *vif);
+void ath9k_p2p_ps_timer(void *priv);
+#else
+static inline int ath9k_init_p2p(struct ath_softc *sc)
+{
+	return 0;
+}
+static inline void ath9k_deinit_p2p(struct ath_softc *sc)
+{
+}
+static inline void ath9k_p2p_remove_vif(struct ath_softc *sc,
+					struct ieee80211_vif *vif)
+{
+}
+static inline void ath9k_p2p_beacon_sync(struct ath_softc *sc)
+{
+}
+static inline void ath9k_p2p_bss_info_changed(struct ath_softc *sc,
+					      struct ieee80211_vif *vif)
+{
+}
+static inline void ath9k_p2p_ps_timer(struct ath_softc *sc)
+{
+}
+#endif /* CONFIG_ATH9K_CHANNEL_CONTEXT */
+
 int ath_reset_internal(struct ath_softc *sc, struct ath9k_channel *hchan);
 int ath_startrecv(struct ath_softc *sc);
 bool ath_stoprecv(struct ath_softc *sc);
@@ -600,9 +633,6 @@ int ath_update_survey_stats(struct ath_softc *sc);
 void ath_update_survey_nf(struct ath_softc *sc, int channel);
 void ath9k_queue_reset(struct ath_softc *sc, enum ath_reset_type type);
 void ath_ps_full_sleep(unsigned long data);
-void ath9k_p2p_ps_timer(void *priv);
-void ath9k_update_p2p_ps_timer(struct ath_softc *sc, struct ath_vif *avp);
-void ath9k_update_p2p_ps(struct ath_softc *sc, struct ieee80211_vif *vif);
 void __ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop);
 
 /**********/
@@ -857,8 +887,10 @@ struct ath_softc {
 	struct completion paprd_complete;
 	wait_queue_head_t tx_wait;
 
+#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
 	struct ath_gen_timer *p2p_ps_timer;
 	struct ath_vif *p2p_ps_vif;
+#endif
 
 	unsigned long driver_data;
 
drivers/net/wireless/ath/ath9k/channel.c +68 -10

107 lines not on this page · raw message

drivers/net/wireless/ath/ath9k/init.c +3 -6
index 4219e7b..5c48be9 100644
@@ -600,9 +600,8 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc,
 	if (ret)
 		goto err_btcoex;
 
-	sc->p2p_ps_timer = ath_gen_timer_alloc(sc->sc_ah, ath9k_p2p_ps_timer,
-					       NULL, sc, AR_FIRST_NDP_TIMER);
-	if (!sc->p2p_ps_timer)
+	ret = ath9k_init_p2p(sc);
+	if (ret)
 		goto err_btcoex;
 
 	ath9k_cmn_init_crypto(sc->sc_ah);
@@ -919,9 +918,7 @@ static void ath9k_deinit_softc(struct ath_softc *sc)
 {
 	int i = 0;
 
-	if (sc->p2p_ps_timer)
-		ath_gen_timer_free(sc->sc_ah, sc->p2p_ps_timer);
-
+	ath9k_deinit_p2p(sc);
 	ath9k_deinit_btcoex(sc);
 
 	for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++)
drivers/net/wireless/ath/ath9k/main.c +3 -15
index dd2d52e..32e80fc 100644
@@ -1213,12 +1213,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
 
 	mutex_lock(&sc->mutex);
 
-	spin_lock_bh(&sc->sc_pcu_lock);
-	if (avp == sc->p2p_ps_vif) {
-		sc->p2p_ps_vif = NULL;
-		ath9k_update_p2p_ps_timer(sc, NULL);
-	}
-	spin_unlock_bh(&sc->sc_pcu_lock);
+	ath9k_p2p_remove_vif(sc, vif);
 
 	sc->nvifs--;
 	sc->tx99_vif = NULL;
@@ -1678,7 +1673,6 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
 	struct ath_hw *ah = sc->sc_ah;
 	struct ath_common *common = ath9k_hw_common(ah);
 	struct ath_vif *avp = (void *)vif->drv_priv;
-	unsigned long flags;
 	int slottime;
 
 	ath9k_ps_wakeup(sc);
@@ -1727,14 +1721,8 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
 		}
 	}
 
-	if (changed & BSS_CHANGED_P2P_PS) {
-		spin_lock_bh(&sc->sc_pcu_lock);
-		spin_lock_irqsave(&sc->sc_pm_lock, flags);
-		if (!(sc->ps_flags & PS_BEACON_SYNC))
-			ath9k_update_p2p_ps(sc, vif);
-		spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
-		spin_unlock_bh(&sc->sc_pcu_lock);
-	}
+	if (changed & BSS_CHANGED_P2P_PS)
+		ath9k_p2p_bss_info_changed(sc, vif);
 
 	if (changed & CHECK_ANI)
 		ath_check_ani(sc);
drivers/net/wireless/ath/ath9k/recv.c +2 -2
index 74ab1d0..e6669fd 100644
@@ -547,8 +547,8 @@ static void ath_rx_ps_beacon(struct ath_softc *sc, struct sk_buff *skb)
 			"Reconfigure beacon timers based on synchronized timestamp\n");
 		if (!(WARN_ON_ONCE(sc->cur_chan->beacon.beacon_interval == 0)))
 			ath9k_set_beacon(sc);
-		if (sc->p2p_ps_vif)
-			ath9k_update_p2p_ps(sc, sc->p2p_ps_vif->vif);
+
+		ath9k_p2p_beacon_sync(sc);
 	}
 
 	if (ath_beacon_dtim_pending_cab(skb)) {
Signature · 1 line
2.0.4
#8 lore raw

PATCH v2 8/8 ath9k: Isolate ath9k_use_chanctx module parameter

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

This patch ensures that the module parameter "use_chanctx" is visible only when CONFIG_ATH9K_CHANNEL_CONTEXT is selected. Also register the channel context callbacks with mac80211 only when it is explicitly enabled and compile them out of the driver when CONFIG_ATH9K_CHANNEL_CONTEXT is not selected.

---
 drivers/net/wireless/ath/ath9k/ath9k.h   | 10 ++++-
 drivers/net/wireless/ath/ath9k/channel.c |  5 +++
 drivers/net/wireless/ath/ath9k/init.c    | 63 +++++++++++++++++++-------------
 drivers/net/wireless/ath/ath9k/main.c    | 14 ++++---
 drivers/net/wireless/ath/ath9k/recv.c    |  2 +-
 5 files changed, 62 insertions(+), 32 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +9 -1
index 642cc19..035f6f9 100644
@@ -408,7 +408,6 @@ struct ath_offchannel {
 	     ctx <= &sc->chanctx[ARRAY_SIZE(sc->chanctx) - 1];      \
 	     ctx++)
 
-void ath9k_fill_chanctx_ops(void);
 void ath9k_chanctx_force_active(struct ieee80211_hw *hw,
 				struct ieee80211_vif *vif);
 static inline struct ath_chanctx *
@@ -437,6 +436,8 @@ void ath_scan_complete(struct ath_softc *sc, bool abort);
 void ath_roc_complete(struct ath_softc *sc, bool abort);
 
 #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
+bool ath9k_is_chanctx_enabled(void);
+void ath9k_fill_chanctx_ops(void);
 int ath9k_init_p2p(struct ath_softc *sc);
 void ath9k_deinit_p2p(struct ath_softc *sc);
 void ath9k_p2p_remove_vif(struct ath_softc *sc,
@@ -446,6 +447,13 @@ void ath9k_p2p_bss_info_changed(struct ath_softc *sc,
 				struct ieee80211_vif *vif);
 void ath9k_p2p_ps_timer(void *priv);
 #else
+static inline bool ath9k_is_chanctx_enabled(void)
+{
+	return false;
+}
+static inline void ath9k_fill_chanctx_ops(void)
+{
+}
 static inline int ath9k_init_p2p(struct ath_softc *sc)
 {
 	return 0;
drivers/net/wireless/ath/ath9k/channel.c +5 -0
index c54a3df..36d73c0 100644
@@ -949,6 +949,11 @@ void ath_offchannel_timer(unsigned long data)
 
 #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
 
+bool ath9k_is_chanctx_enabled(void)
+{
+	return (ath9k_use_chanctx == 1);
+}
+
 /*****************/
 /* P2P Powersave */
 /*****************/
drivers/net/wireless/ath/ath9k/init.c +38 -25

107 lines not on this page · raw message

drivers/net/wireless/ath/ath9k/main.c +9 -5
index 32e80fc..ed281ac 100644
@@ -268,7 +268,7 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start)
 	ath9k_hw_set_interrupts(ah);
 	ath9k_hw_enable_interrupts(ah);
 
-	if (!ath9k_use_chanctx)
+	if (!ath9k_is_chanctx_enabled())
 		ieee80211_wake_queues(sc->hw);
 	else {
 		if (sc->cur_chan == &sc->offchannel.chan)
@@ -1139,7 +1139,7 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
 		ath9k_beacon_assign_slot(sc, vif);
 
 	avp->vif = vif;
-	if (!ath9k_use_chanctx) {
+	if (!ath9k_is_chanctx_enabled()) {
 		avp->chanctx = sc->cur_chan;
 		list_add_tail(&avp->list, &avp->chanctx->vifs);
 	}
@@ -1217,7 +1217,7 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
 
 	sc->nvifs--;
 	sc->tx99_vif = NULL;
-	if (!ath9k_use_chanctx)
+	if (!ath9k_is_chanctx_enabled())
 		list_del(&avp->list);
 
 	if (ath9k_uses_beacons(vif->type))
@@ -1395,7 +1395,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
 		}
 	}
 
-	if (!ath9k_use_chanctx && (changed & IEEE80211_CONF_CHANGE_CHANNEL)) {
+	if (!ath9k_is_chanctx_enabled() && (changed & IEEE80211_CONF_CHANGE_CHANNEL)) {
 		ctx->offchannel = !!(conf->flags & IEEE80211_CONF_OFFCHANNEL);
 		ath_chanctx_set_channel(sc, ctx, &hw->conf.chandef);
 	}
@@ -2108,6 +2108,8 @@ static void ath9k_sw_scan_complete(struct ieee80211_hw *hw)
 	clear_bit(ATH_OP_SCANNING, &common->op_flags);
 }
 
+#ifdef CONFIG_ATH9K_CHANNEL_CONTEXT
+
 static int ath9k_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 			 struct ieee80211_scan_request *hw_req)
 {
@@ -2339,7 +2341,7 @@ static void ath9k_unassign_vif_chanctx(struct ieee80211_hw *hw,
 
 void ath9k_fill_chanctx_ops(void)
 {
-	if (!ath9k_use_chanctx)
+	if (!ath9k_is_chanctx_enabled())
 		return;
 
 	ath9k_ops.hw_scan                  = ath9k_hw_scan;
@@ -2354,6 +2356,8 @@ void ath9k_fill_chanctx_ops(void)
 	ath9k_ops.mgd_prepare_tx           = ath9k_chanctx_force_active;
 }
 
+#endif
+
 struct ieee80211_ops ath9k_ops = {
 	.tx 		    = ath9k_tx,
 	.start 		    = ath9k_start,
drivers/net/wireless/ath/ath9k/recv.c +1 -1
index e6669fd..ae0d1e9 100644
@@ -425,7 +425,7 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
 	if (AR_SREV_9550(sc->sc_ah) || AR_SREV_9531(sc->sc_ah))
 		rfilt |= ATH9K_RX_FILTER_4ADDRESS;
 
-	if (ath9k_use_chanctx &&
+	if (ath9k_is_chanctx_enabled() &&
 	    test_bit(ATH_OP_SCANNING, &common->op_flags))
 		rfilt |= ATH9K_RX_FILTER_BEACON;
 
Signature · 1 line
2.0.4