wifi: rtw89: fix HW scan not aborting properly
authorPo-Hao Huang <phhuang@realtek.com>
Fri, 17 May 2024 01:33:50 +0000 (09:33 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Thu, 23 May 2024 03:31:01 +0000 (11:31 +0800)
commit669b692247d4516e252c898c0e7366a09d84d1be
tree57091c69b24e58e896c048656f158dbe4c4f4e82
parent578bdd984f4562a47ec8d57742affd688688a0a3
wifi: rtw89: fix HW scan not aborting properly

There is a length limit on the commands we send to firmware, so
dividing to two commands is sometimes required when scanning.
When aborting scan, we should not send second scan command to
firmware after the first one is finished. This could cause some
unexpected errors when we cannot receive firmware events
(e.g. in suspend).

Another case is scan happens before suspending, ieee80211_do_stop() is
called to abort scan and driver indicate scan completion by
ieee80211_scan_completed(), which queues event to scan work. But scan work
might be late to execute after ieee80211_do_stop(). To correct this, driver
indicates ieee80211_scan_completed() before returning, so that
ieee80211_do_stop() can flush scan work properly.

Fixes: bcbefbd032df ("wifi: rtw89: add wait/completion for abort scan")
Cc: stable@vger.kernel.org
Co-developed-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://msgid.link/20240517013350.11278-1-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/fw.c
drivers/net/wireless/realtek/rtw89/mac.c