Re: [PATCH] rt2x00: save survey for every channel visited

From: Stanislaw Gruszka
Date: Tue Oct 20 2020 - 03:19:29 EST


On Mon, Oct 19, 2020 at 07:06:47PM +0000, Марков Михаил Александрович wrote:
> rt2800 only gives you survey for current channel.
<snip>
> .watchdog = rt2800_watchdog,
> + .update_survey = rt2800_update_survey,

Since this feature is rt2800 specific, I would do not add new generic
callback. It could be fully done in rt2800* code, i.e ...

> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
> index 8c6d3099b19d..8eff57132154 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
> @@ -1026,6 +1026,12 @@ static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev,
> if (!rates)
> goto exit_free_channels;
>
> + rt2x00dev->chan_survey =
> + kcalloc(spec->num_channels, sizeof(struct rt2x00_chan_survey),
> + GFP_KERNEL);
> + if (!rt2x00dev->chan_survey)
> + goto exit_free_rates;
... this could be placed in rt2800_probe_hw_mode() just after
channel info array allocation ...

> @@ -316,6 +316,15 @@ int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed)
> if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
> return 0;
>
> + /*
> + * To provide correct survey data for survey-based ACS algorithm
> + * we have to save survey data for current channel before switching.
> + */
> + if (rt2x00dev->ops->lib->update_survey &&
> + (changed & IEEE80211_CONF_CHANGE_CHANNEL)) {
... and this in rt2800_config()

Thanks
Stanislaw