[PATCH] wcn36xx: Don't run scan_init multiple times

Loic Poulain loic.poulain at linaro.org
Fri Nov 20 03:12:22 EST 2020


On Fri, 20 Nov 2020 at 03:13, Bryan O'Donoghue
<bryan.odonoghue at linaro.org> wrote:
>
> Run scan_init only once. There's no need to run this command multiple times
> if it has already been run once.
>
> The software scan algorithm can end up repeatedly calling scan_init on each
> loop resulting in between four and eight milliseconds of lost time on each
> callout.
>
> Subtract the overhead now.

This command defines parameters like the BSSID we want to inform,
etc... So this can change depending on the scan is done while
connected or not. Moreover in the connected case, the scans are
interleaved with normal data listening period, and AFAIU, init/stop
scan allow to submit a null data packet with PS/non-PS bit when
mac80211 leaves the operating channel to scanning another one (so that
AP does no submit packet to it). So at first glance, this patch would
break that, right?



>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue at linaro.org>
> ---
>  drivers/net/wireless/ath/wcn36xx/smd.c     | 6 ++++++
>  drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 +
>  2 files changed, 7 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
> index acf533fae46a..ec082cf3ab09 100644
> --- a/drivers/net/wireless/ath/wcn36xx/smd.c
> +++ b/drivers/net/wireless/ath/wcn36xx/smd.c
> @@ -706,6 +706,10 @@ int wcn36xx_smd_init_scan(struct wcn36xx *wcn, enum wcn36xx_hal_sys_mode mode,
>         int ret;
>
>         mutex_lock(&wcn->hal_mutex);
> +       if (wcn->scan_init) {
> +               ret = 0;
> +               goto out;
> +       }
>         INIT_HAL_MSG(msg_body, WCN36XX_HAL_INIT_SCAN_REQ);
>
>         msg_body.mode = mode;
> @@ -731,6 +735,7 @@ int wcn36xx_smd_init_scan(struct wcn36xx *wcn, enum wcn36xx_hal_sys_mode mode,
>                 wcn36xx_err("hal_init_scan response failed err=%d\n", ret);
>                 goto out;
>         }
> +       wcn->scan_init = true;
>  out:
>         mutex_unlock(&wcn->hal_mutex);
>         return ret;
> @@ -761,6 +766,7 @@ int wcn36xx_smd_start_scan(struct wcn36xx *wcn, u8 scan_channel)
>                 wcn36xx_err("hal_start_scan response failed err=%d\n", ret);
>                 goto out;
>         }
> +       wcn->scan_init = false;
>  out:
>         mutex_unlock(&wcn->hal_mutex);
>         return ret;
> diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
> index 71fa9992b118..156df6d184c8 100644
> --- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
> +++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
> @@ -235,6 +235,7 @@ struct wcn36xx {
>         struct ieee80211_vif    *sw_scan_vif;
>         struct mutex            scan_lock;
>         bool                    scan_aborted;
> +       bool                    scan_init;
>
>         /* DXE channels */
>         struct wcn36xx_dxe_ch   dxe_tx_l_ch;    /* TX low */
> --
> 2.28.0
>



More information about the wcn36xx mailing list