]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Move CHANWIDTH_* definitions from ieee80211_defs.h to defs.h
authorAleti Nageshwar Reddy <quic_anageshw@quicinc.com>
Fri, 13 May 2022 16:17:40 +0000 (21:47 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 20 Jun 2022 11:39:18 +0000 (14:39 +0300)
Move most of CHANWIDTH_* definitions from ieee80211_defs.h to defs.h as
the definitions are getting used mostly for internal purpose only. Also
change prefix of the definitions to CONF_OPER_CHWIDTH_* and update in
all the files accordingly.

Leave the couple of VHT-specific exceptions to use the old defines (the
reason why they were originally added as VHT values), to avoid use of
clearly marked configuration values in information elements. In
addition, use the defines instead of magic values where appropriate.

Signed-off-by: Aleti Nageshwar Reddy <quic_anageshw@quicinc.com>
31 files changed:
hostapd/hostapd.conf
src/ap/acs.c
src/ap/ap_config.h
src/ap/ap_drv_ops.c
src/ap/beacon.c
src/ap/dfs.c
src/ap/drv_callbacks.c
src/ap/hostapd.c
src/ap/hw_features.c
src/ap/ieee802_11.c
src/ap/ieee802_11_eht.c
src/ap/ieee802_11_he.c
src/ap/ieee802_11_shared.c
src/ap/ieee802_11_vht.c
src/ap/neighbor_db.c
src/common/defs.h
src/common/hw_features_common.c
src/common/hw_features_common.h
src/common/ieee802_11_common.c
src/common/ieee802_11_common.h
src/common/ieee802_11_defs.h
wpa_supplicant/ap.c
wpa_supplicant/config.c
wpa_supplicant/config_ssid.h
wpa_supplicant/ctrl_iface.c
wpa_supplicant/mesh.c
wpa_supplicant/op_classes.c
wpa_supplicant/p2p_supplicant.c
wpa_supplicant/rrm.c
wpa_supplicant/wnm_sta.c
wpa_supplicant/wpa_supplicant.c

index f37d5634b1b5c63d80a5e3ca364f1dd15bde923d..6b4223fff8573e4b75eab23b1cbc6023e805c1f5 100644 (file)
@@ -871,7 +871,7 @@ wmm_ac_vo_acm=0
 # he_oper_chwidth is ignored, and the channel width is derived from the
 # configured operating class or center frequency indexes (see
 # IEEE P802.11ax/D6.1 Annex E, Table E-4).
-#he_oper_chwidth
+#he_oper_chwidth (see vht_oper_chwidth)
 #he_oper_centr_freq_seg0_idx
 #he_oper_centr_freq_seg1_idx
 
@@ -1021,7 +1021,7 @@ wmm_ac_vo_acm=0
 # In the 6 GHz band, eht_oper_chwidth is ignored and the channel width is
 # derived from the configured operating class (IEEE P802.11be/D1.5,
 # Annex E.1 - Country information and operating classes).
-#eht_oper_chwidth
+#eht_oper_chwidth (see vht_oper_chwidth)
 #eht_oper_centr_freq_seg0_idx
 
 ##### IEEE 802.1X-2004 related configuration ##################################
index faaedbfdb0d91acea15c60e5bf16be60d5471019..7708bc28397495c3ab61b896107834a47058ec01 100644 (file)
@@ -710,7 +710,7 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface,
                if (mode->mode == HOSTAPD_MODE_IEEE80211A &&
                    (iface->conf->ieee80211ac || iface->conf->ieee80211ax)) {
                        if (hostapd_get_oper_chwidth(iface->conf) ==
-                           CHANWIDTH_80MHZ &&
+                           CONF_OPER_CHWIDTH_80MHZ &&
                            !acs_usable_bw80_chan(chan)) {
                                wpa_printf(MSG_DEBUG,
                                           "ACS: Channel %d: not allowed as primary channel for 80 MHz bandwidth",
@@ -719,7 +719,7 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface,
                        }
 
                        if (hostapd_get_oper_chwidth(iface->conf) ==
-                           CHANWIDTH_160MHZ &&
+                           CONF_OPER_CHWIDTH_160MHZ &&
                            !acs_usable_bw160_chan(chan)) {
                                wpa_printf(MSG_DEBUG,
                                           "ACS: Channel %d: not allowed as primary channel for 160 MHz bandwidth",
@@ -873,12 +873,14 @@ acs_find_ideal_chan(struct hostapd_iface *iface)
 
        if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) {
                switch (hostapd_get_oper_chwidth(iface->conf)) {
-               case CHANWIDTH_80MHZ:
+               case CONF_OPER_CHWIDTH_80MHZ:
                        n_chans = 4;
                        break;
-               case CHANWIDTH_160MHZ:
+               case CONF_OPER_CHWIDTH_160MHZ:
                        n_chans = 8;
                        break;
+               default:
+                       break;
                }
        }
 
@@ -915,13 +917,13 @@ static void acs_adjust_center_freq(struct hostapd_iface *iface)
        wpa_printf(MSG_DEBUG, "ACS: Adjusting VHT center frequency");
 
        switch (hostapd_get_oper_chwidth(iface->conf)) {
-       case CHANWIDTH_USE_HT:
+       case CONF_OPER_CHWIDTH_USE_HT:
                offset = 2 * iface->conf->secondary_channel;
                break;
-       case CHANWIDTH_80MHZ:
+       case CONF_OPER_CHWIDTH_80MHZ:
                offset = 6;
                break;
-       case CHANWIDTH_160MHZ:
+       case CONF_OPER_CHWIDTH_160MHZ:
                offset = 14;
                break;
        default:
index 805ea93df7317eaed44c7bf38e1cf2db47cac29f..876a1bbd9310b020d6c95e97d8b2c0c807dd85ee 100644 (file)
@@ -1048,7 +1048,7 @@ struct hostapd_config {
        u32 vht_capab;
        int ieee80211ac;
        int require_vht;
-       u8 vht_oper_chwidth;
+       enum oper_chan_width vht_oper_chwidth;
        u8 vht_oper_centr_freq_seg0_idx;
        u8 vht_oper_centr_freq_seg1_idx;
        u8 ht40_plus_minus_allowed;
@@ -1092,7 +1092,7 @@ struct hostapd_config {
        struct he_operation he_op;
        struct ieee80211_he_mu_edca_parameter_set he_mu_edca;
        struct spatial_reuse spr;
-       u8 he_oper_chwidth;
+       enum oper_chan_width he_oper_chwidth;
        u8 he_oper_centr_freq_seg0_idx;
        u8 he_oper_centr_freq_seg1_idx;
        u8 he_6ghz_max_mpdu;
@@ -1130,7 +1130,7 @@ struct hostapd_config {
 
        int ieee80211be;
 #ifdef CONFIG_IEEE80211BE
-       u8 eht_oper_chwidth;
+       enum oper_chan_width eht_oper_chwidth;
        u8 eht_oper_centr_freq_seg0_idx;
        struct eht_phy_capabilities_info eht_phy_capab;
 #endif /* CONFIG_IEEE80211BE */
@@ -1142,7 +1142,8 @@ struct hostapd_config {
 };
 
 
-static inline u8 hostapd_get_oper_chwidth(struct hostapd_config *conf)
+static inline enum oper_chan_width
+hostapd_get_oper_chwidth(struct hostapd_config *conf)
 {
 #ifdef CONFIG_IEEE80211BE
        if (conf->ieee80211be)
@@ -1156,7 +1157,8 @@ static inline u8 hostapd_get_oper_chwidth(struct hostapd_config *conf)
 }
 
 static inline void
-hostapd_set_oper_chwidth(struct hostapd_config *conf, u8 oper_chwidth)
+hostapd_set_oper_chwidth(struct hostapd_config *conf,
+                        enum oper_chan_width oper_chwidth)
 {
 #ifdef CONFIG_IEEE80211BE
        if (conf->ieee80211be)
index 8af7a0e2563fd5bf62016c14791a3657203947a3..a7079f6abfc44daa445415d6eed2b6654e95ce86 100644 (file)
@@ -978,12 +978,13 @@ int hostapd_drv_do_acs(struct hostapd_data *hapd)
             hapd->iface->conf->ieee80211ax ||
             hapd->iface->conf->ieee80211ac) &&
            params.ht40_enabled) {
-               u8 oper_chwidth = hostapd_get_oper_chwidth(hapd->iface->conf);
+               enum oper_chan_width oper_chwidth;
 
-               if (oper_chwidth == CHANWIDTH_80MHZ)
+               oper_chwidth = hostapd_get_oper_chwidth(hapd->iface->conf);
+               if (oper_chwidth == CONF_OPER_CHWIDTH_80MHZ)
                        params.ch_width = 80;
-               else if (oper_chwidth == CHANWIDTH_160MHZ ||
-                        oper_chwidth == CHANWIDTH_80P80MHZ)
+               else if (oper_chwidth == CONF_OPER_CHWIDTH_160MHZ ||
+                        oper_chwidth == CONF_OPER_CHWIDTH_80P80MHZ)
                        params.ch_width = 160;
        }
 
index 58872bfdab71da3dca1d0e597bb4e7c4653917e8..86765705ab3272cb8c52e4090c3cfd5b6fa1b56b 100644 (file)
@@ -1280,22 +1280,24 @@ static u16 hostapd_fils_discovery_cap(struct hostapd_data *hapd)
                }
        } else {
                switch (hostapd_get_oper_chwidth(hapd->iconf)) {
-               case CHANWIDTH_80P80MHZ:
+               case CONF_OPER_CHWIDTH_80P80MHZ:
                        mcs_nss_size += 4;
                        /* fallthrough */
-               case CHANWIDTH_160MHZ:
+               case CONF_OPER_CHWIDTH_160MHZ:
                        mcs_nss_size += 4;
                        chwidth = FD_CAP_BSS_CHWIDTH_160_80_80;
                        break;
-               case CHANWIDTH_80MHZ:
+               case CONF_OPER_CHWIDTH_80MHZ:
                        chwidth = FD_CAP_BSS_CHWIDTH_80;
                        break;
-               case CHANWIDTH_USE_HT:
+               case CONF_OPER_CHWIDTH_USE_HT:
                        if (hapd->iconf->secondary_channel)
                                chwidth = FD_CAP_BSS_CHWIDTH_40;
                        else
                                chwidth = FD_CAP_BSS_CHWIDTH_20;
                        break;
+               default:
+                       break;
                }
 
 #ifdef CONFIG_IEEE80211AX
index e46dd7ede3b82d5fd333f9023cdcbfb3d2dd7c27..146dd1ada51d1d7b8dc0152db94b7bb31f0770af 100644 (file)
@@ -50,15 +50,15 @@ static int dfs_get_used_n_chans(struct hostapd_iface *iface, int *seg1)
 
        if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) {
                switch (hostapd_get_oper_chwidth(iface->conf)) {
-               case CHANWIDTH_USE_HT:
+               case CONF_OPER_CHWIDTH_USE_HT:
                        break;
-               case CHANWIDTH_80MHZ:
+               case CONF_OPER_CHWIDTH_80MHZ:
                        n_chans = 4;
                        break;
-               case CHANWIDTH_160MHZ:
+               case CONF_OPER_CHWIDTH_160MHZ:
                        n_chans = 8;
                        break;
-               case CHANWIDTH_80P80MHZ:
+               case CONF_OPER_CHWIDTH_80P80MHZ:
                        n_chans = 4;
                        *seg1 = 4;
                        break;
@@ -311,7 +311,7 @@ static void dfs_adjust_center_freq(struct hostapd_iface *iface,
        *oper_centr_freq_seg1_idx = 0;
 
        switch (hostapd_get_oper_chwidth(iface->conf)) {
-       case CHANWIDTH_USE_HT:
+       case CONF_OPER_CHWIDTH_USE_HT:
                if (secondary_channel == 1)
                        *oper_centr_freq_seg0_idx = chan->chan + 2;
                else if (secondary_channel == -1)
@@ -319,13 +319,13 @@ static void dfs_adjust_center_freq(struct hostapd_iface *iface,
                else
                        *oper_centr_freq_seg0_idx = chan->chan;
                break;
-       case CHANWIDTH_80MHZ:
+       case CONF_OPER_CHWIDTH_80MHZ:
                *oper_centr_freq_seg0_idx = chan->chan + 6;
                break;
-       case CHANWIDTH_160MHZ:
+       case CONF_OPER_CHWIDTH_160MHZ:
                *oper_centr_freq_seg0_idx = chan->chan + 14;
                break;
-       case CHANWIDTH_80P80MHZ:
+       case CONF_OPER_CHWIDTH_80P80MHZ:
                *oper_centr_freq_seg0_idx = chan->chan + 6;
                *oper_centr_freq_seg1_idx = sec_chan_idx_80p80 + 6;
                break;
@@ -361,17 +361,17 @@ static int dfs_get_start_chan_idx(struct hostapd_iface *iface, int *seg1_start)
        /* VHT/HE */
        if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) {
                switch (hostapd_get_oper_chwidth(iface->conf)) {
-               case CHANWIDTH_USE_HT:
+               case CONF_OPER_CHWIDTH_USE_HT:
                        break;
-               case CHANWIDTH_80MHZ:
+               case CONF_OPER_CHWIDTH_80MHZ:
                        channel_no = hostapd_get_oper_centr_freq_seg0_idx(
                                iface->conf) - 6;
                        break;
-               case CHANWIDTH_160MHZ:
+               case CONF_OPER_CHWIDTH_160MHZ:
                        channel_no = hostapd_get_oper_centr_freq_seg0_idx(
                                iface->conf) - 14;
                        break;
-               case CHANWIDTH_80P80MHZ:
+               case CONF_OPER_CHWIDTH_80P80MHZ:
                        channel_no = hostapd_get_oper_centr_freq_seg0_idx(
                                iface->conf) - 6;
                        chan_seg1 = hostapd_get_oper_centr_freq_seg1_idx(
@@ -555,7 +555,8 @@ dfs_get_valid_channel(struct hostapd_iface *iface,
                *secondary_channel = 0;
 
        /* Get secondary channel for HT80P80 */
-       if (hostapd_get_oper_chwidth(iface->conf) == CHANWIDTH_80P80MHZ) {
+       if (hostapd_get_oper_chwidth(iface->conf) ==
+           CONF_OPER_CHWIDTH_80P80MHZ) {
                if (num_available_chandefs <= 1) {
                        wpa_printf(MSG_ERROR,
                                   "only 1 valid chan, can't support 80+80");
@@ -1220,7 +1221,7 @@ dfs_downgrade_bandwidth(struct hostapd_iface *iface, int *secondary_channel,
                        int oper_chwidth;
 
                        oper_chwidth = hostapd_get_oper_chwidth(iface->conf);
-                       if (oper_chwidth == CHANWIDTH_USE_HT)
+                       if (oper_chwidth == CONF_OPER_CHWIDTH_USE_HT)
                                break;
                        *channel_type = DFS_AVAILABLE;
                        hostapd_set_oper_chwidth(iface->conf, oper_chwidth - 1);
index fff8bb3e5f39568d7a4421b7e378d56080f112e2..4b321a9b929e889058e81e5f67ad0a6a9b4a5e73 100644 (file)
@@ -891,19 +891,19 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
 
        switch (width) {
        case CHAN_WIDTH_80:
-               chwidth = CHANWIDTH_80MHZ;
+               chwidth = CONF_OPER_CHWIDTH_80MHZ;
                break;
        case CHAN_WIDTH_80P80:
-               chwidth = CHANWIDTH_80P80MHZ;
+               chwidth = CONF_OPER_CHWIDTH_80P80MHZ;
                break;
        case CHAN_WIDTH_160:
-               chwidth = CHANWIDTH_160MHZ;
+               chwidth = CONF_OPER_CHWIDTH_160MHZ;
                break;
        case CHAN_WIDTH_20_NOHT:
        case CHAN_WIDTH_20:
        case CHAN_WIDTH_40:
        default:
-               chwidth = CHANWIDTH_USE_HT;
+               chwidth = CONF_OPER_CHWIDTH_USE_HT;
                break;
        }
 
@@ -979,10 +979,10 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
        hostapd_set_oper_centr_freq_seg1_idx(hapd->iconf, seg1_idx);
        if (hapd->iconf->ieee80211ac) {
                hapd->iconf->vht_capab &= ~VHT_CAP_SUPP_CHAN_WIDTH_MASK;
-               if (chwidth == CHANWIDTH_160MHZ)
+               if (chwidth == CONF_OPER_CHWIDTH_160MHZ)
                        hapd->iconf->vht_capab |=
                                VHT_CAP_SUPP_CHAN_WIDTH_160MHZ;
-               else if (chwidth == CHANWIDTH_80P80MHZ)
+               else if (chwidth == CONF_OPER_CHWIDTH_80P80MHZ)
                        hapd->iconf->vht_capab |=
                                VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ;
        }
@@ -1145,7 +1145,7 @@ void hostapd_acs_channel_selected(struct hostapd_data *hapd,
                /* set defaults for backwards compatibility */
                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);
+               hostapd_set_oper_chwidth(hapd->iconf, CONF_OPER_CHWIDTH_USE_HT);
                if (acs_res->ch_width == 40) {
                        if (is_6ghz_freq(acs_res->pri_freq))
                                hostapd_set_oper_centr_freq_seg0_idx(
@@ -1155,17 +1155,19 @@ void hostapd_acs_channel_selected(struct hostapd_data *hapd,
                        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_80MHZ);
+                               hostapd_set_oper_chwidth(
+                                       hapd->iconf, CONF_OPER_CHWIDTH_80MHZ);
                        } else {
-                               hostapd_set_oper_chwidth(hapd->iconf,
-                                                        CHANWIDTH_80P80MHZ);
+                               hostapd_set_oper_chwidth(
+                                       hapd->iconf,
+                                       CONF_OPER_CHWIDTH_80P80MHZ);
                                hostapd_set_oper_centr_freq_seg1_idx(
                                        hapd->iconf,
                                        acs_res->vht_seg1_center_ch);
                        }
                } else if (acs_res->ch_width == 160) {
-                       hostapd_set_oper_chwidth(hapd->iconf, CHANWIDTH_160MHZ);
+                       hostapd_set_oper_chwidth(hapd->iconf,
+                                                CONF_OPER_CHWIDTH_160MHZ);
                        hostapd_set_oper_centr_freq_seg0_idx(
                                hapd->iconf, acs_res->vht_seg1_center_ch);
                }
index f6fe8a8a03b522d7302c6b7b11b94153c99e5aed..f6e45274b2b8ee06f4c3a17f3c9213deabedb508 100644 (file)
@@ -1718,7 +1718,7 @@ static int setup_interface2(struct hostapd_iface *iface)
                        goto fail;
 
                if (iface->conf->op_class) {
-                       int ch_width;
+                       enum oper_chan_width ch_width;
 
                        ch_width = op_class_to_ch_width(iface->conf->op_class);
                        hostapd_set_oper_chwidth(iface->conf, ch_width);
@@ -3503,16 +3503,18 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd,
        case 0:
        case 20:
        case 40:
-               hostapd_set_oper_chwidth(conf, CHANWIDTH_USE_HT);
+               hostapd_set_oper_chwidth(conf, CONF_OPER_CHWIDTH_USE_HT);
                break;
        case 80:
                if (params->center_freq2)
-                       hostapd_set_oper_chwidth(conf, CHANWIDTH_80P80MHZ);
+                       hostapd_set_oper_chwidth(conf,
+                                                CONF_OPER_CHWIDTH_80P80MHZ);
                else
-                       hostapd_set_oper_chwidth(conf, CHANWIDTH_80MHZ);
+                       hostapd_set_oper_chwidth(conf,
+                                                CONF_OPER_CHWIDTH_80MHZ);
                break;
        case 160:
-               hostapd_set_oper_chwidth(conf, CHANWIDTH_160MHZ);
+               hostapd_set_oper_chwidth(conf, CONF_OPER_CHWIDTH_160MHZ);
                break;
        default:
                return -1;
@@ -3550,15 +3552,15 @@ static int hostapd_fill_csa_settings(struct hostapd_data *hapd,
        switch (settings->freq_params.bandwidth) {
        case 80:
                if (settings->freq_params.center_freq2)
-                       bandwidth = CHANWIDTH_80P80MHZ;
+                       bandwidth = CONF_OPER_CHWIDTH_80P80MHZ;
                else
-                       bandwidth = CHANWIDTH_80MHZ;
+                       bandwidth = CONF_OPER_CHWIDTH_80MHZ;
                break;
        case 160:
-               bandwidth = CHANWIDTH_160MHZ;
+               bandwidth = CONF_OPER_CHWIDTH_160MHZ;
                break;
        default:
-               bandwidth = CHANWIDTH_USE_HT;
+               bandwidth = CONF_OPER_CHWIDTH_USE_HT;
                break;
        }
 
@@ -3688,7 +3690,8 @@ void
 hostapd_switch_channel_fallback(struct hostapd_iface *iface,
                                const struct hostapd_freq_params *freq_params)
 {
-       int seg0_idx = 0, seg1_idx = 0, bw = CHANWIDTH_USE_HT;
+       int seg0_idx = 0, seg1_idx = 0;
+       enum oper_chan_width bw = CONF_OPER_CHWIDTH_USE_HT;
 
        wpa_printf(MSG_DEBUG, "Restarting all CSA-related BSSes");
 
@@ -3701,16 +3704,16 @@ hostapd_switch_channel_fallback(struct hostapd_iface *iface,
        case 0:
        case 20:
        case 40:
-               bw = CHANWIDTH_USE_HT;
+               bw = CONF_OPER_CHWIDTH_USE_HT;
                break;
        case 80:
                if (freq_params->center_freq2)
-                       bw = CHANWIDTH_80P80MHZ;
+                       bw = CONF_OPER_CHWIDTH_80P80MHZ;
                else
-                       bw = CHANWIDTH_80MHZ;
+                       bw = CONF_OPER_CHWIDTH_80MHZ;
                break;
        case 160:
-               bw = CHANWIDTH_160MHZ;
+               bw = CONF_OPER_CHWIDTH_160MHZ;
                break;
        default:
                wpa_printf(MSG_WARNING, "Unknown CSA bandwidth: %d",
index 4b66b02f4e16073196a78e924adefef962bebd88..cbd65921997026500d08e6f4d1f6bd1e32267124 100644 (file)
@@ -371,7 +371,7 @@ static void ieee80211n_check_scan(struct hostapd_iface *iface)
                iface->conf->secondary_channel = 0;
                hostapd_set_oper_centr_freq_seg0_idx(iface->conf, 0);
                hostapd_set_oper_centr_freq_seg1_idx(iface->conf, 0);
-               hostapd_set_oper_chwidth(iface->conf, CHANWIDTH_USE_HT);
+               hostapd_set_oper_chwidth(iface->conf, CONF_OPER_CHWIDTH_USE_HT);
                res = 1;
                wpa_printf(MSG_INFO, "Fallback to 20 MHz");
        }
index aa26ad4effd92ab4e6baed8e01d557a126c12ed7..8806a585aad70a8580e1e05badbbe29f5685827f 100644 (file)
@@ -7033,7 +7033,7 @@ u8 * hostapd_eid_txpower_envelope(struct hostapd_data *hapd, u8 *eid)
 #endif /* CONFIG_IEEE80211AX */
 
        switch (hostapd_get_oper_chwidth(iconf)) {
-       case CHANWIDTH_USE_HT:
+       case CONF_OPER_CHWIDTH_USE_HT:
                if (iconf->secondary_channel == 0) {
                        /* Max Transmit Power count = 0 (20 MHz) */
                        tx_pwr_count = 0;
@@ -7042,12 +7042,12 @@ u8 * hostapd_eid_txpower_envelope(struct hostapd_data *hapd, u8 *eid)
                        tx_pwr_count = 1;
                }
                break;
-       case CHANWIDTH_80MHZ:
+       case CONF_OPER_CHWIDTH_80MHZ:
                /* Max Transmit Power count = 2 (20, 40, and 80 MHz) */
                tx_pwr_count = 2;
                break;
-       case CHANWIDTH_80P80MHZ:
-       case CHANWIDTH_160MHZ:
+       case CONF_OPER_CHWIDTH_80P80MHZ:
+       case CONF_OPER_CHWIDTH_160MHZ:
                /* Max Transmit Power count = 3 (20, 40, 80, 160/80+80 MHz) */
                tx_pwr_count = 3;
                break;
index 0b7454f3ec5b2bed70d5ec710332e4d2c2091d9e..547ccd3296f5f57b49e232bc6455318e093163cc 100644 (file)
@@ -176,7 +176,8 @@ u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid)
 {
        struct hostapd_config *conf = hapd->iconf;
        struct ieee80211_eht_operation *oper;
-       u8 *pos = eid, chwidth, seg0 = 0, seg1 = 0;
+       u8 *pos = eid, seg0 = 0, seg1 = 0;
+       enum oper_chan_width chwidth;
 
        if (!hapd->iface->current_mode)
                return eid;
@@ -207,7 +208,7 @@ u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid)
                        seg0 += 16;
                break;
 #endif
-       case CHANWIDTH_160MHZ:
+       case CONF_OPER_CHWIDTH_160MHZ:
                oper->oper_info.control |= EHT_OPER_CHANNEL_WIDTH_160MHZ;
                seg1 = seg0;
                if (hapd->iconf->channel < seg0)
@@ -215,10 +216,10 @@ u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid)
                else
                        seg0 += 8;
                break;
-       case CHANWIDTH_80MHZ:
+       case CONF_OPER_CHWIDTH_80MHZ:
                oper->oper_info.control |= EHT_OPER_CHANNEL_WIDTH_80MHZ;
                break;
-       case CHANWIDTH_USE_HT:
+       case CONF_OPER_CHWIDTH_USE_HT:
                if (seg0)
                        oper->oper_info.control |= EHT_OPER_CHANNEL_WIDTH_40MHZ;
                break;
@@ -286,10 +287,12 @@ static bool check_valid_eht_mcs(struct hostapd_data *hapd,
 
        switch (hapd->iface->conf->eht_oper_chwidth) {
        /* TODO: CHANWIDTH_320MHZ */
-       case CHANWIDTH_80P80MHZ:
-       case CHANWIDTH_160MHZ:
+       case CONF_OPER_CHWIDTH_80P80MHZ:
+       case CONF_OPER_CHWIDTH_160MHZ:
                mcs_count = 2;
                break;
+       default:
+               break;
        }
 
        return check_valid_eht_mcs_nss(hapd, ap_mcs, sta_mcs, mcs_count,
index 1e74c5845cf06c0943b5b77a3fe65c175118a6ca..e9be2d3ede989e04bddc25813c089debac1db0a4 100644 (file)
@@ -102,20 +102,22 @@ u8 * hostapd_eid_he_capab(struct hostapd_data *hapd, u8 *eid,
                                           mode->he_capab[opmode].phy_cap);
 
        switch (hapd->iface->conf->he_oper_chwidth) {
-       case CHANWIDTH_80P80MHZ:
+       case CONF_OPER_CHWIDTH_80P80MHZ:
                he_oper_chwidth |=
                        HE_PHYCAP_CHANNEL_WIDTH_SET_80PLUS80MHZ_IN_5G;
                mcs_nss_size += 4;
                /* fall through */
-       case CHANWIDTH_160MHZ:
+       case CONF_OPER_CHWIDTH_160MHZ:
                he_oper_chwidth |= HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G;
                mcs_nss_size += 4;
                /* fall through */
-       case CHANWIDTH_80MHZ:
-       case CHANWIDTH_USE_HT:
+       case CONF_OPER_CHWIDTH_80MHZ:
+       case CONF_OPER_CHWIDTH_USE_HT:
                he_oper_chwidth |= HE_PHYCAP_CHANNEL_WIDTH_SET_40MHZ_IN_2G |
                        HE_PHYCAP_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G;
                break;
+       default:
+               break;
        }
 
        ie_size += mcs_nss_size + ppet_size;
@@ -430,10 +432,10 @@ static int check_valid_he_mcs(struct hostapd_data *hapd, const u8 *sta_he_capab,
         * band/stream cases.
         */
        switch (hapd->iface->conf->he_oper_chwidth) {
-       case CHANWIDTH_80P80MHZ:
+       case CONF_OPER_CHWIDTH_80P80MHZ:
                mcs_count = 3;
                break;
-       case CHANWIDTH_160MHZ:
+       case CONF_OPER_CHWIDTH_160MHZ:
                mcs_count = 2;
                break;
        default:
index 615489511a2a2756a89fbf2f207e682118589962..4e7c33eea9a34dba2ae9923655f4c9c1c6b94f42 100644 (file)
@@ -998,7 +998,7 @@ int get_tx_parameters(struct sta_info *sta, int ap_max_chanwidth,
                 * If a VHT Operation element was present, use it to determine
                 * the supported channel bandwidth.
                 */
-               if (oper->vht_op_info_chwidth == 0) {
+               if (oper->vht_op_info_chwidth == CHANWIDTH_USE_HT) {
                        requested_bw = ht_40mhz ? 40 : 20;
                } else if (oper->vht_op_info_chan_center_freq_seg1_idx == 0) {
                        requested_bw = 80;
index 828f0abb5aad6446057fb30401b4ad150f43e55d..681b6d78f51384d506750ba31c897f3f81daae65 100644 (file)
@@ -96,12 +96,12 @@ u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid)
                hapd->iconf->vht_oper_centr_freq_seg1_idx;
 
        oper->vht_op_info_chwidth = hapd->iconf->vht_oper_chwidth;
-       if (hapd->iconf->vht_oper_chwidth == 2) {
+       if (hapd->iconf->vht_oper_chwidth == CONF_OPER_CHWIDTH_160MHZ) {
                /*
                 * Convert 160 MHz channel width to new style as interop
                 * workaround.
                 */
-               oper->vht_op_info_chwidth = 1;
+               oper->vht_op_info_chwidth = CHANWIDTH_80MHZ;
                oper->vht_op_info_chan_center_freq_seg1_idx =
                        oper->vht_op_info_chan_center_freq_seg0_idx;
                if (hapd->iconf->channel <
@@ -109,12 +109,13 @@ u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid)
                        oper->vht_op_info_chan_center_freq_seg0_idx -= 8;
                else
                        oper->vht_op_info_chan_center_freq_seg0_idx += 8;
-       } else if (hapd->iconf->vht_oper_chwidth == 3) {
+       } else if (hapd->iconf->vht_oper_chwidth ==
+                  CONF_OPER_CHWIDTH_80P80MHZ) {
                /*
                 * Convert 80+80 MHz channel width to new style as interop
                 * workaround.
                 */
-               oper->vht_op_info_chwidth = 1;
+               oper->vht_op_info_chwidth = CHANWIDTH_80MHZ;
        }
 
        /* VHT Basic MCS set comes from hw */
index e37324f3d9f1182049209a1c029f1cd9a7650c1e..52f25eb7afb12f0798760c7cca5e23c2ac54cc9c 100644 (file)
@@ -199,19 +199,21 @@ void hostapd_free_neighbor_db(struct hostapd_data *hapd)
 static enum nr_chan_width hostapd_get_nr_chan_width(struct hostapd_data *hapd,
                                                    int ht, int vht, int he)
 {
-       u8 oper_chwidth = hostapd_get_oper_chwidth(hapd->iconf);
+       enum oper_chan_width oper_chwidth;
+
+       oper_chwidth = hostapd_get_oper_chwidth(hapd->iconf);
 
        if (!ht && !vht && !he)
                return NR_CHAN_WIDTH_20;
        if (!hapd->iconf->secondary_channel)
                return NR_CHAN_WIDTH_20;
-       if ((!vht && !he) || oper_chwidth == CHANWIDTH_USE_HT)
+       if ((!vht && !he) || oper_chwidth == CONF_OPER_CHWIDTH_USE_HT)
                return NR_CHAN_WIDTH_40;
-       if (oper_chwidth == CHANWIDTH_80MHZ)
+       if (oper_chwidth == CONF_OPER_CHWIDTH_80MHZ)
                return NR_CHAN_WIDTH_80;
-       if (oper_chwidth == CHANWIDTH_160MHZ)
+       if (oper_chwidth == CONF_OPER_CHWIDTH_160MHZ)
                return NR_CHAN_WIDTH_160;
-       if (oper_chwidth == CHANWIDTH_80P80MHZ)
+       if (oper_chwidth == CONF_OPER_CHWIDTH_80P80MHZ)
                return NR_CHAN_WIDTH_80P80;
        return NR_CHAN_WIDTH_20;
 }
index 07065695da6bc6a69717a03dd9b7ea288d748e8e..ce748798823bd809027d012b55ea5b3ab21d4a3d 100644 (file)
@@ -432,6 +432,21 @@ enum chan_width {
        CHAN_WIDTH_UNKNOWN
 };
 
+/* VHT/EDMG/etc. channel widths
+ * Note: The first four values are used in hostapd.conf and as such, must
+ * maintain their defined values. Other values are used internally. */
+enum oper_chan_width {
+       CONF_OPER_CHWIDTH_USE_HT = 0,
+       CONF_OPER_CHWIDTH_80MHZ = 1,
+       CONF_OPER_CHWIDTH_160MHZ = 2,
+       CONF_OPER_CHWIDTH_80P80MHZ = 3,
+       CONF_OPER_CHWIDTH_2160MHZ,
+       CONF_OPER_CHWIDTH_4320MHZ,
+       CONF_OPER_CHWIDTH_6480MHZ,
+       CONF_OPER_CHWIDTH_8640MHZ,
+       CONF_OPER_CHWIDTH_40MHZ_6GHZ,
+};
+
 enum key_flag {
        KEY_FLAG_MODIFY                 = BIT(0),
        KEY_FLAG_DEFAULT                = BIT(1),
index 2e10e73867af35d1fcbef5a54bafd1861792a405..e2bf3afc6830583ef4455883305a39acb9452fce 100644 (file)
@@ -384,7 +384,8 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
                            u8 edmg_channel, int ht_enabled,
                            int vht_enabled, int he_enabled,
                            bool eht_enabled, int sec_channel_offset,
-                           int oper_chwidth, int center_segment0,
+                           enum oper_chan_width oper_chwidth,
+                           int center_segment0,
                            int center_segment1, u32 vht_caps,
                            struct he_capabilities *he_cap,
                            struct eht_capabilities *eht_cap)
@@ -402,10 +403,10 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
        data->sec_channel_offset = sec_channel_offset;
        data->center_freq1 = freq + sec_channel_offset * 10;
        data->center_freq2 = 0;
-       if (oper_chwidth == CHANWIDTH_80MHZ)
+       if (oper_chwidth == CONF_OPER_CHWIDTH_80MHZ)
                data->bandwidth = 80;
-       else if (oper_chwidth == CHANWIDTH_160MHZ ||
-                oper_chwidth == CHANWIDTH_80P80MHZ)
+       else if (oper_chwidth == CONF_OPER_CHWIDTH_160MHZ ||
+                oper_chwidth == CONF_OPER_CHWIDTH_80P80MHZ)
                data->bandwidth = 160;
        else if (sec_channel_offset)
                data->bandwidth = 40;
@@ -496,7 +497,7 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
 #endif
 
        if (data->he_enabled || data->eht_enabled) switch (oper_chwidth) {
-       case CHANWIDTH_USE_HT:
+       case CONF_OPER_CHWIDTH_USE_HT:
                if (sec_channel_offset == 0)
                        break;
 
@@ -511,7 +512,7 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
                        break;
                }
                /* fall through */
-       case CHANWIDTH_80MHZ:
+       case CONF_OPER_CHWIDTH_80MHZ:
                if (mode == HOSTAPD_MODE_IEEE80211A) {
                        if (he_cap &&
                            !(he_cap->phy_cap[HE_PHYCAP_CHANNEL_WIDTH_SET_IDX] &
@@ -522,7 +523,7 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
                        }
                }
                break;
-       case CHANWIDTH_80P80MHZ:
+       case CONF_OPER_CHWIDTH_80P80MHZ:
                if (he_cap &&
                    !(he_cap->phy_cap[HE_PHYCAP_CHANNEL_WIDTH_SET_IDX] &
                      HE_PHYCAP_CHANNEL_WIDTH_SET_80PLUS80MHZ_IN_5G)) {
@@ -531,7 +532,7 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
                        return -1;
                }
                break;
-       case CHANWIDTH_160MHZ:
+       case CONF_OPER_CHWIDTH_160MHZ:
                if (he_cap &&
                    !(he_cap->phy_cap[HE_PHYCAP_CHANNEL_WIDTH_SET_IDX] &
                      HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G)) {
@@ -540,19 +541,21 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
                        return -1;
                }
                break;
+       default:
+               break;
        } else if (data->vht_enabled) switch (oper_chwidth) {
-       case CHANWIDTH_USE_HT:
+       case CONF_OPER_CHWIDTH_USE_HT:
                break;
-       case CHANWIDTH_80P80MHZ:
+       case CONF_OPER_CHWIDTH_80P80MHZ:
                if (!(vht_caps & VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)) {
                        wpa_printf(MSG_ERROR,
                                   "80+80 channel width is not supported!");
                        return -1;
                }
                /* fall through */
-       case CHANWIDTH_80MHZ:
+       case CONF_OPER_CHWIDTH_80MHZ:
                break;
-       case CHANWIDTH_160MHZ:
+       case CONF_OPER_CHWIDTH_160MHZ:
                if (!(vht_caps & (VHT_CAP_SUPP_CHAN_WIDTH_160MHZ |
                                  VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ))) {
                        wpa_printf(MSG_ERROR,
@@ -560,11 +563,13 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
                        return -1;
                }
                break;
+       default:
+               break;
        }
 
        if (data->eht_enabled || data->he_enabled ||
            data->vht_enabled) switch (oper_chwidth) {
-       case CHANWIDTH_USE_HT:
+       case CONF_OPER_CHWIDTH_USE_HT:
                if (center_segment1 ||
                    (center_segment0 != 0 &&
                     5000 + center_segment0 * 5 != data->center_freq1 &&
@@ -575,7 +580,7 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
                        return -1;
                }
                break;
-       case CHANWIDTH_80P80MHZ:
+       case CONF_OPER_CHWIDTH_80P80MHZ:
                if (center_segment1 == center_segment0 + 4 ||
                    center_segment1 == center_segment0 - 4) {
                        wpa_printf(MSG_ERROR,
@@ -584,19 +589,21 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
                }
                data->center_freq2 = 5000 + center_segment1 * 5;
                /* fall through */
-       case CHANWIDTH_80MHZ:
+       case CONF_OPER_CHWIDTH_80MHZ:
                data->bandwidth = 80;
                if (!sec_channel_offset) {
                        wpa_printf(MSG_ERROR,
                                   "80/80+80 MHz: no second channel offset");
                        return -1;
                }
-               if (oper_chwidth == CHANWIDTH_80MHZ && center_segment1) {
+               if (oper_chwidth == CONF_OPER_CHWIDTH_80MHZ &&
+                   center_segment1) {
                        wpa_printf(MSG_ERROR,
                                   "80 MHz: center segment 1 configured");
                        return -1;
                }
-               if (oper_chwidth == CHANWIDTH_80P80MHZ && !center_segment1) {
+               if (oper_chwidth == CONF_OPER_CHWIDTH_80P80MHZ &&
+                   !center_segment1) {
                        wpa_printf(MSG_ERROR,
                                   "80+80 MHz: center segment 1 not configured");
                        return -1;
@@ -635,7 +642,7 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
                        }
                }
                break;
-       case CHANWIDTH_160MHZ:
+       case CONF_OPER_CHWIDTH_160MHZ:
                data->bandwidth = 160;
                if (center_segment1) {
                        wpa_printf(MSG_ERROR,
@@ -666,6 +673,8 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
                        return -1;
                }
                break;
+       default:
+               break;
        }
 
        return 0;
index d87a2caff52dbcef9d30638404f1c8b64e347b1a..d8ca16867808a6586eb86c7c33798101541585c3 100644 (file)
@@ -41,7 +41,8 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
                            int ht_enabled,
                            int vht_enabled, int he_enabled,
                            bool eht_enabled, int sec_channel_offset,
-                           int oper_chwidth, int center_segment0,
+                           enum oper_chan_width oper_chwidth,
+                           int center_segment0,
                            int center_segment1, u32 vht_caps,
                            struct he_capabilities *he_caps,
                            struct eht_capabilities *eht_cap);
index 9e348a21c375e0ace934ecef96be3ce99ab6e37b..dfc035df781c09b9a3a01807e483e128f7f0c36d 100644 (file)
@@ -880,7 +880,7 @@ enum hostapd_hw_mode ieee80211_freq_to_chan(int freq, u8 *channel)
 {
        u8 op_class;
 
-       return ieee80211_freq_to_channel_ext(freq, 0, CHANWIDTH_USE_HT,
+       return ieee80211_freq_to_channel_ext(freq, 0, CONF_OPER_CHWIDTH_USE_HT,
                                             &op_class, channel);
 }
 
@@ -890,15 +890,15 @@ enum hostapd_hw_mode ieee80211_freq_to_chan(int freq, u8 *channel)
  * for HT40, VHT, and HE. DFS channels are not covered.
  * @freq: Frequency (MHz) to convert
  * @sec_channel: 0 = non-HT40, 1 = sec. channel above, -1 = sec. channel below
- * @chanwidth: VHT/EDMG channel width (CHANWIDTH_*)
+ * @chanwidth: VHT/EDMG/etc. channel width
  * @op_class: Buffer for returning operating class
  * @channel: Buffer for returning channel number
  * Returns: hw_mode on success, NUM_HOSTAPD_MODES on failure
  */
-enum hostapd_hw_mode ieee80211_freq_to_channel_ext(unsigned int freq,
-                                                  int sec_channel,
-                                                  int chanwidth,
-                                                  u8 *op_class, u8 *channel)
+enum hostapd_hw_mode
+ieee80211_freq_to_channel_ext(unsigned int freq, int sec_channel,
+                             enum oper_chan_width chanwidth,
+                             u8 *op_class, u8 *channel)
 {
        u8 vht_opclass;
 
@@ -946,13 +946,13 @@ enum hostapd_hw_mode ieee80211_freq_to_channel_ext(unsigned int freq,
        }
 
        switch (chanwidth) {
-       case CHANWIDTH_80MHZ:
+       case CONF_OPER_CHWIDTH_80MHZ:
                vht_opclass = 128;
                break;
-       case CHANWIDTH_160MHZ:
+       case CONF_OPER_CHWIDTH_160MHZ:
                vht_opclass = 129;
                break;
-       case CHANWIDTH_80P80MHZ:
+       case CONF_OPER_CHWIDTH_80P80MHZ:
                vht_opclass = 130;
                break;
        default:
@@ -1051,13 +1051,13 @@ enum hostapd_hw_mode ieee80211_freq_to_channel_ext(unsigned int freq,
                        return NUM_HOSTAPD_MODES;
 
                switch (chanwidth) {
-               case CHANWIDTH_80MHZ:
+               case CONF_OPER_CHWIDTH_80MHZ:
                        *op_class = 133;
                        break;
-               case CHANWIDTH_160MHZ:
+               case CONF_OPER_CHWIDTH_160MHZ:
                        *op_class = 134;
                        break;
-               case CHANWIDTH_80P80MHZ:
+               case CONF_OPER_CHWIDTH_80P80MHZ:
                        *op_class = 135;
                        break;
                default:
@@ -1084,12 +1084,12 @@ enum hostapd_hw_mode ieee80211_freq_to_channel_ext(unsigned int freq,
                        return NUM_HOSTAPD_MODES;
 
                switch (chanwidth) {
-               case CHANWIDTH_USE_HT:
-               case CHANWIDTH_2160MHZ:
+               case CONF_OPER_CHWIDTH_USE_HT:
+               case CONF_OPER_CHWIDTH_2160MHZ:
                        *channel = (freq - 56160) / 2160;
                        *op_class = 180;
                        break;
-               case CHANWIDTH_4320MHZ:
+               case CONF_OPER_CHWIDTH_4320MHZ:
                        /* EDMG channels 9 - 13 */
                        if (freq > 56160 + 2160 * 5)
                                return NUM_HOSTAPD_MODES;
@@ -1097,7 +1097,7 @@ enum hostapd_hw_mode ieee80211_freq_to_channel_ext(unsigned int freq,
                        *channel = (freq - 56160) / 2160 + 8;
                        *op_class = 181;
                        break;
-               case CHANWIDTH_6480MHZ:
+               case CONF_OPER_CHWIDTH_6480MHZ:
                        /* EDMG channels 17 - 20 */
                        if (freq > 56160 + 2160 * 4)
                                return NUM_HOSTAPD_MODES;
@@ -1105,7 +1105,7 @@ enum hostapd_hw_mode ieee80211_freq_to_channel_ext(unsigned int freq,
                        *channel = (freq - 56160) / 2160 + 16;
                        *op_class = 182;
                        break;
-               case CHANWIDTH_8640MHZ:
+               case CONF_OPER_CHWIDTH_8640MHZ:
                        /* EDMG channels 25 - 27 */
                        if (freq > 56160 + 2160 * 3)
                                return NUM_HOSTAPD_MODES;
@@ -1134,28 +1134,28 @@ int ieee80211_chaninfo_to_channel(unsigned int freq, enum chan_width chanwidth,
        case CHAN_WIDTH_20_NOHT:
        case CHAN_WIDTH_20:
        case CHAN_WIDTH_40:
-               cw = CHANWIDTH_USE_HT;
+               cw = CONF_OPER_CHWIDTH_USE_HT;
                break;
        case CHAN_WIDTH_80:
-               cw = CHANWIDTH_80MHZ;
+               cw = CONF_OPER_CHWIDTH_80MHZ;
                break;
        case CHAN_WIDTH_80P80:
-               cw = CHANWIDTH_80P80MHZ;
+               cw = CONF_OPER_CHWIDTH_80P80MHZ;
                break;
        case CHAN_WIDTH_160:
-               cw = CHANWIDTH_160MHZ;
+               cw = CONF_OPER_CHWIDTH_160MHZ;
                break;
        case CHAN_WIDTH_2160:
-               cw = CHANWIDTH_2160MHZ;
+               cw = CONF_OPER_CHWIDTH_2160MHZ;
                break;
        case CHAN_WIDTH_4320:
-               cw = CHANWIDTH_4320MHZ;
+               cw = CONF_OPER_CHWIDTH_4320MHZ;
                break;
        case CHAN_WIDTH_6480:
-               cw = CHANWIDTH_6480MHZ;
+               cw = CONF_OPER_CHWIDTH_6480MHZ;
                break;
        case CHAN_WIDTH_8640:
-               cw = CHANWIDTH_8640MHZ;
+               cw = CONF_OPER_CHWIDTH_8640MHZ;
                break;
        }
 
@@ -2607,64 +2607,64 @@ int op_class_to_bandwidth(u8 op_class)
 }
 
 
-int op_class_to_ch_width(u8 op_class)
+enum oper_chan_width op_class_to_ch_width(u8 op_class)
 {
        switch (op_class) {
        case 81:
        case 82:
-               return CHANWIDTH_USE_HT;
+               return CONF_OPER_CHWIDTH_USE_HT;
        case 83: /* channels 1..9; 40 MHz */
        case 84: /* channels 5..13; 40 MHz */
-               return CHANWIDTH_USE_HT;
+               return CONF_OPER_CHWIDTH_USE_HT;
        case 115: /* channels 36,40,44,48; indoor only */
-               return CHANWIDTH_USE_HT;
+               return CONF_OPER_CHWIDTH_USE_HT;
        case 116: /* channels 36,44; 40 MHz; indoor only */
        case 117: /* channels 40,48; 40 MHz; indoor only */
-               return CHANWIDTH_USE_HT;
+               return CONF_OPER_CHWIDTH_USE_HT;
        case 118: /* channels 52,56,60,64; dfs */
-               return CHANWIDTH_USE_HT;
+               return CONF_OPER_CHWIDTH_USE_HT;
        case 119: /* channels 52,60; 40 MHz; dfs */
        case 120: /* channels 56,64; 40 MHz; dfs */
-               return CHANWIDTH_USE_HT;
+               return CONF_OPER_CHWIDTH_USE_HT;
        case 121: /* channels 100-140 */
-               return CHANWIDTH_USE_HT;
+               return CONF_OPER_CHWIDTH_USE_HT;
        case 122: /* channels 100-142; 40 MHz */
        case 123: /* channels 104-136; 40 MHz */
-               return CHANWIDTH_USE_HT;
+               return CONF_OPER_CHWIDTH_USE_HT;
        case 124: /* channels 149,153,157,161 */
        case 125: /* channels 149,153,157,161,165,169,171 */
-               return CHANWIDTH_USE_HT;
+               return CONF_OPER_CHWIDTH_USE_HT;
        case 126: /* channels 149,157,165, 173; 40 MHz */
        case 127: /* channels 153,161,169,177; 40 MHz */
-               return CHANWIDTH_USE_HT;
+               return CONF_OPER_CHWIDTH_USE_HT;
        case 128: /* center freqs 42, 58, 106, 122, 138, 155, 171; 80 MHz */
-               return CHANWIDTH_80MHZ;
+               return CONF_OPER_CHWIDTH_80MHZ;
        case 129: /* center freqs 50, 114, 163; 160 MHz */
-               return CHANWIDTH_160MHZ;
+               return CONF_OPER_CHWIDTH_160MHZ;
        case 130: /* center freqs 42, 58, 106, 122, 138, 155, 171; 80+80 MHz */
-               return CHANWIDTH_80P80MHZ;
+               return CONF_OPER_CHWIDTH_80P80MHZ;
        case 131: /* UHB channels, 20 MHz: 1, 5, 9.. */
-               return CHANWIDTH_USE_HT;
+               return CONF_OPER_CHWIDTH_USE_HT;
        case 132: /* UHB channels, 40 MHz: 3, 11, 19.. */
-               return CHANWIDTH_USE_HT;
+               return CONF_OPER_CHWIDTH_USE_HT;
        case 133: /* UHB channels, 80 MHz: 7, 23, 39.. */
-               return CHANWIDTH_80MHZ;
+               return CONF_OPER_CHWIDTH_80MHZ;
        case 134: /* UHB channels, 160 MHz: 15, 47, 79.. */
-               return CHANWIDTH_160MHZ;
+               return CONF_OPER_CHWIDTH_160MHZ;
        case 135: /* UHB channels, 80+80 MHz: 7, 23, 39.. */
-               return CHANWIDTH_80P80MHZ;
+               return CONF_OPER_CHWIDTH_80P80MHZ;
        case 136: /* UHB channels, 20 MHz: 2 */
-               return CHANWIDTH_USE_HT;
+               return CONF_OPER_CHWIDTH_USE_HT;
        case 180: /* 60 GHz band, channels 1..8 */
-               return CHANWIDTH_2160MHZ;
+               return CONF_OPER_CHWIDTH_2160MHZ;
        case 181: /* 60 GHz band, EDMG CB2, channels 9..15 */
-               return CHANWIDTH_4320MHZ;
+               return CONF_OPER_CHWIDTH_4320MHZ;
        case 182: /* 60 GHz band, EDMG CB3, channels 17..22 */
-               return CHANWIDTH_6480MHZ;
+               return CONF_OPER_CHWIDTH_6480MHZ;
        case 183: /* 60 GHz band, EDMG CB4, channel 25..29 */
-               return CHANWIDTH_8640MHZ;
+               return CONF_OPER_CHWIDTH_8640MHZ;
        }
-       return CHANWIDTH_USE_HT;
+       return CONF_OPER_CHWIDTH_USE_HT;
 }
 
 
index 743c5a03cbd7c0521480a0736c268f786cbf737b..94e1d7b8b4af246b9c7943ad74720f52e08749c5 100644 (file)
@@ -215,9 +215,10 @@ int hostapd_config_tx_queue(struct hostapd_tx_queue_params queue[],
                            const char *name, const char *val);
 enum hostapd_hw_mode ieee80211_freq_to_chan(int freq, u8 *channel);
 int ieee80211_chan_to_freq(const char *country, u8 op_class, u8 chan);
-enum hostapd_hw_mode ieee80211_freq_to_channel_ext(unsigned int freq,
-                                                  int sec_channel, int vht,
-                                                  u8 *op_class, u8 *channel);
+enum hostapd_hw_mode
+ieee80211_freq_to_channel_ext(unsigned int freq, int sec_channel,
+                             enum oper_chan_width chanwidth,
+                             u8 *op_class, u8 *channel);
 int ieee80211_chaninfo_to_channel(unsigned int freq, enum chan_width chanwidth,
                                  int sec_channel, u8 *op_class, u8 *channel);
 int ieee80211_is_dfs(int freq, const struct hostapd_hw_modes *modes,
@@ -279,7 +280,7 @@ bool ieee802_11_rsnx_capab_len(const u8 *rsnxe, size_t rsnxe_len,
                               unsigned int capab);
 bool ieee802_11_rsnx_capab(const u8 *rsnxe, unsigned int capab);
 int op_class_to_bandwidth(u8 op_class);
-int op_class_to_ch_width(u8 op_class);
+enum oper_chan_width op_class_to_ch_width(u8 op_class);
 
 /* element iteration helpers */
 #define for_each_element(_elem, _data, _datalen)                       \
index ffa93f320f3d670612b2b499a6cb81bb0f0a6ecd..1bd57afe5dd1da0819e43b79f6a62f2162d572ae 100644 (file)
@@ -1334,16 +1334,11 @@ struct ieee80211_ampe_ie {
 
 #define VHT_RX_NSS_MAX_STREAMS                     8
 
-/* VHT/EDMG channel widths */
+/* VHT operation information - channel widths */
 #define CHANWIDTH_USE_HT       0
 #define CHANWIDTH_80MHZ                1
 #define CHANWIDTH_160MHZ       2
 #define CHANWIDTH_80P80MHZ     3
-#define CHANWIDTH_2160MHZ      4
-#define CHANWIDTH_4320MHZ      5
-#define CHANWIDTH_6480MHZ      6
-#define CHANWIDTH_8640MHZ      7
-#define CHANWIDTH_40MHZ_6GHZ   8
 
 #define HE_NSS_MAX_STREAMS                         8
 
index 52b537e62df48aaf646192be653294c5c63b1bde..7de924945725df23fbfd492bc0445ac67394ac00 100644 (file)
@@ -90,7 +90,7 @@ static void wpas_conf_ap_vht(struct wpa_supplicant *wpa_s,
                                              &conf->op_class,
                                              &conf->channel);
 
-       if (hostapd_get_oper_chwidth(conf) == CHANWIDTH_80P80MHZ) {
+       if (hostapd_get_oper_chwidth(conf) == CONF_OPER_CHWIDTH_80P80MHZ) {
                ieee80211_freq_to_chan(ssid->vht_center_freq2,
                                       &freq_seg_idx);
                hostapd_set_oper_centr_freq_seg1_idx(conf, freq_seg_idx);
@@ -112,15 +112,15 @@ static void wpas_conf_ap_vht(struct wpa_supplicant *wpa_s,
 
 #ifdef CONFIG_P2P
        switch (hostapd_get_oper_chwidth(conf)) {
-       case CHANWIDTH_80MHZ:
-       case CHANWIDTH_80P80MHZ:
+       case CONF_OPER_CHWIDTH_80MHZ:
+       case CONF_OPER_CHWIDTH_80P80MHZ:
                center_chan = wpas_p2p_get_vht80_center(wpa_s, mode, channel,
                                                        conf->op_class);
                wpa_printf(MSG_DEBUG,
                           "VHT center channel %u for 80 or 80+80 MHz bandwidth",
                           center_chan);
                break;
-       case CHANWIDTH_160MHZ:
+       case CONF_OPER_CHWIDTH_160MHZ:
                center_chan = wpas_p2p_get_vht160_center(wpa_s, mode, channel,
                                                         conf->op_class);
                wpa_printf(MSG_DEBUG,
@@ -133,7 +133,7 @@ static void wpas_conf_ap_vht(struct wpa_supplicant *wpa_s,
                 * try oper_cwidth 160 MHz first then VHT 80 MHz, if 160 MHz is
                 * not supported.
                 */
-               hostapd_set_oper_chwidth(conf, CHANWIDTH_160MHZ);
+               hostapd_set_oper_chwidth(conf, CONF_OPER_CHWIDTH_160MHZ);
                ieee80211_freq_to_channel_ext(ssid->frequency, 0,
                                              conf->vht_oper_chwidth,
                                              &conf->op_class,
@@ -145,7 +145,7 @@ static void wpas_conf_ap_vht(struct wpa_supplicant *wpa_s,
                                   "VHT center channel %u for auto-selected 160 MHz bandwidth",
                                   center_chan);
                } else {
-                       hostapd_set_oper_chwidth(conf, CHANWIDTH_80MHZ);
+                       hostapd_set_oper_chwidth(conf, CONF_OPER_CHWIDTH_80MHZ);
                        ieee80211_freq_to_channel_ext(ssid->frequency, 0,
                                                      conf->vht_oper_chwidth,
                                                      &conf->op_class,
@@ -174,7 +174,7 @@ no_vht:
                   conf->channel);
        hostapd_set_oper_centr_freq_seg0_idx(
                conf, conf->channel + conf->secondary_channel * 2);
-       hostapd_set_oper_chwidth(conf, CHANWIDTH_USE_HT);
+       hostapd_set_oper_chwidth(conf, CONF_OPER_CHWIDTH_USE_HT);
 }
 
 
@@ -201,14 +201,14 @@ wpa_supplicant_find_hw_mode(struct wpa_supplicant *wpa_s,
 static int get_max_oper_chwidth_6ghz(int chwidth)
 {
        switch (chwidth) {
-       case CHANWIDTH_USE_HT:
+       case CONF_OPER_CHWIDTH_USE_HT:
                return 20;
-       case CHANWIDTH_40MHZ_6GHZ:
+       case CONF_OPER_CHWIDTH_40MHZ_6GHZ:
                return 40;
-       case CHANWIDTH_80MHZ:
+       case CONF_OPER_CHWIDTH_80MHZ:
                return 80;
-       case CHANWIDTH_80P80MHZ:
-       case CHANWIDTH_160MHZ:
+       case CONF_OPER_CHWIDTH_80P80MHZ:
+       case CONF_OPER_CHWIDTH_160MHZ:
                return 160;
        default:
                return 0;
@@ -249,8 +249,8 @@ static void wpas_conf_ap_he_6ghz(struct wpa_supplicant *wpa_s,
                wpa_printf(MSG_DEBUG,
                           "Secondary channel offset %d for P2P group",
                           conf->secondary_channel);
-               if (ssid->max_oper_chwidth == CHANWIDTH_40MHZ_6GHZ)
-                       ssid->max_oper_chwidth = CHANWIDTH_USE_HT;
+               if (ssid->max_oper_chwidth == CONF_OPER_CHWIDTH_40MHZ_6GHZ)
+                       ssid->max_oper_chwidth = CONF_OPER_CHWIDTH_USE_HT;
        }
 
        if ((is_chanwidth_40_80 || is_chanwidth_160) && ssid->p2p_group &&
@@ -266,7 +266,7 @@ int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s,
                              struct hostapd_config *conf)
 {
        conf->hw_mode = ieee80211_freq_to_channel_ext(ssid->frequency, 0,
-                                                     CHANWIDTH_USE_HT,
+                                                     CONF_OPER_CHWIDTH_USE_HT,
                                                      &conf->op_class,
                                                      &conf->channel);
        if (conf->hw_mode == NUM_HOSTAPD_MODES) {
index bfbc460002c25427e84b16f2267a3fbe6f6336eb..92525d7c6de310c43174a6778b2c906a559a0c9e 100644 (file)
@@ -2434,8 +2434,8 @@ static const struct parse_data ssid_fields[] = {
        { INT_RANGE(ht, 0, 1) },
        { INT_RANGE(vht, 0, 1) },
        { INT_RANGE(ht40, -1, 1) },
-       { INT_RANGE(max_oper_chwidth, CHANWIDTH_USE_HT,
-                   CHANWIDTH_80P80MHZ) },
+       { INT_RANGE(max_oper_chwidth, CONF_OPER_CHWIDTH_USE_HT,
+                   CONF_OPER_CHWIDTH_80P80MHZ) },
        { INT(vht_center_freq1) },
        { INT(vht_center_freq2) },
 #ifdef IEEE8021X_EAPOL
index 9b17c3b14298640031f371e4a31402a23cf13647..767f659c8b48224a58248cef7ddaebd3831da7cb 100644 (file)
@@ -561,7 +561,7 @@ struct wpa_ssid {
 
        int he;
 
-       int max_oper_chwidth;
+       enum oper_chan_width max_oper_chwidth;
 
        unsigned int vht_center_freq1;
        unsigned int vht_center_freq2;
index 499e6d3dd5d890609489540795c5091f7847dd36..2bbbaab208031fa3c3f06a54da44b3414ae97b83 100644 (file)
@@ -5978,17 +5978,17 @@ static int parse_freq(int chwidth, int freq2)
        if (freq2 < 0)
                return -1;
        if (freq2)
-               return CHANWIDTH_80P80MHZ;
+               return CONF_OPER_CHWIDTH_80P80MHZ;
 
        switch (chwidth) {
        case 0:
        case 20:
        case 40:
-               return CHANWIDTH_USE_HT;
+               return CONF_OPER_CHWIDTH_USE_HT;
        case 80:
-               return CHANWIDTH_80MHZ;
+               return CONF_OPER_CHWIDTH_80MHZ;
        case 160:
-               return CHANWIDTH_160MHZ;
+               return CONF_OPER_CHWIDTH_160MHZ;
        default:
                wpa_printf(MSG_DEBUG, "Unknown max oper bandwidth: %d",
                           chwidth);
@@ -6095,7 +6095,7 @@ static int p2p_ctrl_connect(struct wpa_supplicant *wpa_s, char *cmd,
                return -1;
 
        if (allow_6ghz && chwidth == 40)
-               max_oper_chwidth = CHANWIDTH_40MHZ_6GHZ;
+               max_oper_chwidth = CONF_OPER_CHWIDTH_40MHZ_6GHZ;
 
        pos2 = os_strstr(pos, " ssid=");
        if (pos2) {
@@ -6751,7 +6751,7 @@ static int p2p_ctrl_invite_persistent(struct wpa_supplicant *wpa_s, char *cmd)
        allow_6ghz = os_strstr(cmd, " allow_6ghz") != NULL;
 
        if (allow_6ghz && chwidth == 40)
-               max_oper_chwidth = CHANWIDTH_40MHZ_6GHZ;
+               max_oper_chwidth = CONF_OPER_CHWIDTH_40MHZ_6GHZ;
 
        return wpas_p2p_invite(wpa_s, _peer, ssid, NULL, freq, freq2, ht40, vht,
                               max_oper_chwidth, pref_freq, he, edmg,
@@ -6897,7 +6897,7 @@ static int p2p_ctrl_group_add(struct wpa_supplicant *wpa_s, char *cmd)
                return -1;
 
        if (allow_6ghz && chwidth == 40)
-               max_oper_chwidth = CHANWIDTH_40MHZ_6GHZ;
+               max_oper_chwidth = CONF_OPER_CHWIDTH_40MHZ_6GHZ;
 
        /* Allow DFS to be used for Autonomous GO */
        wpa_s->p2p_go_allow_dfs = !!(wpa_s->drv_flags &
index b67396d5a15e52edb449cd7e83f1ffb53a28124e..16530fb74b556ec263ac2ec9315ee1947de9b1a3 100644 (file)
@@ -643,18 +643,20 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s,
                switch (params->freq.bandwidth) {
                case 80:
                        if (params->freq.center_freq2) {
-                               ssid->max_oper_chwidth = CHANWIDTH_80P80MHZ;
+                               ssid->max_oper_chwidth =
+                                       CONF_OPER_CHWIDTH_80P80MHZ;
                                ssid->vht_center_freq2 =
                                        params->freq.center_freq2;
                        } else {
-                               ssid->max_oper_chwidth = CHANWIDTH_80MHZ;
+                               ssid->max_oper_chwidth =
+                                       CONF_OPER_CHWIDTH_80MHZ;
                        }
                        break;
                case 160:
-                       ssid->max_oper_chwidth = CHANWIDTH_160MHZ;
+                       ssid->max_oper_chwidth = CONF_OPER_CHWIDTH_160MHZ;
                        break;
                default:
-                       ssid->max_oper_chwidth = CHANWIDTH_USE_HT;
+                       ssid->max_oper_chwidth = CONF_OPER_CHWIDTH_USE_HT;
                        break;
                }
        }
index bd53c5ceceafe2eeccc6d53902ccae4f18237a77..5dca8f7233a2540634b707d46dc58bcf33fa8a23 100644 (file)
@@ -470,8 +470,9 @@ size_t wpas_supp_op_class_ie(struct wpa_supplicant *wpa_s,
         * or used.
         */
        if (wpas_sta_secondary_channel_offset(bss, &current, &chan) < 0 &&
-           ieee80211_freq_to_channel_ext(bss->freq, 0, CHANWIDTH_USE_HT,
-                                         &current, &chan) == NUM_HOSTAPD_MODES)
+           ieee80211_freq_to_channel_ext(bss->freq, 0,
+                                         CONF_OPER_CHWIDTH_USE_HT, &current,
+                                         &chan) == NUM_HOSTAPD_MODES)
                return 0;
 
        /*
index 6a23dd99862d4282b02a8478d28093355661ea76..ed2ccc9ca7ca26e3160b1ceb982d94e161c8c261 100644 (file)
@@ -6674,8 +6674,8 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
 
                        if (!is_6ghz &&
                            ieee80211_freq_to_channel_ext(
-                                   cand, -1, CHANWIDTH_USE_HT, &op_class,
-                                   &chan) != NUM_HOSTAPD_MODES &&
+                                   cand, -1, CONF_OPER_CHWIDTH_USE_HT,
+                                   &op_class, &chan) != NUM_HOSTAPD_MODES &&
                            wpas_p2p_verify_channel(
                                    wpa_s, hwmode, op_class, chan,
                                    BW40MINUS) == ALLOWED)
@@ -6683,8 +6683,8 @@ static int wpas_p2p_init_go_params(struct wpa_supplicant *wpa_s,
 
                        if (!supported && !is_6ghz &&
                            ieee80211_freq_to_channel_ext(
-                                   cand, 1, CHANWIDTH_USE_HT, &op_class,
-                                   &chan) != NUM_HOSTAPD_MODES &&
+                                   cand, 1, CONF_OPER_CHWIDTH_USE_HT,
+                                   &op_class, &chan) != NUM_HOSTAPD_MODES &&
                            wpas_p2p_verify_channel(
                                    wpa_s, hwmode, op_class, chan,
                                    BW40PLUS) == ALLOWED)
@@ -9717,13 +9717,15 @@ static int wpas_p2p_move_go_csa(struct wpa_supplicant *wpa_s)
                csa_settings.freq_params.center_freq2 = freq2;
 
                switch (conf->vht_oper_chwidth) {
-               case CHANWIDTH_80MHZ:
-               case CHANWIDTH_80P80MHZ:
+               case CONF_OPER_CHWIDTH_80MHZ:
+               case CONF_OPER_CHWIDTH_80P80MHZ:
                        csa_settings.freq_params.bandwidth = 80;
                        break;
-               case CHANWIDTH_160MHZ:
+               case CONF_OPER_CHWIDTH_160MHZ:
                        csa_settings.freq_params.bandwidth = 160;
                        break;
+               default:
+                       break;
                }
        }
 
index 4457b6c3dc89ff60e957fac12056b959f3ea3b9e..238fe68da057d63c1e4800220bee4a0aa8df2b8d 100644 (file)
@@ -731,24 +731,24 @@ int wpas_get_op_chan_phy(int freq, const u8 *ies, size_t ies_len,
                vht_oper = (struct ieee80211_vht_operation *) (ie + 2);
 
                switch (vht_oper->vht_op_info_chwidth) {
-               case 1:
+               case CHANWIDTH_80MHZ:
                        seg0 = vht_oper->vht_op_info_chan_center_freq_seg0_idx;
                        seg1 = vht_oper->vht_op_info_chan_center_freq_seg1_idx;
                        if (seg1 && abs(seg1 - seg0) == 8)
-                               vht = CHANWIDTH_160MHZ;
+                               vht = CONF_OPER_CHWIDTH_160MHZ;
                        else if (seg1)
-                               vht = CHANWIDTH_80P80MHZ;
+                               vht = CONF_OPER_CHWIDTH_80P80MHZ;
                        else
-                               vht = CHANWIDTH_80MHZ;
+                               vht = CONF_OPER_CHWIDTH_80MHZ;
                        break;
-               case 2:
-                       vht = CHANWIDTH_160MHZ;
+               case CHANWIDTH_160MHZ:
+                       vht = CONF_OPER_CHWIDTH_160MHZ;
                        break;
-               case 3:
-                       vht = CHANWIDTH_80P80MHZ;
+               case CHANWIDTH_80P80MHZ:
+                       vht = CONF_OPER_CHWIDTH_80P80MHZ;
                        break;
                default:
-                       vht = CHANWIDTH_USE_HT;
+                       vht = CONF_OPER_CHWIDTH_USE_HT;
                        break;
                }
        }
index 0a4b9d47483ca7fe2e49aff0d86e18933486b5e3..a00a2c5381f7d5013d0ce0c86354d15d0f76748e 100644 (file)
@@ -921,7 +921,8 @@ static int wnm_nei_rep_add_bss(struct wpa_supplicant *wpa_s,
 {
        const u8 *ie;
        u8 op_class, chan;
-       int sec_chan = 0, vht = 0;
+       int sec_chan = 0;
+       enum oper_chan_width vht = CONF_OPER_CHWIDTH_USE_HT;
        enum phy_type phy_type;
        u32 info;
        struct ieee80211_ht_operation *ht_oper = NULL;
index c2ce2c9340c91b03ee67b30f9cbf4508f7022c17..5111297dcac100d1d92fa653675ec135dab69737 100644 (file)
@@ -2686,7 +2686,7 @@ skip_to_6ghz:
        if (!ibss_mesh_is_80mhz_avail(channel, mode))
                return;
 
-       chwidth = CHANWIDTH_80MHZ;
+       chwidth = CONF_OPER_CHWIDTH_80MHZ;
        seg0 = channel + 6;
        seg1 = 0;
 
@@ -2702,14 +2702,14 @@ skip_to_6ghz:
 
                for (j = 0; j < ARRAY_SIZE(bw160); j++) {
                        if (freq->freq == bw160[j]) {
-                               chwidth = CHANWIDTH_160MHZ;
+                               chwidth = CONF_OPER_CHWIDTH_160MHZ;
                                seg0 = channel + 14;
                                break;
                        }
                }
        }
 
-       if (ssid->max_oper_chwidth == CHANWIDTH_80P80MHZ) {
+       if (ssid->max_oper_chwidth == CONF_OPER_CHWIDTH_80P80MHZ) {
                /* setup center_freq2, bandwidth */
                for (k = 0; k < ARRAY_SIZE(bw80); k++) {
                        /* Only accept 80 MHz segments separated by a gap */
@@ -2733,28 +2733,28 @@ skip_to_6ghz:
                                        continue;
 
                                /* Found a suitable second segment for 80+80 */
-                               chwidth = CHANWIDTH_80P80MHZ;
+                               chwidth = CONF_OPER_CHWIDTH_80P80MHZ;
                                if (!is_6ghz)
                                        vht_caps |=
                                                VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ;
                                seg1 = channel + 6;
                        }
 
-                       if (chwidth == CHANWIDTH_80P80MHZ)
+                       if (chwidth == CONF_OPER_CHWIDTH_80P80MHZ)
                                break;
                }
-       } else if (ssid->max_oper_chwidth == CHANWIDTH_160MHZ) {
+       } else if (ssid->max_oper_chwidth == CONF_OPER_CHWIDTH_160MHZ) {
                if (freq->freq == 5180) {
-                       chwidth = CHANWIDTH_160MHZ;
+                       chwidth = CONF_OPER_CHWIDTH_160MHZ;
                        vht_caps |= VHT_CAP_SUPP_CHAN_WIDTH_160MHZ;
                        seg0 = 50;
                } else if (freq->freq == 5520) {
-                       chwidth = CHANWIDTH_160MHZ;
+                       chwidth = CONF_OPER_CHWIDTH_160MHZ;
                        vht_caps |= VHT_CAP_SUPP_CHAN_WIDTH_160MHZ;
                        seg0 = 114;
                }
-       } else if (ssid->max_oper_chwidth == CHANWIDTH_USE_HT) {
-               chwidth = CHANWIDTH_USE_HT;
+       } else if (ssid->max_oper_chwidth == CONF_OPER_CHWIDTH_USE_HT) {
+               chwidth = CONF_OPER_CHWIDTH_USE_HT;
                seg0 = channel + 2;
 #ifdef CONFIG_HT_OVERRIDES
                if (ssid->disable_ht40)