All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath9k: Cancel pending offchannel operations
@ 2014-11-01  7:04 ` Sujith Manoharan
  2014-11-03  4:39   ` [PATCH] ath9k: Cancel pending offchannel operations [and 1 more messages] Sujith Manoharan
  0 siblings, 1 reply; 3+ messages in thread
From: Sujith Manoharan @ 2014-11-01  7:04 UTC (permalink / raw
  To: John Linville; +Cc: linux-wireless, ath9k-devel

From: Sujith Manoharan <c_manoha@qca.qualcomm.com>

In mgd_prepare_tx(), any pending HW scan is cancelled,
but pending RoC operations are not cancelled. This
results in a RoC request that never completes. For example,
in a GO/STA setup, if p2p-find is initiated on an active GO
interface wpa_s issues a RoC on the listen channel at the
end of each scan run.

Enabling the station interface will force the station context
and the earlier RoC is not cleared. Fix this by clearing all
pending offchannel operations in mgd_prepare_tx().

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath9k/main.c | 40 ++++++++++++++++++++++++-----------
 1 file changed, 28 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index a91ee92..cedc056 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -2498,6 +2498,31 @@ static void ath9k_unassign_vif_chanctx(struct ieee80211_hw *hw,
 	mutex_unlock(&sc->mutex);
 }
 
+static void ath9k_cancel_pending_offchannel(struct ieee80211_hw *hw)
+{
+	struct ath_softc *sc = hw->priv;
+	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
+
+	if (sc->offchannel.roc_vif) {
+		ath_dbg(common, CHAN_CTX,
+			"%s: Aborting RoC\n", __func__);
+
+		del_timer_sync(&sc->offchannel.timer);
+		if (sc->offchannel.state >= ATH_OFFCHANNEL_ROC_START)
+			ath_roc_complete(sc, true);
+	}
+
+	if (test_bit(ATH_OP_SCANNING, &common->op_flags)) {
+		ath_dbg(common, CHAN_CTX,
+			"%s: Aborting HW scan\n", __func__);
+
+		del_timer_sync(&sc->offchannel.timer);
+		ath_scan_complete(sc, true);
+	}
+
+	flush_work(&sc->chanctx_work);
+}
+
 static void ath9k_mgd_prepare_tx(struct ieee80211_hw *hw,
 				 struct ieee80211_vif *vif)
 {
@@ -2526,18 +2551,9 @@ static void ath9k_mgd_prepare_tx(struct ieee80211_hw *hw,
 	if (!changed)
 		goto out;
 
-	if (test_bit(ATH_OP_SCANNING, &common->op_flags)) {
-		ath_dbg(common, CHAN_CTX,
-			"%s: Aborting HW scan\n", __func__);
-
-		mutex_unlock(&sc->mutex);
-
-		del_timer_sync(&sc->offchannel.timer);
-		ath_scan_complete(sc, true);
-		flush_work(&sc->chanctx_work);
-
-		mutex_lock(&sc->mutex);
-	}
+	mutex_unlock(&sc->mutex);
+	ath9k_cancel_pending_offchannel(hw);
+	mutex_lock(&sc->mutex);
 
 	go_ctx = ath_is_go_chanctx_present(sc);
 
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] ath9k: Clear offchannel state properly
@ 2014-11-01  7:05 Sujith Manoharan
  2014-11-01  7:04 ` [PATCH] ath9k: Cancel pending offchannel operations Sujith Manoharan
  0 siblings, 1 reply; 3+ messages in thread
From: Sujith Manoharan @ 2014-11-01  7:05 UTC (permalink / raw
  To: John Linville; +Cc: linux-wireless, ath9k-devel

From: Sujith Manoharan <c_manoha@qca.qualcomm.com>

When a pending roc or scan operation is cancelled,
the offchannel operation is cleared, but the offchannel
state in the main scheduler is not cleared. This causes
problems since an active GO will try to process a stale
offchannel request that was deferred earlier. Fix this
by clearing the state when there is no pending offchannel
(roc/scan) operation.

Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
---
 drivers/net/wireless/ath/ath9k/channel.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/ath/ath9k/channel.c b/drivers/net/wireless/ath/ath9k/channel.c
index c7234d5..89ef61a 100644
--- a/drivers/net/wireless/ath/ath9k/channel.c
+++ b/drivers/net/wireless/ath/ath9k/channel.c
@@ -900,6 +900,11 @@ void ath_offchannel_next(struct ath_softc *sc)
 		sc->offchannel.state = ATH_OFFCHANNEL_ROC_START;
 		ath_chanctx_offchan_switch(sc, sc->offchannel.roc_chan);
 	} else {
+		spin_lock_bh(&sc->chan_lock);
+		sc->sched.offchannel_pending = false;
+		sc->sched.wait_switch = false;
+		spin_unlock_bh(&sc->chan_lock);
+
 		ath_chanctx_switch(sc, ath_chanctx_get_oper_chan(sc, false),
 				   NULL);
 		sc->offchannel.state = ATH_OFFCHANNEL_IDLE;
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ath9k: Cancel pending offchannel operations [and 1 more messages]
  2014-11-01  7:04 ` [PATCH] ath9k: Cancel pending offchannel operations Sujith Manoharan
@ 2014-11-03  4:39   ` Sujith Manoharan
  0 siblings, 0 replies; 3+ messages in thread
From: Sujith Manoharan @ 2014-11-03  4:39 UTC (permalink / raw
  To: John Linville; +Cc: linux-wireless, ath9k-devel

Hi John,

Can you please hold off on these patches ?
I'll repost them after some more testing.

Sujith

Sujith Manoharan wrote:
> From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
> 
> In mgd_prepare_tx(), any pending HW scan is cancelled,
> but pending RoC operations are not cancelled. This
> results in a RoC request that never completes. For example,
> in a GO/STA setup, if p2p-find is initiated on an active GO
> interface wpa_s issues a RoC on the listen channel at the
> end of each scan run.
> 
> Enabling the station interface will force the station context
> and the earlier RoC is not cleared. Fix this by clearing all
> pending offchannel operations in mgd_prepare_tx().

Sujith Manoharan wrote:
> From: Sujith Manoharan <c_manoha@qca.qualcomm.com>
> 
> When a pending roc or scan operation is cancelled,
> the offchannel operation is cleared, but the offchannel
> state in the main scheduler is not cleared. This causes
> problems since an active GO will try to process a stale
> offchannel request that was deferred earlier. Fix this
> by clearing the state when there is no pending offchannel
> (roc/scan) operation.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-03  4:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-01  7:05 [PATCH] ath9k: Clear offchannel state properly Sujith Manoharan
2014-11-01  7:04 ` [PATCH] ath9k: Cancel pending offchannel operations Sujith Manoharan
2014-11-03  4:39   ` [PATCH] ath9k: Cancel pending offchannel operations [and 1 more messages] Sujith Manoharan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.