* [RFC 1/5] ath9k: Fix queue handling in flush()
2014-10-01 10:08 [RFC 0/5] ath9k patches Sujith Manoharan
@ 2014-10-01 10:08 ` Sujith Manoharan
2014-10-01 10:08 ` [RFC 2/5] ath9k: Pass context to ath9k_chanctx_wake_queues() Sujith Manoharan
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Sujith Manoharan @ 2014-10-01 10:08 UTC (permalink / raw)
To: linux-wireless; +Cc: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
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.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath9k/main.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 65ca7ac..5f908a0 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -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);
--
2.1.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [RFC 2/5] ath9k: Pass context to ath9k_chanctx_wake_queues()
2014-10-01 10:08 [RFC 0/5] ath9k patches Sujith Manoharan
2014-10-01 10:08 ` [RFC 1/5] ath9k: Fix queue handling in flush() Sujith Manoharan
@ 2014-10-01 10:08 ` Sujith Manoharan
2014-10-01 10:08 ` [RFC 3/5] ath9k: Add ath9k_chanctx_stop_queues() Sujith Manoharan
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Sujith Manoharan @ 2014-10-01 10:08 UTC (permalink / raw)
To: linux-wireless; +Cc: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Change the ath9k_chanctx_wake_queues() API so
that we can pass the channel context that needs its
queues to be stopped.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
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(-)
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 37a5ccf..4f94d31 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -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,
diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index d088f06..96da03e 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -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)
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 5f908a0..f0035a9 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -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);
--
2.1.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [RFC 3/5] ath9k: Add ath9k_chanctx_stop_queues()
2014-10-01 10:08 [RFC 0/5] ath9k patches Sujith Manoharan
2014-10-01 10:08 ` [RFC 1/5] ath9k: Fix queue handling in flush() Sujith Manoharan
2014-10-01 10:08 ` [RFC 2/5] ath9k: Pass context to ath9k_chanctx_wake_queues() Sujith Manoharan
@ 2014-10-01 10:08 ` Sujith Manoharan
2014-10-01 10:08 ` [RFC 4/5] ath9k: Fix queue handling for channel contexts Sujith Manoharan
2014-10-01 10:08 ` [RFC 5/5] ath9k: Fix flushing in MCC mode Sujith Manoharan
4 siblings, 0 replies; 8+ messages in thread
From: Sujith Manoharan @ 2014-10-01 10:08 UTC (permalink / raw)
To: linux-wireless; +Cc: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
This can be used when the queues of a context
needs to be stopped.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath9k/ath9k.h | 5 +++++
drivers/net/wireless/ath/ath9k/channel.c | 19 +++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
index 4f94d31..bfa0b15 100644
--- a/drivers/net/wireless/ath/ath9k/ath9k.h
+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
@@ -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)
{
diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index 96da03e..bf5ecd8 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -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;
--
2.1.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [RFC 4/5] ath9k: Fix queue handling for channel contexts
2014-10-01 10:08 [RFC 0/5] ath9k patches Sujith Manoharan
` (2 preceding siblings ...)
2014-10-01 10:08 ` [RFC 3/5] ath9k: Add ath9k_chanctx_stop_queues() Sujith Manoharan
@ 2014-10-01 10:08 ` Sujith Manoharan
2014-10-01 10:08 ` [RFC 5/5] ath9k: Fix flushing in MCC mode Sujith Manoharan
4 siblings, 0 replies; 8+ messages in thread
From: Sujith Manoharan @ 2014-10-01 10:08 UTC (permalink / raw)
To: linux-wireless; +Cc: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
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.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath9k/main.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index f0035a9..2051624 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -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;
--
2.1.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [RFC 5/5] ath9k: Fix flushing in MCC mode
2014-10-01 10:08 [RFC 0/5] ath9k patches Sujith Manoharan
` (3 preceding siblings ...)
2014-10-01 10:08 ` [RFC 4/5] ath9k: Fix queue handling for channel contexts Sujith Manoharan
@ 2014-10-01 10:08 ` Sujith Manoharan
4 siblings, 0 replies; 8+ messages in thread
From: Sujith Manoharan @ 2014-10-01 10:08 UTC (permalink / raw)
To: linux-wireless; +Cc: ath9k-devel
From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
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.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath9k/channel.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index bf5ecd8..945c898 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -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);
--
2.1.1
^ permalink raw reply related [flat|nested] 8+ messages in thread