aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnkita Bajaj <bankita@codeaurora.org>2019-11-19 13:11:34 (GMT)
committerJouni Malinen <j@w1.fi>2019-12-05 16:02:34 (GMT)
commite86ba912aa885663bcec407bcfed22ff75c2476b (patch)
tree9bbb6a74ce7dedcd4bce6ae727aa1937b11657c3
parent3cf360b8e24b7056fda31a7d80a0a0981085b048 (diff)
downloadhostap-e86ba912aa885663bcec407bcfed22ff75c2476b.zip
hostap-e86ba912aa885663bcec407bcfed22ff75c2476b.tar.gz
hostap-e86ba912aa885663bcec407bcfed22ff75c2476b.tar.bz2
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>
-rw-r--r--src/ap/ap_drv_ops.c10
-rw-r--r--src/drivers/driver.h4
-rw-r--r--src/drivers/driver_nl80211.c50
3 files changed, 46 insertions, 18 deletions
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
index 204274f..dcc4fdc 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -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, &params);
- os_free(channels);
return ret;
}
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index ad68a07..c6b7db8 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -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;
};
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 4c8dcad..02b9527 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -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) {