wifi: ath12k: report an aborted scan before cancel_hw_scan returns
PATCH 1/1 wifi: ath12k: report an aborted scan before cancel_hw_scan returns
Suspending while a hardware scan is running makes mac80211 warn on resume:
phy0: resume with hardware scan still in progress
WARNING: net/mac80211/ieee80211_i.h:2444 at ieee80211_resume+0x60/0x6c [mac80211] Call trace: ieee80211_resume+0x60/0x6c [mac80211] (P) wiphy_resume+0x84/0xdc [cfg80211] dpm_run_callback+0x40/0x124 device_resume+0x154/0x1f8
__ieee80211_suspend() cancels the scan with ieee80211_scan_cancel(), which for a hardware scan only calls the cancel_hw_scan() callback and leaves it to the driver to call ieee80211_scan_completed(). ath12k_mac_op_cancel_hw_scan() waits for the firmware to stop the scan, but ieee80211_scan_completed() is called from scan.vdev_clean_wk. That is a wiphy work, and wiphy_suspend() has already run the pending wiphy works before calling into mac80211, so the work only runs after the resume and mac80211 finds the scan neither completed nor aborted.
Flush the work in ath12k_mac_op_cancel_hw_scan(), as ath12k_mac_op_cancel_remain_on_channel() already does.
Tested-on: WCN7850 hw2.0 PCI WLAN.GNG.1.0-03342-QCAGNGSWPL_V1.0_V2.0_SILICONZ-1.81206.153
---
Reproduced with "iw dev wlp1s0 scan trigger" followed 0.3 s, 1 s and 2.5 s later by "rtcwake -m freeze -s 20" on a OnePlus Pad 3 (SM8750, WCN7880 hw2.0), associated to an AP:
without the patch 3/3 suspends warn
with the patch 0/3
After the runs with the patch the interface is still associated and a new scan returns results.
I tested on a 7.3-rc5 based tree with out-of-tree patches for this device. The function is the same in ath-next; I applied the patch there but did not build or run that tree.
I used an AI assistant (Claude) for the analysis and to draft this patch and its description; I reviewed the result and ran the tests on my device.
drivers/net/wireless/ath/ath12k/mac.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ath/ath12k/mac.c +1 -0
@@ -5875,6 +5875,7 @@ void ath12k_mac_op_cancel_hw_scan(struct ieee80211_hw *hw,ath12k_scan_abort (ar);cancel_delayed_work_sync (&ar->scan.timeout); +wiphy_work_flush (hw->wiphy, &ar->scan.vdev_clean_wk); } }EXPORT_SYMBOL (ath12k_mac_op_cancel_hw_scan);
base-commit: d0fbb39d65dc9dcb4175fa6b23e473dec3670f4d
Signature · 1 line
2.43.0