Linux-Wireless Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] wcn36xx: Ensure software scans scan on operational channel
@ 2020-07-29 23:15 Bryan O'Donoghue
  2020-07-30  7:13 ` Loic Poulain
  0 siblings, 1 reply; 2+ messages in thread
From: Bryan O'Donoghue @ 2020-07-29 23:15 UTC (permalink / raw)
  To: kvalo, loic.poulain; +Cc: wcn36xx, linux-wireless, bryan.odonoghue

We need to ensure that the operational channel is scanned, because if the
AP deauthenticates us for whatever reason, subsequent scans will not work.

This fixes an issue I'm seeing on wcn3680 where my AP de-authenticates my
device but on a subsequent scan of available channels the channel we were
initially connected to fails to show up. In this case I either need to
shift the AP to another channel or reboot the device.

Ensuring the operational channel is scanned means we can never get into
that situation.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/main.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index fb8978a3c11e..51fed732328e 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -416,17 +416,10 @@ 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 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, ch);
-		} else if (wcn->sw_scan) {
-			/* A scan is ongoing, do not change the operating
-			 * channel, but start a scan session on the channel.
-			 */
+		if (wcn->sw_scan) {
+			if (wcn->sw_scan_opchannel != ch)
+				wcn36xx_change_opchannel(wcn, ch);
+
 			wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN,
 					      wcn->sw_scan_vif);
 			wcn36xx_smd_start_scan(wcn, ch);
-- 
2.27.0


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

* Re: [PATCH] wcn36xx: Ensure software scans scan on operational channel
  2020-07-29 23:15 [PATCH] wcn36xx: Ensure software scans scan on operational channel Bryan O'Donoghue
@ 2020-07-30  7:13 ` Loic Poulain
  0 siblings, 0 replies; 2+ messages in thread
From: Loic Poulain @ 2020-07-30  7:13 UTC (permalink / raw)
  To: Bryan O'Donoghue; +Cc: Kalle Valo, wcn36xx, linux-wireless

Hi Bryan,

On Thu, 30 Jul 2020 at 01:14, Bryan O'Donoghue
<bryan.odonoghue@linaro.org> wrote:
>
> We need to ensure that the operational channel is scanned, because if the
> AP deauthenticates us for whatever reason, subsequent scans will not work.
>
> This fixes an issue I'm seeing on wcn3680 where my AP de-authenticates my
> device but on a subsequent scan of available channels the channel we were
> initially connected to fails to show up. In this case I either need to
> shift the AP to another channel or reboot the device.
>
> Ensuring the operational channel is scanned means we can never get into
> that situation.
>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  drivers/net/wireless/ath/wcn36xx/main.c | 15 ++++-----------
>  1 file changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
> index fb8978a3c11e..51fed732328e 100644
> --- a/drivers/net/wireless/ath/wcn36xx/main.c
> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
> @@ -416,17 +416,10 @@ 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 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, ch);
> -               } else if (wcn->sw_scan) {
> -                       /* A scan is ongoing, do not change the operating
> -                        * channel, but start a scan session on the channel.
> -                        */
> +               if (wcn->sw_scan) {
> +                       if (wcn->sw_scan_opchannel != ch)
> +                               wcn36xx_change_opchannel(wcn, ch);
> +
>                         wcn36xx_smd_init_scan(wcn, HAL_SYS_MODE_SCAN,
>                                               wcn->sw_scan_vif);
>                         wcn36xx_smd_start_scan(wcn, ch);

Interesting, on AP disconnect, the AP channel is preserved as the operating
channel, but since we are no more connected to the AP, the controller does
not report any received packet (beacon, probe response, etc...). So in that
case we indeed need to scan the channel as any other channel. In this
case your patch should work.

However, when we are connected to an AP while scanning, mac80211
interleaves regular channels scan with link monitoring in order to not
stale data transfer too long and prevent e.g. connection drop or latency
issues. I think this patch breaks connection monitoring in that case.

What could be done is to set sw_scan_opchannel to the current
operating channel only when we are connected to an AP and set
it to 0 otherwise. That should support both cases.

Regards,
Loic

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29 23:15 [PATCH] wcn36xx: Ensure software scans scan on operational channel Bryan O'Donoghue
2020-07-30  7:13 ` Loic Poulain

Linux-Wireless Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wireless/0 linux-wireless/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wireless linux-wireless/ https://lore.kernel.org/linux-wireless \
		linux-wireless@vger.kernel.org
	public-inbox-index linux-wireless

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wireless


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git