Skip to content

Commit 646870a

Browse files
joegatesgregkh
authored andcommitted
wcn36xx: Ensure finish scan is not requested before start scan
commit d195d7a upstream. If the operating channel is the first in the scan list, it was seen that a finish scan request would be sent before a start scan request was sent, causing the firmware to fail all future scans. Track the current channel being scanned to avoid requesting the scan finish before it starts. Cc: <stable@vger.kernel.org> Fixes: 5973a29 ("wcn36xx: Fix software-driven scan") Signed-off-by: Joseph Gates <jgates@squareup.com> Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/1629286303-13179-1-git-send-email-loic.poulain@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 4753723 commit 646870a

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎drivers/net/wireless/ath/wcn36xx/main.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,20 +405,22 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
405405
wcn36xx_dbg(WCN36XX_DBG_MAC, "wcn36xx_config channel switch=%d\n",
406406
ch);
407407

408-
if (wcn->sw_scan_opchannel == ch) {
408+
if (wcn->sw_scan_opchannel == ch && wcn->sw_scan_channel) {
409409
/* If channel is the initial operating channel, we may
410410
* want to receive/transmit regular data packets, then
411411
* simply stop the scan session and exit PS mode.
412412
*/
413413
wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN,
414414
wcn->sw_scan_vif);
415+
wcn->sw_scan_channel = 0;
415416
} else if (wcn->sw_scan) {
416417
/* A scan is ongoing, do not change the operating
417418
* channel, but start a scan session on the channel.
418419
*/
419420
wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN,
420421
wcn->sw_scan_vif);
421422
wcn36xx_smd_start_scan(wcn, ch);
423+
wcn->sw_scan_channel = ch;
422424
} else {
423425
wcn36xx_change_opchannel(wcn, ch);
424426
}
@@ -699,6 +701,7 @@ static void wcn36xx_sw_scan_start(struct ieee80211_hw *hw,
699701

700702
wcn->sw_scan = true;
701703
wcn->sw_scan_vif = vif;
704+
wcn->sw_scan_channel = 0;
702705
if (vif_priv->sta_assoc)
703706
wcn->sw_scan_opchannel = WCN36XX_HW_CHANNEL(wcn);
704707
else

‎drivers/net/wireless/ath/wcn36xx/wcn36xx.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ struct wcn36xx {
232232
struct cfg80211_scan_request *scan_req;
233233
bool sw_scan;
234234
u8 sw_scan_opchannel;
235+
u8 sw_scan_channel;
235236
struct ieee80211_vif *sw_scan_vif;
236237
struct mutex scan_lock;
237238
bool scan_aborted;

0 commit comments

Comments
 (0)