Historical ath9k-devel archives
 help / color / mirror / Atom feed
* [ath9k-devel] [PATCH] ath10k: fix hw scan cancelling
@ 2013-05-22  6:42 Michal Kazior
  2013-05-28 13:58 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Kazior @ 2013-05-22  6:42 UTC (permalink / raw)
  To: ath9k-devel

If mac80211 decides to cancel a hw scan and FW is
not behaving properly (i.e.  doesn't want to abort
scan at all) we must call
ieee80211_scan_completed(). Otherwise no more
scans will be initiated, ever.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 2412161..34df005 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1524,7 +1524,7 @@ void ath10k_reset_scan(unsigned long ptr)
 	spin_unlock_bh(&ar->data_lock);
 }
 
-static void ath10k_abort_scan(struct ath10k *ar)
+static int ath10k_abort_scan(struct ath10k *ar)
 {
 	struct wmi_stop_scan_arg arg = {
 		.req_id = 1, /* FIXME */
@@ -1540,15 +1540,17 @@ static void ath10k_abort_scan(struct ath10k *ar)
 	spin_lock_bh(&ar->data_lock);
 	if (!ar->scan.in_progress) {
 		spin_unlock_bh(&ar->data_lock);
-		return;
+		return 0;
 	}
 
 	ar->scan.aborting = true;
 	spin_unlock_bh(&ar->data_lock);
 
 	ret = ath10k_wmi_stop_scan(ar, &arg);
-	if (ret)
+	if (ret) {
 		ath10k_warn("could not submit wmi stop scan (%d)\n", ret);
+		return -EIO;
+	}
 
 	ath10k_wmi_flush_tx(ar);
 
@@ -1556,13 +1558,22 @@ static void ath10k_abort_scan(struct ath10k *ar)
 	if (ret == 0)
 		ath10k_warn("timed out while waiting for scan to stop\n");
 
+	/* scan completion may be done right after we timeout here, so let's
+	 * check the in_progress and tell mac80211 scan is completed. if we
+	 * don't do that and FW fails to send us scan completion indication
+	 * then userspace won't be able to scan anymore */
+	ret = 0;
+
 	spin_lock_bh(&ar->data_lock);
 	if (ar->scan.in_progress) {
 		ath10k_warn("could not stop scan. its still in progress\n");
 		ar->scan.in_progress = false;
 		ath10k_offchan_tx_purge(ar);
+		ret = -ETIMEDOUT;
 	}
 	spin_unlock_bh(&ar->data_lock);
+
+	return ret;
 }
 
 static int ath10k_start_scan(struct ath10k *ar,
@@ -2175,9 +2186,15 @@ static void ath10k_cancel_hw_scan(struct ieee80211_hw *hw,
 				  struct ieee80211_vif *vif)
 {
 	struct ath10k *ar = hw->priv;
+	int ret;
 
 	mutex_lock(&ar->conf_mutex);
-	ath10k_abort_scan(ar);
+	ret = ath10k_abort_scan(ar);
+	if (ret) {
+		ath10k_warn("couldn't abort scan (%d). forcefully sending scan completion to mac80211\n",
+			    ret);
+		ieee80211_scan_completed(hw, 1 /* aborted */);
+	}
 	mutex_unlock(&ar->conf_mutex);
 }
 
-- 
1.7.9.5

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

end of thread, other threads:[~2013-05-28 13:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-22  6:42 [ath9k-devel] [PATCH] ath10k: fix hw scan cancelling Michal Kazior
2013-05-28 13:58 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox