ath9k patches
v2 cover ath9k patches
From: Sujith Manoharan <[email protected]>
Pending MCC fixes, rebased over -rc7.
Sujith Manoharan (10):
ath: Add support for tracing
ath9k: Print RoC expiration
ath9k: Check pending frames properly
ath9k: Fix pending frame check
ath9k: Remove duplicate code
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/Kconfig | 8 ++++ drivers/net/wireless/ath/Makefile | 4 ++ drivers/net/wireless/ath/ath.h | 1 + drivers/net/wireless/ath/ath9k/ath9k.h | 10 ++++- drivers/net/wireless/ath/ath9k/channel.c | 48 +++++++++++++++++++-- drivers/net/wireless/ath/ath9k/main.c | 30 +++----------- drivers/net/wireless/ath/main.c | 3 ++ drivers/net/wireless/ath/trace.c | 20 +++++++++ drivers/net/wireless/ath/trace.h | 71 ++++++++++++++++++++++++++++++++ 9 files changed, 166 insertions(+), 29 deletions(-) create mode 100644 drivers/net/wireless/ath/trace.c create mode 100644 drivers/net/wireless/ath/trace.h
Signature · 1 line
2.1.1
PATCH v2 1/10 ath: Add support for tracing
From: Sujith Manoharan <[email protected]>
--- drivers/net/wireless/ath/Kconfig | 8 +++++ drivers/net/wireless/ath/Makefile | 4 +++ drivers/net/wireless/ath/ath.h | 1 + drivers/net/wireless/ath/main.c | 3 ++ drivers/net/wireless/ath/trace.c | 20 +++++++++++ drivers/net/wireless/ath/trace.h | 71 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 107 insertions(+) create mode 100644 drivers/net/wireless/ath/trace.c create mode 100644 drivers/net/wireless/ath/trace.h
drivers/net/wireless/ath/Kconfig +8 -0
@@ -25,6 +25,14 @@ config ATH_DEBUG Say Y, if you want to debug atheros wireless drivers. Right now only ath9k makes use of this. +config ATH_TRACEPOINTS + bool "Atheros wireless tracing" + depends on ATH_DEBUG + depends on EVENT_TRACING + ---help--- + This option enables tracepoints for atheros wireless drivers. + Currently, ath9k makes use of this facility. + config ATH_REG_DYNAMIC_USER_REG_HINTS bool "Atheros dynamic user regulatory hints" depends on CFG80211_CERTIFICATION_ONUS
drivers/net/wireless/ath/Makefile +4 -0
@@ -17,4 +17,8 @@ ath-objs := main.o \ dfs_pri_detector.o ath-$(CONFIG_ATH_DEBUG) += debug.o +ath-$(CONFIG_ATH_TRACEPOINTS) += trace.o + ccflags-y += -D__CHECK_ENDIAN__ + +CFLAGS_trace.o := -I$(src)
drivers/net/wireless/ath/ath.h +1 -0
@@ -268,6 +268,7 @@ enum ATH_DEBUG { };#define ATH_DBG_DEFAULT (ATH_DBG_FATAL) +#define ATH_DBG_MAX_LEN 512#ifdef CONFIG_ATH_DEBUG
drivers/net/wireless/ath/main.c +3 -0
@@ -20,6 +20,7 @@#include <linux/module.h> #include "ath.h" +#include "trace.h" MODULE_AUTHOR ("Atheros Communications" );MODULE_DESCRIPTION ("Shared library for Atheros wireless LAN cards." );
@@ -84,6 +85,8 @@ void ath_printk(const char *level, const struct ath_common* common,else printk ("%sath: %pV" , level, &vaf); +trace_ath_log (common->hw->wiphy, &vaf); +va_end (args); }EXPORT_SYMBOL (ath_printk);
drivers/net/wireless/ath/trace.c new file +20 -0
@@ -0,0 +1,20 @@ +/* +* Copyright (c) 2014 Qualcomm Atheros, Inc. +* +* Permission to use, copy, modify, and/or distribute this software for any +* purpose with or without fee is hereby granted, provided that the above +* copyright notice and this permission notice appear in all copies. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#include <linux/module.h> + +#define CREATE_TRACE_POINTS +#include "trace.h"
drivers/net/wireless/ath/trace.h new file +71 -0
71 lines not on this page · raw message
Signature · 1 line
2.1.1
PATCH v2 2/10 ath9k: Print RoC expiration
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
--- drivers/net/wireless/ath/ath9k/channel.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/wireless/ath/ath9k/channel.c +7 -0
@@ -761,6 +761,13 @@ void ath_offchannel_next(struct ath_softc *sc)void ath_roc_complete (struct ath_softc *sc,bool abort) { +struct ath_common *common =ath9k_hw_common (sc->sc_ah); + +if (abort) +ath_dbg (common,CHAN_CTX ,"RoC aborted\n" ); +else +ath_dbg (common,CHAN_CTX ,"RoC expired\n" ); + sc->offchannel.roc_vif =NULL ; sc->offchannel.roc_chan =NULL ;if (!abort)
Signature · 1 line
2.1.1
PATCH v2 3/10 ath9k: Check pending frames properly
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
There is no need to check if the current
channel context has active ACs queued up
if the TX queue is not empty.
--- drivers/net/wireless/ath/ath9k/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/main.c +4 -1
@@ -60,8 +60,10 @@ static bool ath9k_has_pending_frames(struct ath_softc *sc, struct ath_txq *txq)spin_lock_bh (&txq->axq_lock); -if (txq->axq_depth) +if (txq->axq_depth) { pending = true; + goto out; + }if (txq->mac80211_qnum >=0 ) {struct list_head *list;
@@ -70,6 +72,7 @@ static bool ath9k_has_pending_frames(struct ath_softc *sc, struct ath_txq *txq)if (!list_empty (list)) pending = true; } +out:spin_unlock_bh (&txq->axq_lock);return pending; }
Signature · 1 line
2.1.1
PATCH v2 4/10 ath9k: Fix pending frame check
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
Checking for the queue depth outside of
the TX queue lock is incorrect and in this
case, is not required since it is done insideath9k_has_pending_frames().
--- drivers/net/wireless/ath/ath9k/main.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +0 -3
@@ -1974,9 +1974,6 @@ static bool ath9k_has_tx_pending(struct ath_softc *sc)if (!ATH_TXQ_SETUP (sc, i))continue ; -if (!sc->tx.txq[i].axq_depth) -continue ; - npend =ath9k_has_pending_frames (sc, &sc->tx.txq[i]);if (npend)break ;
Signature · 1 line
2.1.1
PATCH v2 5/10 ath9k: Remove duplicate code
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
ath9k_has_tx_pending() can be used to
check if there are pending frames instead
of having duplicate code.
--- drivers/net/wireless/ath/ath9k/main.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/net/wireless/ath/ath9k/main.c +1 -9
@@ -2039,16 +2039,8 @@ void __ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop)static bool ath9k_tx_frames_pending (struct ieee80211_hw *hw) {struct ath_softc *sc = hw->priv; -int i; - -for (i =0 ; i <ATH9K_NUM_TX_QUEUES ; i++) { -if (!ATH_TXQ_SETUP (sc, i)) -continue ; -if (ath9k_has_pending_frames (sc, &sc->tx.txq[i])) -return true; - } -return false; +return ath9k_has_tx_pending (sc); }static int ath9k_tx_last_beacon (struct ieee80211_hw *hw)
Signature · 1 line
2.1.1
PATCH v2 6/10 ath9k: Fix queue handling in flush()
In reply to Sujith ManoharanFrom: 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
@@ -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
PATCH v2 7/10 ath9k: Pass context to ath9k_chanctx_wake_queues()
In reply to Sujith ManoharanFrom: 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
@@ -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 *avstatic 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
@@ -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
@@ -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
PATCH v2 8/10 ath9k: Add ath9k_chanctx_stop_queues()
In reply to Sujith ManoharanFrom: 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
@@ -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
@@ -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
PATCH v2 9/10 ath9k: Fix queue handling for channel contexts
In reply to Sujith ManoharanFrom: 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
@@ -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
PATCH v2 10/10 ath9k: Fix flushing in MCC mode
In reply to Sujith ManoharanFrom: 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
@@ -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