diff mbox series

wcn36xx: Ensure software scans scan on operational channel

Message ID 20200729231538.3965043-1-bryan.odonoghue@linaro.org
State New
Headers show
Series wcn36xx: Ensure software scans scan on operational channel | expand

Commit Message

Bryan O'Donoghue July 29, 2020, 11:15 p.m. UTC
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(-)

-- 
2.27.0

Comments

Loic Poulain July 30, 2020, 7:13 a.m. UTC | #1
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
diff mbox series

Patch

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