Skip to content

Commit d195d7a

Browse files
joegatesKalle Valo
authored andcommitted
wcn36xx: Ensure finish scan is not requested before start scan
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
1 parent e3f30ab commit d195d7a

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
@@ -408,20 +408,22 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
408408
wcn36xx_dbg(WCN36XX_DBG_MAC, "wcn36xx_config channel switch=%d\n",
409409
ch);
410410

411-
if (wcn->sw_scan_opchannel == ch) {
411+
if (wcn->sw_scan_opchannel == ch && wcn->sw_scan_channel) {
412412
/* If channel is the initial operating channel, we may
413413
* want to receive/transmit regular data packets, then
414414
* simply stop the scan session and exit PS mode.
415415
*/
416416
wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN,
417417
wcn->sw_scan_vif);
418+
wcn->sw_scan_channel = 0;
418419
} else if (wcn->sw_scan) {
419420
/* A scan is ongoing, do not change the operating
420421
* channel, but start a scan session on the channel.
421422
*/
422423
wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN,
423424
wcn->sw_scan_vif);
424425
wcn36xx_smd_start_scan(wcn, ch);
426+
wcn->sw_scan_channel = ch;
425427
} else {
426428
wcn36xx_change_opchannel(wcn, ch);
427429
}
@@ -702,6 +704,7 @@ static void wcn36xx_sw_scan_start(struct ieee80211_hw *hw,
702704

703705
wcn->sw_scan = true;
704706
wcn->sw_scan_vif = vif;
707+
wcn->sw_scan_channel = 0;
705708
if (vif_priv->sta_assoc)
706709
wcn->sw_scan_opchannel = WCN36XX_HW_CHANNEL(wcn);
707710
else

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ struct wcn36xx {
246246
struct cfg80211_scan_request *scan_req;
247247
bool sw_scan;
248248
u8 sw_scan_opchannel;
249+
u8 sw_scan_channel;
249250
struct ieee80211_vif *sw_scan_vif;
250251
struct mutex scan_lock;
251252
bool scan_aborted;

0 commit comments

Comments
 (0)