Skip to contentSkip to conversation

ath9k patches

RFC New Sujith Manoharan 1 participant 6 messages Oct 1, 2014 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

cover ath9k patches

From: Sujith Manoharan <[email protected]>

MCC fixes. Please review.

Sujith Manoharan (5):
ath9k: Fix queue handling in flush()
ath9k: Pass context to ath9k_chanctx_wake_queues()
ath9k: Add ath9k_chanctx_stop_queues()
ath9k: Fix queue handling for channel contexts
ath9k: Fix flushing in MCC mode

 drivers/net/wireless/ath/ath9k/ath9k.h   | 10 ++++++--
 drivers/net/wireless/ath/ath9k/channel.c | 41 +++++++++++++++++++++++++++++---
 drivers/net/wireless/ath/ath9k/main.c    | 12 +---------
 3 files changed, 47 insertions(+), 16 deletions(-)
Signature · 1 line
2.1.1
#1 lore raw

RFC 1/5 ath9k: Fix queue handling in flush()

From: Sujith Manoharan <[email protected]>

When draining of the TX queues fails, a full HW reset is done. ath_reset() makes sure that the queues in mac80211 are restarted, so there is no need to wake them up again.

---
 drivers/net/wireless/ath/ath9k/main.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +0 -5
index 65ca7ac..5f908a0 100644
@@ -1999,7 +1999,6 @@ void __ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
 	struct ath_common *common = ath9k_hw_common(ah);
 	int timeout = HZ / 5; /* 200 ms */
 	bool drain_txq;
-	int i;
 
 	cancel_delayed_work_sync(&sc->tx_complete_work);
 
@@ -2027,10 +2026,6 @@ void __ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
 			ath_reset(sc);
 
 		ath9k_ps_restore(sc);
-		for (i = 0; i < IEEE80211_NUM_ACS; i++) {
-			ieee80211_wake_queue(sc->hw,
-					     sc->cur_chan->hw_queue_base + i);
-		}
 	}
 
 	ieee80211_queue_delayed_work(hw, &sc->tx_complete_work, 0);
Signature · 1 line
2.1.1
#2 lore raw

RFC 2/5 ath9k: Pass context to ath9k_chanctx_wake_queues()

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

Change the ath9k_chanctx_wake_queues() API so that we can pass the channel context that needs its queues to be stopped.

---
 drivers/net/wireless/ath/ath9k/ath9k.h   | 5 +++--
 drivers/net/wireless/ath/ath9k/channel.c | 6 +++---
 drivers/net/wireless/ath/ath9k/main.c    | 2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +3 -2
index 37a5ccf..4f94d31 100644
@@ -455,7 +455,7 @@ void ath9k_p2p_bss_info_changed(struct ath_softc *sc,
 void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp,
 			  struct sk_buff *skb);
 void ath9k_p2p_ps_timer(void *priv);
-void ath9k_chanctx_wake_queues(struct ath_softc *sc);
+void ath9k_chanctx_wake_queues(struct ath_softc *sc, struct ath_chanctx *ctx);
 void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx);
 
 void ath_chanctx_beacon_recv_ev(struct ath_softc *sc,
@@ -525,7 +525,8 @@ static inline void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *av
 static inline void ath9k_p2p_ps_timer(struct ath_softc *sc)
 {
 }
-static inline void ath9k_chanctx_wake_queues(struct ath_softc *sc)
+static inline void ath9k_chanctx_wake_queues(struct ath_softc *sc,
+					     struct ath_chanctx *ctx)
 {
 }
 static inline void ath_chanctx_check_active(struct ath_softc *sc,
drivers/net/wireless/ath/ath9k/channel.c +3 -3
index d088f06..96da03e 100644
@@ -1177,18 +1177,18 @@ bool ath9k_is_chanctx_enabled(void)
 /* Queue management */
 /********************/
 
-void ath9k_chanctx_wake_queues(struct ath_softc *sc)
+void ath9k_chanctx_wake_queues(struct ath_softc *sc, struct ath_chanctx *ctx)
 {
 	struct ath_hw *ah = sc->sc_ah;
 	int i;
 
-	if (sc->cur_chan == &sc->offchannel.chan) {
+	if (ctx == &sc->offchannel.chan) {
 		ieee80211_wake_queue(sc->hw,
 				     sc->hw->offchannel_tx_hw_queue);
 	} else {
 		for (i = 0; i < IEEE80211_NUM_ACS; i++)
 			ieee80211_wake_queue(sc->hw,
-					     sc->cur_chan->hw_queue_base + i);
+					     ctx->hw_queue_base + i);
 	}
 
 	if (ah->opmode == NL80211_IFTYPE_AP)
drivers/net/wireless/ath/ath9k/main.c +1 -1
index 5f908a0..f0035a9 100644
@@ -268,7 +268,7 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start)
 	if (!ath9k_is_chanctx_enabled())
 		ieee80211_wake_queues(sc->hw);
 	else
-		ath9k_chanctx_wake_queues(sc);
+		ath9k_chanctx_wake_queues(sc, sc->cur_chan);
 
 	ath9k_p2p_ps_timer(sc);
 
Signature · 1 line
2.1.1
#3 lore raw

RFC 3/5 ath9k: Add ath9k_chanctx_stop_queues()

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

This can be used when the queues of a context
needs to be stopped.

---
 drivers/net/wireless/ath/ath9k/ath9k.h   |  5 +++++
 drivers/net/wireless/ath/ath9k/channel.c | 19 +++++++++++++++++++
 2 files changed, 24 insertions(+)
drivers/net/wireless/ath/ath9k/ath9k.h +5 -0
index 4f94d31..bfa0b15 100644
@@ -456,6 +456,7 @@ void ath9k_beacon_add_noa(struct ath_softc *sc, struct ath_vif *avp,
 			  struct sk_buff *skb);
 void ath9k_p2p_ps_timer(void *priv);
 void ath9k_chanctx_wake_queues(struct ath_softc *sc, struct ath_chanctx *ctx);
+void ath9k_chanctx_stop_queues(struct ath_softc *sc, struct ath_chanctx *ctx);
 void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx);
 
 void ath_chanctx_beacon_recv_ev(struct ath_softc *sc,
@@ -529,6 +530,10 @@ static inline void ath9k_chanctx_wake_queues(struct ath_softc *sc,
 					     struct ath_chanctx *ctx)
 {
 }
+static inline void ath9k_chanctx_stop_queues(struct ath_softc *sc,
+					     struct ath_chanctx *ctx)
+{
+}
 static inline void ath_chanctx_check_active(struct ath_softc *sc,
 					    struct ath_chanctx *ctx)
 {
drivers/net/wireless/ath/ath9k/channel.c +19 -0
index 96da03e..bf5ecd8 100644
@@ -1177,6 +1177,25 @@ bool ath9k_is_chanctx_enabled(void)
 /* Queue management */
 /********************/
 
+void ath9k_chanctx_stop_queues(struct ath_softc *sc, struct ath_chanctx *ctx)
+{
+	struct ath_hw *ah = sc->sc_ah;
+	int i;
+
+	if (ctx == &sc->offchannel.chan) {
+		ieee80211_stop_queue(sc->hw,
+				     sc->hw->offchannel_tx_hw_queue);
+	} else {
+		for (i = 0; i < IEEE80211_NUM_ACS; i++)
+			ieee80211_stop_queue(sc->hw,
+					     ctx->hw_queue_base + i);
+	}
+
+	if (ah->opmode == NL80211_IFTYPE_AP)
+		ieee80211_stop_queue(sc->hw, sc->hw->queues - 2);
+}
+
+
 void ath9k_chanctx_wake_queues(struct ath_softc *sc, struct ath_chanctx *ctx)
 {
 	struct ath_hw *ah = sc->sc_ah;
Signature · 1 line
2.1.1
#4 lore raw

RFC 4/5 ath9k: Fix queue handling for channel contexts

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

When a full chip reset is done, all the queues across all VIFs are stopped, but if MCC is enabled, only the queues of the current context is awakened, when we complete the reset.

This results in unfairness for the inactive context. Since frames are queued internally in the driver if there is a context mismatch, we can awaken all the queues when coming out of a reset.

The VIF-specific queues are still used in flow control, to ensure fairness when traffic is high.

---
 drivers/net/wireless/ath/ath9k/main.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +1 -6
index f0035a9..2051624 100644
@@ -264,12 +264,7 @@ static bool ath_complete_reset(struct ath_softc *sc, bool start)
 
 	ath9k_hw_set_interrupts(ah);
 	ath9k_hw_enable_interrupts(ah);
-
-	if (!ath9k_is_chanctx_enabled())
-		ieee80211_wake_queues(sc->hw);
-	else
-		ath9k_chanctx_wake_queues(sc, sc->cur_chan);
-
+	ieee80211_wake_queues(sc->hw);
 	ath9k_p2p_ps_timer(sc);
 
 	return true;
Signature · 1 line
2.1.1
#5 lore raw

RFC 5/5 ath9k: Fix flushing in MCC mode

In reply to Sujith Manoharan

From: Sujith Manoharan <[email protected]>

When we are attempting to switch to a new channel context, the TX queues are flushed, but the mac80211 queues are not stopped and traffic can still come down to the driver.

This patch fixes it by stopping the queues assigned to the current context/vif before trying to flush.

---
 drivers/net/wireless/ath/ath9k/channel.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/net/wireless/ath/ath9k/channel.c +16 -0
index bf5ecd8..945c898 100644
@@ -1044,9 +1044,11 @@ static void ath_offchannel_channel_change(struct ath_softc *sc)
 void ath_chanctx_set_next(struct ath_softc *sc, bool force)
 {
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+	struct ath_chanctx *old_ctx;
 	struct timespec ts;
 	bool measure_time = false;
 	bool send_ps = false;
+	bool queues_stopped = false;
 
 	spin_lock_bh(&sc->chan_lock);
 	if (!sc->next_chan) {
@@ -1076,6 +1078,10 @@ void ath_chanctx_set_next(struct ath_softc *sc, bool force)
 			getrawmonotonic(&ts);
 			measure_time = true;
 		}
+
+		ath9k_chanctx_stop_queues(sc, sc->cur_chan);
+		queues_stopped = true;
+
 		__ath9k_flush(sc->hw, ~0, true);
 
 		if (ath_chanctx_send_ps_frame(sc, true))
@@ -1089,6 +1095,7 @@ void ath_chanctx_set_next(struct ath_softc *sc, bool force)
 			sc->cur_chan->tsf_val = ath9k_hw_gettsf64(sc->sc_ah);
 		}
 	}
+	old_ctx = sc->cur_chan;
 	sc->cur_chan = sc->next_chan;
 	sc->cur_chan->stopped = false;
 	sc->next_chan = NULL;
@@ -1111,7 +1118,16 @@ void ath_chanctx_set_next(struct ath_softc *sc, bool force)
 		if (measure_time)
 			sc->sched.channel_switch_time =
 				ath9k_hw_get_tsf_offset(&ts, NULL);
+		/*
+		 * A reset will ensure that all queues are woken up,
+		 * so there is no need to awaken them again.
+		 */
+		goto out;
 	}
+
+	if (queues_stopped)
+		ath9k_chanctx_wake_queues(sc, old_ctx);
+out:
 	if (send_ps)
 		ath_chanctx_send_ps_frame(sc, false);
 
Signature · 1 line
2.1.1