]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
ACS: Populate channel config from external ACS per documented behavior
authorVamsi Krishna <vamsin@codeaurora.com>
Tue, 24 Dec 2019 12:01:39 +0000 (17:31 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 9 Jan 2020 18:22:12 +0000 (20:22 +0200)
Based on the now documented seg0/seg1 values from offloaded ACS, there
is a mismatch between the driver interface and internal hostapd use.

The value of segment0 field in ACS results is the index of the channel
center frequency for 20 MHz, 40 MHz, and 80M Hz channels. The value is
the center frequency index of the primary 80 MHz segment for 160 MHz and
80+80 MHz channels.

The value of segment1 field in ACS results is zero for 20 MHz, 40 MHz,
and 80 MHz channels. The value is the index of the channel center
frequency for 160 MHz channels and the center frequency index of the
secondary 80 MHz segment for 80+80 MHz channels.

However, in struct hostapd_config, for 160 MHz channels, the value of
the segment0 field is the index of the channel center frequency of 160
MHz channel and the value of the segment1 field is zero. Map the values
from ACS event into hostapd_config fields accordingly.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/ap/drv_callbacks.c

index 8a4b0ef6aebd9bf8868e9d7344b48459e0b79be1..fdd8455738cf6ffd650a7d63fff03002f5e991fc 100644 (file)
@@ -1010,27 +1010,28 @@ void hostapd_acs_channel_selected(struct hostapd_data *hapd,
                hostapd_set_oper_centr_freq_seg1_idx(hapd->iconf, 0);
                hostapd_set_oper_centr_freq_seg0_idx(hapd->iconf, 0);
                hostapd_set_oper_chwidth(hapd->iconf, CHANWIDTH_USE_HT);
-               if (acs_res->ch_width == 80) {
-                       hostapd_set_oper_centr_freq_seg0_idx(
-                               hapd->iconf, acs_res->vht_seg0_center_ch);
-                       hostapd_set_oper_chwidth(hapd->iconf, CHANWIDTH_80MHZ);
-               } else if (acs_res->ch_width == 160) {
-                       if (acs_res->vht_seg1_center_ch == 0) {
+               if (acs_res->ch_width == 40) {
+                       if (is_6ghz_freq(acs_res->pri_freq))
                                hostapd_set_oper_centr_freq_seg0_idx(
                                        hapd->iconf,
                                        acs_res->vht_seg0_center_ch);
+               } else if (acs_res->ch_width == 80) {
+                       hostapd_set_oper_centr_freq_seg0_idx(
+                               hapd->iconf, acs_res->vht_seg0_center_ch);
+                       if (acs_res->vht_seg1_center_ch == 0) {
                                hostapd_set_oper_chwidth(hapd->iconf,
-                                                        CHANWIDTH_160MHZ);
+                                                        CHANWIDTH_80MHZ);
                        } else {
-                               hostapd_set_oper_centr_freq_seg0_idx(
-                                       hapd->iconf,
-                                       acs_res->vht_seg0_center_ch);
+                               hostapd_set_oper_chwidth(hapd->iconf,
+                                                        CHANWIDTH_80P80MHZ);
                                hostapd_set_oper_centr_freq_seg1_idx(
                                        hapd->iconf,
                                        acs_res->vht_seg1_center_ch);
-                               hostapd_set_oper_chwidth(hapd->iconf,
-                                                        CHANWIDTH_80P80MHZ);
                        }
+               } else if (acs_res->ch_width == 160) {
+                       hostapd_set_oper_chwidth(hapd->iconf, CHANWIDTH_160MHZ);
+                       hostapd_set_oper_centr_freq_seg0_idx(
+                               hapd->iconf, acs_res->vht_seg1_center_ch);
                }
        }