diff mbox series

wifi: rtw89: fix HW scan abort not completed issue

Message ID 20240510130934.5825-1-pkshih@realtek.com (mailing list archive)
State Changes Requested
Delegated to: Ping-Ke Shih
Headers show
Series wifi: rtw89: fix HW scan abort not completed issue | expand

Commit Message

Ping-Ke Shih May 10, 2024, 1:09 p.m. UTC
From: Chih-Kang Chang <gary.chang@realtek.com>

When scan happens before suspending, rtw89_hw_scan_complete() might
happen after suspend flow. This causes the scan to be unable to
properly indicate scan completion to mac80211 before suspending. To
fix this issue, we modify to execute rtw89_hw_scan_complete() when
rtw89_hw_scan_abort() is called, regardless of result of
rtw89_hw_scan_offload().

Cc: stable@vger.kernel.org
Fixes: bcbefbd032df ("wifi: rtw89: add wait/completion for abort scan")
Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw89/fw.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Ping-Ke Shih May 14, 2024, 1:40 a.m. UTC | #1
Ping-Ke Shih <pkshih@realtek.com> wrote:

> From: Chih-Kang Chang <gary.chang@realtek.com>
> 
> When scan happens before suspending, rtw89_hw_scan_complete() might
> happen after suspend flow. This causes the scan to be unable to
> properly indicate scan completion to mac80211 before suspending. To
> fix this issue, we modify to execute rtw89_hw_scan_complete() when
> rtw89_hw_scan_abort() is called, regardless of result of
> rtw89_hw_scan_offload().
> 
> Cc: stable@vger.kernel.org
> Fixes: bcbefbd032df ("wifi: rtw89: add wait/completion for abort scan")
> Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>

It seems have better way to fix this problem. Drop this patch for now.
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
index 044a5b90c7f4..e9aa5bdeb5d7 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.c
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
@@ -6212,7 +6212,7 @@  void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif,
 		.aborted = aborted,
 	};
 
-	if (!vif)
+	if (!vif || !rtwdev->scanning)
 		return;
 
 	rtw89_write32_mask(rtwdev,
@@ -6245,7 +6245,9 @@  void rtw89_hw_scan_abort(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif)
 
 	ret = rtw89_hw_scan_offload(rtwdev, vif, false);
 	if (ret)
-		rtw89_hw_scan_complete(rtwdev, vif, true);
+		rtw89_warn(rtwdev, "rtw89_hw_scan_offload failed ret %d\n", ret);
+
+	rtw89_hw_scan_complete(rtwdev, vif, true);
 }
 
 static bool rtw89_is_any_vif_connected_or_connecting(struct rtw89_dev *rtwdev)