stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wcn36xx: Ensure finish scan is not requested before start scan
@ 2021-08-18 11:31 Loic Poulain
  2021-08-18 12:54 ` Bryan O'Donoghue
  2021-08-29  7:10 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Loic Poulain @ 2021-08-18 11:31 UTC (permalink / raw)
  To: kvalo
  Cc: bryan.odonoghue, wcn36xx, linux-wireless, Joseph Gates, stable,
	Loic Poulain

From: Joseph Gates <jgates@squareup.com>

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: 5973a2947430 ("wcn36xx: Fix software-driven scan")
Signed-off-by: Joseph Gates <jgates@squareup.com>
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/main.c    | 5 ++++-
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index dabed4e..e8c772a 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -405,13 +405,14 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
 		wcn36xx_dbg(WCN36XX_DBG_MAC, "wcn36xx_config channel switch=%d\n",
 			    ch);
 
-		if (wcn->sw_scan_opchannel == ch) {
+		if (wcn->sw_scan_opchannel == ch && wcn->sw_scan_channel) {
 			/* If channel is the initial operating channel, we may
 			 * want to receive/transmit regular data packets, then
 			 * simply stop the scan session and exit PS mode.
 			 */
 			wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN,
 						wcn->sw_scan_vif);
+			wcn->sw_scan_channel = 0;
 		} else if (wcn->sw_scan) {
 			/* A scan is ongoing, do not change the operating
 			 * channel, but start a scan session on the channel.
@@ -419,6 +420,7 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
 			wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN,
 					      wcn->sw_scan_vif);
 			wcn36xx_smd_start_scan(wcn, ch);
+			wcn->sw_scan_channel = ch;
 		} else {
 			wcn36xx_change_opchannel(wcn, ch);
 		}
@@ -699,6 +701,7 @@ static void wcn36xx_sw_scan_start(struct ieee80211_hw *hw,
 
 	wcn->sw_scan = true;
 	wcn->sw_scan_vif = vif;
+	wcn->sw_scan_channel = 0;
 	if (vif_priv->sta_assoc)
 		wcn->sw_scan_opchannel = WCN36XX_HW_CHANNEL(wcn);
 	else
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index 71fa999..d0fcce8 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -232,6 +232,7 @@ struct wcn36xx {
 	struct cfg80211_scan_request *scan_req;
 	bool			sw_scan;
 	u8			sw_scan_opchannel;
+	u8			sw_scan_channel;
 	struct ieee80211_vif	*sw_scan_vif;
 	struct mutex		scan_lock;
 	bool			scan_aborted;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] wcn36xx: Ensure finish scan is not requested before start scan
  2021-08-18 11:31 [PATCH] wcn36xx: Ensure finish scan is not requested before start scan Loic Poulain
@ 2021-08-18 12:54 ` Bryan O'Donoghue
  2021-08-29  7:10 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Bryan O'Donoghue @ 2021-08-18 12:54 UTC (permalink / raw)
  To: Loic Poulain, kvalo; +Cc: wcn36xx, linux-wireless, Joseph Gates, stable

On 18/08/2021 12:31, Loic Poulain wrote:
> From: Joseph Gates <jgates@squareup.com>
> 
> 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: 5973a2947430 ("wcn36xx: Fix software-driven scan")
> Signed-off-by: Joseph Gates <jgates@squareup.com>
> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> ---
>   drivers/net/wireless/ath/wcn36xx/main.c    | 5 ++++-
>   drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 +
>   2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
> index dabed4e..e8c772a 100644
> --- a/drivers/net/wireless/ath/wcn36xx/main.c
> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
> @@ -405,13 +405,14 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
>   		wcn36xx_dbg(WCN36XX_DBG_MAC, "wcn36xx_config channel switch=%d\n",
>   			    ch);
>   
> -		if (wcn->sw_scan_opchannel == ch) {
> +		if (wcn->sw_scan_opchannel == ch && wcn->sw_scan_channel) {
>   			/* If channel is the initial operating channel, we may
>   			 * want to receive/transmit regular data packets, then
>   			 * simply stop the scan session and exit PS mode.
>   			 */
>   			wcn36xx_smd_finish_scan(wcn, HAL_SYS_MODE_SCAN,
>   						wcn->sw_scan_vif);
> +			wcn->sw_scan_channel = 0;
>   		} else if (wcn->sw_scan) {
>   			/* A scan is ongoing, do not change the operating
>   			 * channel, but start a scan session on the channel.
> @@ -419,6 +420,7 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
>   			wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN,
>   					      wcn->sw_scan_vif);
>   			wcn36xx_smd_start_scan(wcn, ch);
> +			wcn->sw_scan_channel = ch;
>   		} else {
>   			wcn36xx_change_opchannel(wcn, ch);
>   		}
> @@ -699,6 +701,7 @@ static void wcn36xx_sw_scan_start(struct ieee80211_hw *hw,
>   
>   	wcn->sw_scan = true;
>   	wcn->sw_scan_vif = vif;
> +	wcn->sw_scan_channel = 0;
>   	if (vif_priv->sta_assoc)
>   		wcn->sw_scan_opchannel = WCN36XX_HW_CHANNEL(wcn);
>   	else
> diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
> index 71fa999..d0fcce8 100644
> --- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
> +++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
> @@ -232,6 +232,7 @@ struct wcn36xx {
>   	struct cfg80211_scan_request *scan_req;
>   	bool			sw_scan;
>   	u8			sw_scan_opchannel;
> +	u8			sw_scan_channel;
>   	struct ieee80211_vif	*sw_scan_vif;
>   	struct mutex		scan_lock;
>   	bool			scan_aborted;
> 

LGTM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] wcn36xx: Ensure finish scan is not requested before start scan
  2021-08-18 11:31 [PATCH] wcn36xx: Ensure finish scan is not requested before start scan Loic Poulain
  2021-08-18 12:54 ` Bryan O'Donoghue
@ 2021-08-29  7:10 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2021-08-29  7:10 UTC (permalink / raw)
  To: Loic Poulain
  Cc: bryan.odonoghue, wcn36xx, linux-wireless, Joseph Gates, stable,
	Loic Poulain

Loic Poulain <loic.poulain@linaro.org> wrote:

> 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: 5973a2947430 ("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>

Patch applied to ath-next branch of ath.git, thanks.

d195d7aac09b wcn36xx: Ensure finish scan is not requested before start scan

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/1629286303-13179-1-git-send-email-loic.poulain@linaro.org/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-29  7:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 11:31 [PATCH] wcn36xx: Ensure finish scan is not requested before start scan Loic Poulain
2021-08-18 12:54 ` Bryan O'Donoghue
2021-08-29  7:10 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).