All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath11k: Fix error received while aborting hw scan
@ 2019-05-27 13:15 Sriram R
  2019-05-29 15:12 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Sriram R @ 2019-05-27 13:15 UTC (permalink / raw)
  To: ath11k; +Cc: Sriram R

Set the appropriate scan cancel request param while stopping
the hw scan. Also, when a interface is stopped, the SDATA_STATE_RUNNING
flag will be cleared before cancelling the scan, hence
the interface can't be found in active interfaces in corresponding
scan cancellation event. Hence search the corresponding 'ar'
by iterating through the active pdev's if the scan state is aborting.

This will avoid 'failed to stop wmi scan' error received
while aborting the scan.

Signed-off-by: Sriram R <srirrama@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/mac.c |  2 +-
 drivers/net/wireless/ath/ath11k/wmi.c | 38 ++++++++++++++++++++++++++++++++++-
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index cb0de8e..1d2c14c 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -1857,7 +1857,7 @@ void ath11k_scan_finish(struct ath11k *ar)
 static int ath11k_scan_stop(struct ath11k *ar)
 {
 	struct scan_cancel_param arg = {
-		.req_type = WMI_SCAN_STOP_ONE,
+		.req_type = WLAN_SCAN_CANCEL_SINGLE,
 		.scan_id = ATH11K_SCAN_ID,
 	};
 	int ret;
diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index 90d9560..6ca3887 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -5261,6 +5261,30 @@ void ath11k_mgmt_tx_compl_event(struct ath11k_base *ab, struct sk_buff *skb)
 	rcu_read_unlock();
 }
 
+static struct ath11k *ath11k_get_ar_on_scan_abort(struct ath11k_base *ab,
+						  u32 vdev_id)
+{
+	int i;
+	struct ath11k_pdev *pdev;
+	struct ath11k *ar;
+
+	for (i = 0; i < ab->num_radios; i++) {
+		pdev = rcu_dereference(ab->pdevs_active[i]);
+		if (pdev && pdev->ar) {
+			ar = pdev->ar;
+
+			spin_lock_bh(&ar->data_lock);
+			if (ar->scan.state == ATH11K_SCAN_ABORTING &&
+			    ar->scan.vdev_id == vdev_id) {
+				spin_unlock_bh(&ar->data_lock);
+				return ar;
+			}
+			spin_unlock_bh(&ar->data_lock);
+		}
+	}
+	return NULL;
+}
+
 void ath11k_scan_event(struct ath11k_base *ab, u8 *evt_buf, u32 len)
 {
 	struct ath11k *ar;
@@ -5273,7 +5297,19 @@ void ath11k_scan_event(struct ath11k_base *ab, u8 *evt_buf, u32 len)
 	}
 
 	rcu_read_lock();
-	ar = ath11k_get_ar_by_vdev_id(ab, scan_ev.vdev_id);
+
+	/* In case the scan was cancelled, ex. during interface teardown,
+	 * the interface will not be found in active interfaces.
+	 * Rather, in such scenarios, iterate over the active pdev's to
+	 * search 'ar' if the corresponding 'ar' scan is ABORTING and the
+	 * aborting scan's vdev id matches this event info.
+	 */
+	if (scan_ev.event_type == WMI_SCAN_EVENT_COMPLETED &&
+	    scan_ev.reason == WMI_SCAN_REASON_CANCELLED)
+		ar = ath11k_get_ar_on_scan_abort(ab, scan_ev.vdev_id);
+	else
+		ar = ath11k_get_ar_by_vdev_id(ab, scan_ev.vdev_id);
+
 	if (!ar) {
 		ath11k_warn(ab, "Received scan event for unknown vdev");
 		rcu_read_unlock();
-- 
2.7.4


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

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

* Re: [PATCH] ath11k: Fix error received while aborting hw scan
  2019-05-27 13:15 [PATCH] ath11k: Fix error received while aborting hw scan Sriram R
@ 2019-05-29 15:12 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2019-05-29 15:12 UTC (permalink / raw)
  To: Sriram R; +Cc: ath11k

Sriram R <srirrama@codeaurora.org> wrote:

> Set the appropriate scan cancel request param while stopping
> the hw scan. Also, when a interface is stopped, the SDATA_STATE_RUNNING
> flag will be cleared before cancelling the scan, hence
> the interface can't be found in active interfaces in corresponding
> scan cancellation event. Hence search the corresponding 'ar'
> by iterating through the active pdev's if the scan state is aborting.
> 
> This will avoid 'failed to stop wmi scan' error received
> while aborting the scan.
> 
> Signed-off-by: Sriram R <srirrama@codeaurora.org>

Failed to apply, please rebase.

fatal: sha1 information is lacking or useless (drivers/net/wireless/ath/ath11k/wmi.c).
error: could not build fake ancestor
Applying: ath11k: Fix error received while aborting hw scan
Patch failed at 0001 ath11k: Fix error received while aborting hw scan
The copy of the patch that failed is found in: .git/rebase-apply/patch

Patch set to Changes Requested.

-- 
https://patchwork.kernel.org/patch/10963039/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

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

end of thread, other threads:[~2019-05-29 15:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-27 13:15 [PATCH] ath11k: Fix error received while aborting hw scan Sriram R
2019-05-29 15:12 ` Kalle Valo

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.