ath9k patches
PATCH 1/5 ath9k: Clear NoA schedule properly
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
When an active context transitions to inactive state, the NoA schedule needs to be removed for the context that has beaconing enabled. Not doing this will affect p2p clients.
--- drivers/net/wireless/ath/ath9k/channel.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/net/wireless/ath/ath9k/channel.c +15 -0
@@ -356,6 +356,21 @@ void ath_chanctx_event(struct ath_softc *sc, struct ieee80211_vif *vif, "Move chanctx state from WAIT_FOR_TIMER to WAIT_FOR_BEACON\n"); } +/* +* When a context becomes inactive, for example, +* disassociation of a station context, the NoA +* attribute needs to be removed from subsequent +* beacons. +*/ +if (!ctx->active && avp->noa_duration && + sc->sched.state !=ATH_CHANCTX_STATE_WAIT_FOR_BEACON ) { + avp->noa_duration =0 ; + avp->periodic_noa = false; + +ath_dbg (common,CHAN_CTX , +"Clearing NoA schedule\n" ); + } +if (sc->sched.state !=ATH_CHANCTX_STATE_WAIT_FOR_BEACON )break ;
Signature · 1 line
2.1.2
PATCH 3/5 ath9k: Fix MCC flush timeout
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
In MCC mode, the duration for a channel context is half the beacon interval and having a large flush timeout will adversely affect GO operation, since the default value of 200ms will overshoot the advertised NoA absence duration.
The scheduler initiates a channel context switch only when the slot duration for the current context expires, so there is no possibility of having a fixed timeout for flush.
Since the channel_switch_time is added to the absence duration when the GO sets up the NoA attribute, this is the maximum time that we have to flush the TX queues. The duration is very small, but we don't have a choice in MCC mode.
--- drivers/net/wireless/ath/ath9k/channel.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/channel.c +15 -1
@@ -199,6 +199,7 @@ static const char *chanctx_state_string(enum ath_chanctx_state state)void ath_chanctx_check_active (struct ath_softc *sc,struct ath_chanctx *ctx) {struct ath_common *common =ath9k_hw_common (sc->sc_ah); +struct ath_chanctx *ictx;struct ath_vif *avp;bool active = false;u8 n_active =0 ;
@@ -206,6 +207,8 @@ void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx)if (!ctx)return ; + ictx = ctx; +list_for_each_entry (avp, &ctx->vifs, list) {struct ieee80211_vif *vif = avp->vif;
@@ -228,12 +231,23 @@ void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx) n_active++; } +spin_lock_bh (&sc->chan_lock); +if (n_active <=1 ) { + ictx->flush_timeout =HZ /5 ;clear_bit (ATH_OP_MULTI_CHANNEL , &common->op_flags); +spin_unlock_bh (&sc->chan_lock);return ; } -if (test_and_set_bit (ATH_OP_MULTI_CHANNEL , &common->op_flags)) + + ictx->flush_timeout =usecs_to_jiffies (sc->sched.channel_switch_time); + +if (test_and_set_bit (ATH_OP_MULTI_CHANNEL , &common->op_flags)) { +spin_unlock_bh (&sc->chan_lock);return ; + } + +spin_unlock_bh (&sc->chan_lock);if (ath9k_is_chanctx_enabled ()) { ath_chanctx_event(sc, NULL,
Signature · 1 line
2.1.2
cover ath9k patches
From: Sujith Manoharan <[email protected]>
MCC fixes for -next.
Sujith Manoharan (5):
ath9k: Clear NoA schedule properly
ath9k: Use configurable timeout for flush
ath9k: Fix MCC flush timeout
ath9k: Fix offchannel flush timeout
ath9k: Check for pending frames properly
drivers/net/wireless/ath/ath9k/ath9k.h | 4 ++- drivers/net/wireless/ath/ath9k/channel.c | 57 ++++++++++++++++++++++++++++++-- drivers/net/wireless/ath/ath9k/main.c | 30 ++++++++++++----- 3 files changed, 79 insertions(+), 12 deletions(-)
Signature · 1 line
2.1.2
PATCH 4/5 ath9k: Fix offchannel flush timeout
From: Sujith Manoharan <[email protected]>
An offchannel operation also needs to have a flush timeout that doesn't exceed the NoA absence duration of a GO context, so use channel_switch_time. The first offchannel operation is set a flush timeout of 10ms since channel_switch_time will be zero.
--- drivers/net/wireless/ath/ath9k/channel.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/net/wireless/ath/ath9k/channel.c +20 -0
@@ -207,6 +207,26 @@ void ath_chanctx_check_active(struct ath_softc *sc, struct ath_chanctx *ctx)if (!ctx)return ; +if (ctx == &sc->offchannel.chan) { +spin_lock_bh (&sc->chan_lock); + +if (likely (sc->sched.channel_switch_time)) + ctx->flush_timeout = +usecs_to_jiffies (sc->sched.channel_switch_time); +else + ctx->flush_timeout = +msecs_to_jiffies (10 ); + +spin_unlock_bh (&sc->chan_lock); + +/* +* There is no need to iterate over the +* active/assigned channel contexts if +* the current context is offchannel. +*/ +return ; + } + ictx = ctx;list_for_each_entry (avp, &ctx->vifs, list) {
Signature · 1 line
2.1.2
PATCH 2/5 ath9k: Use configurable timeout for flush
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
The timeout value for flushing the TX queues is hardcoded at 200ms right now. Use a channel context-specific value instead to allow adjustments to the timeout in case MCC is enabled.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 1 + drivers/net/wireless/ath/ath9k/channel.c | 1 + drivers/net/wireless/ath/ath9k/main.c | 9 ++++++++- 3 files changed, 10 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/ath9k.h +1 -0
@@ -345,6 +345,7 @@ struct ath_chanctx {u64 tsf_val;u32 last_beacon; +int flush_timeout;u16 txpower;bool offchannel;bool stopped;
drivers/net/wireless/ath/ath9k/channel.c +1 -0
@@ -117,6 +117,7 @@ void ath_chanctx_init(struct ath_softc *sc)cfg80211_chandef_create (&ctx->chandef, chan,NL80211_CHAN_HT20 );INIT_LIST_HEAD (&ctx->vifs); ctx->txpower =ATH_TXPOWER_MAX ; + ctx->flush_timeout =HZ /5 ;/* 200ms */ for (j =0 ; j <ARRAY_SIZE (ctx->acq); j++)INIT_LIST_HEAD (&ctx->acq[j]); }
drivers/net/wireless/ath/ath9k/main.c +8 -1
@@ -2034,7 +2034,7 @@ void __ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop)struct ath_softc *sc = hw->priv;struct ath_hw *ah = sc->sc_ah;struct ath_common *common =ath9k_hw_common (ah); -int timeout =HZ /5 ;/* 200 ms */ +int timeout;bool drain_txq;cancel_delayed_work_sync (&sc->tx_complete_work);
@@ -2049,6 +2049,13 @@ void __ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop)return ; } +spin_lock_bh (&sc->chan_lock); + timeout = sc->cur_chan->flush_timeout; +spin_unlock_bh (&sc->chan_lock); + +ath_dbg (common,CHAN_CTX , +"Flush timeout: %d\n" ,jiffies_to_msecs (timeout)); +if (wait_event_timeout (sc->tx_wait, !ath9k_has_tx_pending (sc), timeout) >0 ) drop = false;
Signature · 1 line
2.1.2
PATCH 5/5 ath9k: Check for pending frames properly
In reply to Sujith ManoharanFrom: Sujith Manoharan <[email protected]>
Pending frames in the driver can be present either in the HW queues or SW. ath9k_has_pending_frames() currently checks for the HW queues first and then checks if any ACs are queued in the driver.
In MCC mode, we need to check the HW queues alone, since the SW queues are just marked as 'stopped' - they will be processed in the next context switch. But since we don't differentiate this now, mention whether we want to check if there are frames in the SW queues.
* The flush() callback checks both HW and SW queues.
* The tx_frames_pending() callback does the same.
* The call to __ath9k_flush() in MCC mode checks HW queues alone.
--- drivers/net/wireless/ath/ath9k/ath9k.h | 3 ++- drivers/net/wireless/ath/ath9k/channel.c | 5 +++-- drivers/net/wireless/ath/ath9k/main.c | 21 ++++++++++++++------- 3 files changed, 19 insertions(+), 10 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +2 -1
@@ -715,7 +715,8 @@ 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_flush (struct ieee80211_hw *hw,u32 queues,bool drop); +void __ath9k_flush (struct ieee80211_hw *hw,u32 queues,bool drop, +bool sw_pending);/**********/ /* BTCOEX */
drivers/net/wireless/ath/ath9k/channel.c +3 -2
@@ -1137,10 +1137,11 @@ void ath_chanctx_set_next(struct ath_softc *sc, bool force)ath9k_chanctx_stop_queues (sc, sc->cur_chan); queues_stopped = true; -__ath9k_flush (sc->hw, ~0 , true); +__ath9k_flush (sc->hw, ~0 , true, false);if (ath_chanctx_send_ps_frame (sc, true)) -__ath9k_flush (sc->hw,BIT (IEEE80211_AC_VO ), false); +__ath9k_flush (sc->hw,BIT (IEEE80211_AC_VO ), + false, false); send_ps = true;spin_lock_bh (&sc->chan_lock);
drivers/net/wireless/ath/ath9k/main.c +14 -7
@@ -54,7 +54,8 @@ u8 ath9k_parse_mpdudensity(u8 mpdudensity) } } -static bool ath9k_has_pending_frames (struct ath_softc *sc,struct ath_txq *txq) +static bool ath9k_has_pending_frames (struct ath_softc *sc,struct ath_txq *txq, +bool sw_pending) {bool pending = false;
@@ -65,6 +66,9 @@ static bool ath9k_has_pending_frames(struct ath_softc *sc, struct ath_txq *txq) goto out; } +if (!sw_pending) + goto out; +if (txq->mac80211_qnum >=0 ) {struct list_head *list;
@@ -2003,7 +2007,8 @@ static void ath9k_set_coverage_class(struct ieee80211_hw *hw,mutex_unlock (&sc->mutex); } -static bool ath9k_has_tx_pending (struct ath_softc *sc) +static bool ath9k_has_tx_pending (struct ath_softc *sc, +bool sw_pending) {int i, npend =0 ;
@@ -2011,7 +2016,8 @@ static bool ath9k_has_tx_pending(struct ath_softc *sc)if (!ATH_TXQ_SETUP (sc, i))continue ; - npend =ath9k_has_pending_frames (sc, &sc->tx.txq[i]); + npend =ath9k_has_pending_frames (sc, &sc->tx.txq[i], + sw_pending);if (npend)break ; }
@@ -2025,11 +2031,12 @@ static void ath9k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,struct ath_softc *sc = hw->priv;mutex_lock (&sc->mutex); -__ath9k_flush (hw, queues, drop); +__ath9k_flush (hw, queues, drop, true);mutex_unlock (&sc->mutex); } -void __ath9k_flush (struct ieee80211_hw *hw,u32 queues,bool drop) +void __ath9k_flush (struct ieee80211_hw *hw,u32 queues,bool drop, +bool sw_pending) {struct ath_softc *sc = hw->priv;struct ath_hw *ah = sc->sc_ah;
@@ -2056,7 +2063,7 @@ void __ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop)ath_dbg (common,CHAN_CTX ,"Flush timeout: %d\n" ,jiffies_to_msecs (timeout)); -if (wait_event_timeout (sc->tx_wait, !ath9k_has_tx_pending (sc), +if (wait_event_timeout (sc->tx_wait, !ath9k_has_tx_pending (sc, sw_pending), timeout) >0 ) drop = false;
@@ -2079,7 +2086,7 @@ static bool ath9k_tx_frames_pending(struct ieee80211_hw *hw) {struct ath_softc *sc = hw->priv; -return ath9k_has_tx_pending (sc); +return ath9k_has_tx_pending (sc, true); }static int ath9k_tx_last_beacon (struct ieee80211_hw *hw)
Signature · 1 line
2.1.2