linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] ath11k: add handler for scan event WMI_SCAN_EVENT_DEQUEUED
@ 2021-09-14 16:42 Jouni Malinen
  2021-09-14 16:42 ` [PATCH 2/3] ath11k: indicate scan complete for scan canceled when scan running Jouni Malinen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jouni Malinen @ 2021-09-14 16:42 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath11k, linux-wireless, Wen Gong, Jouni Malinen

From: Wen Gong <wgong@codeaurora.org>

When wlan interface is up, 11d scan is sent to the firmware, and the
firmware needs to spend couple of seconds to complete the 11d scan. If
immediately a normal scan from user space arrives to ath11k, then the
normal scan request is also sent to the firmware, but the scan started
event will be reported to ath11k until the 11d scan complete. When timed
out for the scan started in ath11k, ath11k stops the normal scan and the
firmware reports WMI_SCAN_EVENT_DEQUEUED to ath11k for the normal scan.
ath11k has no handler for the event and then timed out for the scan
completed in ath11k_scan_stop(), and ath11k prints the following error
message.

[ 1491.604750] ath11k_pci 0000:02:00.0: failed to receive scan abort comple: timed out
[ 1491.604756] ath11k_pci 0000:02:00.0: failed to stop scan: -110
[ 1491.604758] ath11k_pci 0000:02:00.0: failed to start hw scan: -110

Add a handler for WMI_SCAN_EVENT_DEQUEUED and then complete the scan to
get rid of the above error message.

Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1

Signed-off-by: Wen Gong <wgong@codeaurora.org>
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/wmi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index ec46e06aace9..d11022455d97 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -6370,6 +6370,8 @@ static void ath11k_scan_event(struct ath11k_base *ab, struct sk_buff *skb)
 		ath11k_wmi_event_scan_start_failed(ar);
 		break;
 	case WMI_SCAN_EVENT_DEQUEUED:
+		__ath11k_mac_scan_finish(ar);
+		break;
 	case WMI_SCAN_EVENT_PREEMPTED:
 	case WMI_SCAN_EVENT_RESTARTED:
 	case WMI_SCAN_EVENT_FOREIGN_CHAN_EXIT:
-- 
2.25.1


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

* [PATCH 2/3] ath11k: indicate scan complete for scan canceled when scan running
  2021-09-14 16:42 [PATCH 1/3] ath11k: add handler for scan event WMI_SCAN_EVENT_DEQUEUED Jouni Malinen
@ 2021-09-14 16:42 ` Jouni Malinen
  2021-09-14 16:42 ` [PATCH 3/3] ath11k: indicate to mac80211 scan complete with aborted flag for ATH11K_SCAN_STARTING state Jouni Malinen
  2021-09-28 13:57 ` [PATCH 1/3] ath11k: add handler for scan event WMI_SCAN_EVENT_DEQUEUED Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Jouni Malinen @ 2021-09-14 16:42 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath11k, linux-wireless, Wen Gong, Jouni Malinen

From: Wen Gong <wgong@codeaurora.org>

ath11k prints "Received scan event for unknown vdev" when doing the
following test:
1. trigger scan
2. wait 0.2 second
3. iw reg set or 11d scan complete from firmware

Reason: When iw reg set or 11d scan complete, the new country code will
be set to the firmware, and the new regdomain info indicated to ath11k,
then the new channel list will be sent to the firmware. The firmware
will cancel the current scan after receiving WMI_SCAN_CHAN_LIST_CMDID
which is used for the new channel list, and the state of ath11k is
ATH11K_SCAN_RUNNING, then ath11k_get_ar_on_scan_abort() returns NULL and
ath11k_scan_event() returns at this point and does not indicate scan
completion to mac80211.

Indicate scan completion to mac80211 and get rid of the "Received scan
event for unknown vdev" print for the above case.

Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1

Signed-off-by: Wen Gong <wgong@codeaurora.org>
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/wmi.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index d11022455d97..613362b28d8e 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -6289,8 +6289,9 @@ static void ath11k_mgmt_tx_compl_event(struct ath11k_base *ab, struct sk_buff *s
 	rcu_read_unlock();
 }
 
-static struct ath11k *ath11k_get_ar_on_scan_abort(struct ath11k_base *ab,
-						  u32 vdev_id)
+static struct ath11k *ath11k_get_ar_on_scan_state(struct ath11k_base *ab,
+						  u32 vdev_id,
+						  enum ath11k_scan_state state)
 {
 	int i;
 	struct ath11k_pdev *pdev;
@@ -6302,7 +6303,7 @@ static struct ath11k *ath11k_get_ar_on_scan_abort(struct ath11k_base *ab,
 			ar = pdev->ar;
 
 			spin_lock_bh(&ar->data_lock);
-			if (ar->scan.state == ATH11K_SCAN_ABORTING &&
+			if (ar->scan.state == state &&
 			    ar->scan.vdev_id == vdev_id) {
 				spin_unlock_bh(&ar->data_lock);
 				return ar;
@@ -6332,10 +6333,15 @@ static void ath11k_scan_event(struct ath11k_base *ab, struct sk_buff *skb)
 	 * 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
+	    scan_ev.reason == WMI_SCAN_REASON_CANCELLED) {
+		ar = ath11k_get_ar_on_scan_state(ab, scan_ev.vdev_id,
+						 ATH11K_SCAN_ABORTING);
+		if (!ar)
+			ar = ath11k_get_ar_on_scan_state(ab, scan_ev.vdev_id,
+							 ATH11K_SCAN_RUNNING);
+	} else {
 		ar = ath11k_mac_get_ar_by_vdev_id(ab, scan_ev.vdev_id);
+	}
 
 	if (!ar) {
 		ath11k_warn(ab, "Received scan event for unknown vdev");
-- 
2.25.1


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

* [PATCH 3/3] ath11k: indicate to mac80211 scan complete with aborted flag for ATH11K_SCAN_STARTING state
  2021-09-14 16:42 [PATCH 1/3] ath11k: add handler for scan event WMI_SCAN_EVENT_DEQUEUED Jouni Malinen
  2021-09-14 16:42 ` [PATCH 2/3] ath11k: indicate scan complete for scan canceled when scan running Jouni Malinen
@ 2021-09-14 16:42 ` Jouni Malinen
  2021-09-28 13:57 ` [PATCH 1/3] ath11k: add handler for scan event WMI_SCAN_EVENT_DEQUEUED Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Jouni Malinen @ 2021-09-14 16:42 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath11k, linux-wireless, Wen Gong, Jouni Malinen

From: Wen Gong <wgong@codeaurora.org>

Scan failure can not be recovered from when running a loop of the
following steps:
1. run scan: "iw wlan scan".
2. run command: echo assert > /sys/kernel/debug/ath11k/qca6490\ hw2.0/simulate_fw_crash
   immediately after step 1.

result:
scan failed and can not recover even when wlan recovery succeeds:
command failed: Device or resource busy (-16)

reason:
When scan arrives, WMI_START_SCAN_CMDID is sent to the firmware and
function ath11k_mac_op_hw_scan() returns, then simulate_fw_crash arrives
and the scan started event does not arrive, and then it starts to do
recovery of wlan. __ath11k_mac_scan_finish() which is called from
ath11k_core_halt() is one step of recovery, it will not call
ieee80211_scan_completed() by logic currently because the scan state is
ATH11K_SCAN_STARTING. Thus it leads the scan not being completed in
mac80211, and leads all consecutive scans failing with -EBUSY in
nl80211_trigger_scan even after wlan recovery success.

Indicate scan complete with aborted flag to mac80211 for
ATH11K_SCAN_STARTING to allow recovery from scan failed with "Device or
resource busy (-16)" after wlan recovery.

Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1

Signed-off-by: Wen Gong <wgong@codeaurora.org>
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/mac.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 97a2c92b7b9b..e015b22b8dbf 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -2985,18 +2985,21 @@ void __ath11k_mac_scan_finish(struct ath11k *ar)
 		break;
 	case ATH11K_SCAN_RUNNING:
 	case ATH11K_SCAN_ABORTING:
+		if (ar->scan.is_roc && ar->scan.roc_notify)
+			ieee80211_remain_on_channel_expired(ar->hw);
+		fallthrough;
+	case ATH11K_SCAN_STARTING:
 		if (!ar->scan.is_roc) {
 			struct cfg80211_scan_info info = {
-				.aborted = (ar->scan.state ==
-					    ATH11K_SCAN_ABORTING),
+				.aborted = ((ar->scan.state ==
+					    ATH11K_SCAN_ABORTING) ||
+					    (ar->scan.state ==
+					    ATH11K_SCAN_STARTING)),
 			};
 
 			ieee80211_scan_completed(ar->hw, &info);
-		} else if (ar->scan.roc_notify) {
-			ieee80211_remain_on_channel_expired(ar->hw);
 		}
-		fallthrough;
-	case ATH11K_SCAN_STARTING:
+
 		ar->scan.state = ATH11K_SCAN_IDLE;
 		ar->scan_channel = NULL;
 		ar->scan.roc_freq = 0;
-- 
2.25.1


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

* Re: [PATCH 1/3] ath11k: add handler for scan event WMI_SCAN_EVENT_DEQUEUED
  2021-09-14 16:42 [PATCH 1/3] ath11k: add handler for scan event WMI_SCAN_EVENT_DEQUEUED Jouni Malinen
  2021-09-14 16:42 ` [PATCH 2/3] ath11k: indicate scan complete for scan canceled when scan running Jouni Malinen
  2021-09-14 16:42 ` [PATCH 3/3] ath11k: indicate to mac80211 scan complete with aborted flag for ATH11K_SCAN_STARTING state Jouni Malinen
@ 2021-09-28 13:57 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2021-09-28 13:57 UTC (permalink / raw)
  To: Jouni Malinen; +Cc: ath11k, linux-wireless, Wen Gong, Jouni Malinen

Jouni Malinen <jouni@codeaurora.org> wrote:

> When wlan interface is up, 11d scan is sent to the firmware, and the
> firmware needs to spend couple of seconds to complete the 11d scan. If
> immediately a normal scan from user space arrives to ath11k, then the
> normal scan request is also sent to the firmware, but the scan started
> event will be reported to ath11k until the 11d scan complete. When timed
> out for the scan started in ath11k, ath11k stops the normal scan and the
> firmware reports WMI_SCAN_EVENT_DEQUEUED to ath11k for the normal scan.
> ath11k has no handler for the event and then timed out for the scan
> completed in ath11k_scan_stop(), and ath11k prints the following error
> message.
> 
> [ 1491.604750] ath11k_pci 0000:02:00.0: failed to receive scan abort comple: timed out
> [ 1491.604756] ath11k_pci 0000:02:00.0: failed to stop scan: -110
> [ 1491.604758] ath11k_pci 0000:02:00.0: failed to start hw scan: -110
> 
> Add a handler for WMI_SCAN_EVENT_DEQUEUED and then complete the scan to
> get rid of the above error message.
> 
> Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
> 
> Signed-off-by: Wen Gong <wgong@codeaurora.org>
> Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

3 patches applied to ath-next branch of ath.git, thanks.

441b3b5911f8 ath11k: add handler for scan event WMI_SCAN_EVENT_DEQUEUED
c677d4b1bcc4 ath11k: indicate scan complete for scan canceled when scan running
62db14ea95b1 ath11k: indicate to mac80211 scan complete with aborted flag for ATH11K_SCAN_STARTING state

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20210914164226.38843-1-jouni@codeaurora.org/

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


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14 16:42 [PATCH 1/3] ath11k: add handler for scan event WMI_SCAN_EVENT_DEQUEUED Jouni Malinen
2021-09-14 16:42 ` [PATCH 2/3] ath11k: indicate scan complete for scan canceled when scan running Jouni Malinen
2021-09-14 16:42 ` [PATCH 3/3] ath11k: indicate to mac80211 scan complete with aborted flag for ATH11K_SCAN_STARTING state Jouni Malinen
2021-09-28 13:57 ` [PATCH 1/3] ath11k: add handler for scan event WMI_SCAN_EVENT_DEQUEUED Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).