]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
EHT: Move puncturing bitmap determination into a helper function
authorJouni Malinen <quic_jouni@quicinc.com>
Fri, 8 Mar 2024 08:00:35 +0000 (10:00 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 8 Mar 2024 08:00:35 +0000 (10:00 +0200)
Avoid duplicated implementation for this by using a shared helper
function.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/ap/hostapd.c
src/ap/hostapd.h
src/ap/ieee802_11_eht.c
src/ap/ieee802_11_vht.c

index 0def1b918a015c26f9db0cfcc6c098f959cc1d26..0b805ba107f8ff8aeabd14a5152fea2b326ccc8f 100644 (file)
@@ -4425,3 +4425,19 @@ struct hostapd_data * hostapd_mld_get_link_bss(struct hostapd_data *hapd,
        return NULL;
 }
 #endif /* CONFIG_IEEE80211BE */
+
+
+u16 hostapd_get_punct_bitmap(struct hostapd_data *hapd)
+{
+       u16 punct_bitmap = 0;
+
+#ifdef CONFIG_IEEE80211BE
+       punct_bitmap = hapd->iconf->punct_bitmap;
+#ifdef CONFIG_TESTING_OPTIONS
+       if (!punct_bitmap)
+               punct_bitmap = hapd->conf->eht_oper_puncturing_override;
+#endif /* CONFIG_TESTING_OPTIONS */
+#endif /* CONFIG_IEEE80211BE */
+
+       return punct_bitmap;
+}
index 22540bb371c19583a4d809159b9d0b44512eb4ce..9be762c244c1e34f20a57f0f6f33b782f17f62a9 100644 (file)
@@ -801,4 +801,6 @@ int hostapd_link_remove(struct hostapd_data *hapd, u32 count);
        if (false)
 #endif /* CONFIG_IEEE80211BE */
 
+u16 hostapd_get_punct_bitmap(struct hostapd_data *hapd);
+
 #endif /* HOSTAPD_H */
index b599e10433ffa248f367b76ef66174dbb2901fd7..e4590b9ff74af094402775f49e53260dc12f3f7d 100644 (file)
@@ -206,19 +206,11 @@ u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid)
        enum oper_chan_width chwidth;
        size_t elen = 1 + 4;
        bool eht_oper_info_present;
-       u16 punct_bitmap = conf->punct_bitmap;
+       u16 punct_bitmap = hostapd_get_punct_bitmap(hapd);
 
        if (!hapd->iface->current_mode)
                return eid;
 
-#ifdef CONFIG_TESTING_OPTIONS
-       if (!punct_bitmap && hapd->conf->eht_oper_puncturing_override) {
-               wpa_printf(MSG_DEBUG, "EHT: Puncturing mask override=0x%x",
-                          hapd->conf->eht_oper_puncturing_override);
-               punct_bitmap = hapd->conf->eht_oper_puncturing_override;
-       }
-#endif /* CONFIG_TESTING_OPTIONS */
-
        if (is_6ghz_op_class(conf->op_class))
                chwidth = op_class_to_ch_width(conf->op_class);
        else
index f942aa78c3af9d7a4042c00f8df8da6b87e7789b..e92851af98770708e6beb08a9ae6d6c570be5cd1 100644 (file)
@@ -80,7 +80,7 @@ u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid)
        u8 seg0 = hapd->iconf->vht_oper_centr_freq_seg0_idx;
        u8 seg1 = hapd->iconf->vht_oper_centr_freq_seg1_idx;
 #ifdef CONFIG_IEEE80211BE
-       u16 punct_bitmap = hapd->iconf->punct_bitmap;
+       u16 punct_bitmap = hostapd_get_punct_bitmap(hapd);
 #endif /* CONFIG_IEEE80211BE */
 
        if (is_6ghz_op_class(hapd->iconf->op_class))
@@ -93,10 +93,6 @@ u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid)
        os_memset(oper, 0, sizeof(*oper));
 
 #ifdef CONFIG_IEEE80211BE
-#ifdef CONFIG_TESTING_OPTIONS
-       if (!punct_bitmap && hapd->conf->eht_oper_puncturing_override)
-               punct_bitmap = hapd->conf->eht_oper_puncturing_override;
-#endif /* CONFIG_TESTING_OPTIONS */
        if (punct_bitmap) {
                punct_update_legacy_bw(punct_bitmap,
                                       hapd->iconf->channel,