linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / 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 related	[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, other threads:[~2020-07-30  7:08 UTC | newest]

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

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).