ACS: Remove redundant ch_list parameters from do_acs interface
Clean up do_acs interface to not pass ch_list to drivers as the same information is available in freq_list. The channel numbers are duplicated between 2.4 GHz and 5 GHz bands and the 6 GHz band. So, use the QCA_WLAN_VENDOR_ATTR_ACS_CH_LIST to populate only 2.4 GHz and 5 GHz channels to ensure backwards compatibility with old drivers which do not have support to decode the newer QCA_WLAN_VENDOR_ATTR_ACS_FREQ_LIST attribute. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
3cf360b8e2
commit
e86ba912aa
3 changed files with 46 additions and 18 deletions
|
@ -884,8 +884,6 @@ int hostapd_drv_do_acs(struct hostapd_data *hapd)
|
|||
{
|
||||
struct drv_acs_params params;
|
||||
int ret, i, acs_ch_list_all = 0;
|
||||
u8 *channels = NULL;
|
||||
unsigned int num_channels = 0;
|
||||
struct hostapd_hw_modes *mode;
|
||||
int *freq_list = NULL;
|
||||
|
||||
|
@ -904,10 +902,6 @@ int hostapd_drv_do_acs(struct hostapd_data *hapd)
|
|||
|
||||
mode = hapd->iface->current_mode;
|
||||
if (mode) {
|
||||
channels = os_malloc(mode->num_channels);
|
||||
if (channels == NULL)
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < mode->num_channels; i++) {
|
||||
struct hostapd_channel_data *chan = &mode->channels[i];
|
||||
if (!acs_ch_list_all &&
|
||||
|
@ -919,7 +913,6 @@ int hostapd_drv_do_acs(struct hostapd_data *hapd)
|
|||
(chan->flag & HOSTAPD_CHAN_RADAR))
|
||||
continue;
|
||||
if (!(chan->flag & HOSTAPD_CHAN_DISABLED)) {
|
||||
channels[num_channels++] = chan->chan;
|
||||
int_array_add_unique(&freq_list, chan->freq);
|
||||
}
|
||||
}
|
||||
|
@ -932,8 +925,6 @@ int hostapd_drv_do_acs(struct hostapd_data *hapd)
|
|||
}
|
||||
}
|
||||
|
||||
params.ch_list = channels;
|
||||
params.ch_list_len = num_channels;
|
||||
params.freq_list = freq_list;
|
||||
|
||||
params.ht_enabled = !!(hapd->iface->conf->ieee80211n);
|
||||
|
@ -959,7 +950,6 @@ int hostapd_drv_do_acs(struct hostapd_data *hapd)
|
|||
}
|
||||
|
||||
ret = hapd->driver->do_acs(hapd->drv_priv, ¶ms);
|
||||
os_free(channels);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -2192,9 +2192,7 @@ struct drv_acs_params {
|
|||
/* Configured ACS channel width */
|
||||
u16 ch_width;
|
||||
|
||||
/* ACS channel list info */
|
||||
unsigned int ch_list_len;
|
||||
const u8 *ch_list;
|
||||
/* ACS frequency list info */
|
||||
const int *freq_list;
|
||||
};
|
||||
|
||||
|
|
|
@ -10157,6 +10157,48 @@ static int hw_mode_to_qca_acs(enum hostapd_hw_mode hw_mode)
|
|||
}
|
||||
|
||||
|
||||
static int add_acs_ch_list(struct nl_msg *msg, const int *freq_list)
|
||||
{
|
||||
int num_channels = 0, num_freqs;
|
||||
u8 *ch_list;
|
||||
enum hostapd_hw_mode hw_mode;
|
||||
int ret = 0;
|
||||
int i;
|
||||
|
||||
if (!freq_list)
|
||||
return 0;
|
||||
|
||||
num_freqs = int_array_len(freq_list);
|
||||
ch_list = os_malloc(sizeof(u8) * num_freqs);
|
||||
if (!ch_list)
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < num_freqs; i++) {
|
||||
const int freq = freq_list[i];
|
||||
|
||||
if (freq == 0)
|
||||
break;
|
||||
/* Send 2.4 GHz and 5 GHz channels with
|
||||
* QCA_WLAN_VENDOR_ATTR_ACS_CH_LIST to maintain backwards
|
||||
* compatibility.
|
||||
*/
|
||||
if (!(freq >= 2412 && freq <= 2484) &&
|
||||
!(freq >= 5180 && freq <= 5900))
|
||||
continue;
|
||||
hw_mode = ieee80211_freq_to_chan(freq, &ch_list[num_channels]);
|
||||
if (hw_mode != NUM_HOSTAPD_MODES)
|
||||
num_channels++;
|
||||
}
|
||||
|
||||
if (num_channels)
|
||||
ret = nla_put(msg, QCA_WLAN_VENDOR_ATTR_ACS_CH_LIST,
|
||||
num_channels, ch_list);
|
||||
|
||||
os_free(ch_list);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int add_acs_freq_list(struct nl_msg *msg, const int *freq_list)
|
||||
{
|
||||
int i, len, ret;
|
||||
|
@ -10204,9 +10246,7 @@ static int wpa_driver_do_acs(void *priv, struct drv_acs_params *params)
|
|||
nla_put_flag(msg, QCA_WLAN_VENDOR_ATTR_ACS_VHT_ENABLED)) ||
|
||||
nla_put_u16(msg, QCA_WLAN_VENDOR_ATTR_ACS_CHWIDTH,
|
||||
params->ch_width) ||
|
||||
(params->ch_list_len &&
|
||||
nla_put(msg, QCA_WLAN_VENDOR_ATTR_ACS_CH_LIST, params->ch_list_len,
|
||||
params->ch_list)) ||
|
||||
add_acs_ch_list(msg, params->freq_list) ||
|
||||
add_acs_freq_list(msg, params->freq_list)) {
|
||||
nlmsg_free(msg);
|
||||
return -ENOBUFS;
|
||||
|
@ -10214,9 +10254,9 @@ static int wpa_driver_do_acs(void *priv, struct drv_acs_params *params)
|
|||
nla_nest_end(msg, data);
|
||||
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"nl80211: ACS Params: HW_MODE: %d HT: %d HT40: %d VHT: %d BW: %d CH_LIST_LEN: %u",
|
||||
"nl80211: ACS Params: HW_MODE: %d HT: %d HT40: %d VHT: %d BW: %d",
|
||||
params->hw_mode, params->ht_enabled, params->ht40_enabled,
|
||||
params->vht_enabled, params->ch_width, params->ch_list_len);
|
||||
params->vht_enabled, params->ch_width);
|
||||
|
||||
ret = send_and_recv_msgs(drv, msg, NULL, NULL);
|
||||
if (ret) {
|
||||
|
|
Loading…
Reference in a new issue