]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
EHT: Process puncturing bitmap from channel switch event
authorAloka Dixit <quic_alokad@quicinc.com>
Tue, 14 Mar 2023 04:59:22 +0000 (21:59 -0700)
committerJouni Malinen <j@w1.fi>
Fri, 17 Mar 2023 17:49:57 +0000 (19:49 +0200)
Retrieve the puncturing bitmap sent by the driver in channel switch
events and add a new member punct_bitmap in struct ch_switch to store
it.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
src/ap/drv_callbacks.c
src/ap/hostapd.h
src/drivers/driver.h
src/drivers/driver_nl80211_event.c
wpa_supplicant/ap.c
wpa_supplicant/ap.h
wpa_supplicant/events.c

index 71c905ba6eebb006a5454cfeb667443bc84d6a57..6a044c542521fd4c538111f56c4ba1d08a69ca2d 100644 (file)
@@ -859,7 +859,7 @@ void hostapd_event_sta_opmode_changed(struct hostapd_data *hapd, const u8 *addr,
 
 void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
                             int offset, int width, int cf1, int cf2,
-                            int finished)
+                            u16 punct_bitmap, int finished)
 {
 #ifdef NEED_AP_MLME
        int channel, chwidth, is_dfs0, is_dfs;
@@ -868,14 +868,14 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
 
        hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
                       HOSTAPD_LEVEL_INFO,
-                      "driver %s channel switch: iface->freq=%d, freq=%d, ht=%d, vht_ch=0x%x, "
-                      "he_ch=0x%x, eht_ch=0x%x, offset=%d, width=%d (%s), cf1=%d, cf2=%d",
+                      "driver %s channel switch: iface->freq=%d, freq=%d, ht=%d, vht_ch=0x%x, he_ch=0x%x, eht_ch=0x%x, offset=%d, width=%d (%s), cf1=%d, cf2=%d, puncturing_bitmap=0x%x",
                       finished ? "had" : "starting",
                       hapd->iface->freq,
                       freq, ht, hapd->iconf->ch_switch_vht_config,
                       hapd->iconf->ch_switch_he_config,
                       hapd->iconf->ch_switch_eht_config, offset,
-                      width, channel_width_to_string(width), cf1, cf2);
+                      width, channel_width_to_string(width), cf1, cf2,
+                      punct_bitmap);
 
        if (!hapd->iface->current_mode) {
                hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211,
@@ -987,6 +987,9 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
        hostapd_set_oper_chwidth(hapd->iconf, chwidth);
        hostapd_set_oper_centr_freq_seg0_idx(hapd->iconf, seg0_idx);
        hostapd_set_oper_centr_freq_seg1_idx(hapd->iconf, seg1_idx);
+#ifdef CONFIG_IEEE80211BE
+       hapd->iconf->punct_bitmap = punct_bitmap;
+#endif /* CONFIG_IEEE80211BE */
        if (hapd->iconf->ieee80211ac) {
                hapd->iconf->vht_capab &= ~VHT_CAP_SUPP_CHAN_WIDTH_MASK;
                if (chwidth == CONF_OPER_CHWIDTH_160MHZ)
@@ -1001,11 +1004,11 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
                                  hapd->iface->num_hw_features);
 
        wpa_msg(hapd->msg_ctx, MSG_INFO,
-               "%sfreq=%d ht_enabled=%d ch_offset=%d ch_width=%s cf1=%d cf2=%d is_dfs0=%d dfs=%d",
+               "%sfreq=%d ht_enabled=%d ch_offset=%d ch_width=%s cf1=%d cf2=%d is_dfs0=%d dfs=%d puncturing_bitmap=0x%04x",
                finished ? WPA_EVENT_CHANNEL_SWITCH :
                WPA_EVENT_CHANNEL_SWITCH_STARTED,
                freq, ht, offset, channel_width_to_string(width),
-               cf1, cf2, is_dfs0, is_dfs);
+               cf1, cf2, is_dfs0, is_dfs, punct_bitmap);
        if (!finished)
                return;
 
@@ -2025,6 +2028,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
                                        data->ch_switch.ch_width,
                                        data->ch_switch.cf1,
                                        data->ch_switch.cf2,
+                                       data->ch_switch.punct_bitmap,
                                        event == EVENT_CH_SWITCH);
                break;
        case EVENT_CONNECT_FAILED_REASON:
index ed2ff4587729785590b35914c219096745d77ec3..5e16bc389b9861df86c05c12e301e349cb3530c2 100644 (file)
@@ -726,7 +726,7 @@ int hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa, const u8 *da,
                         int ssi_signal);
 void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht,
                             int offset, int width, int cf1, int cf2,
-                            int finished);
+                            u16 punct_bitmap, int finished);
 struct survey_results;
 void hostapd_event_get_survey(struct hostapd_iface *iface,
                              struct survey_results *survey_results);
index a79e0fb89049931123015915b6da7ce65cbb218b..31e300cd98abb43e1b4ce78aa196abb59507b08d 100644 (file)
@@ -6326,6 +6326,7 @@ union wpa_event_data {
         * @cf1: Center frequency 1
         * @cf2: Center frequency 2
         * @link_id: Link ID of the MLO link
+        * @punct_bitmap: Puncturing bitmap
         */
        struct ch_switch {
                int freq;
@@ -6335,6 +6336,7 @@ union wpa_event_data {
                int cf1;
                int cf2;
                int link_id;
+               u16 punct_bitmap;
        } ch_switch;
 
        /**
index 821629afe8736e65583b2539cf77625d8553882c..a6f8c97ca276b0d824530608aec4f20a4a27ff20 100644 (file)
@@ -995,7 +995,9 @@ static void mlme_event_ch_switch(struct wpa_driver_nl80211_data *drv,
                                 struct nlattr *ifindex, struct nlattr *link,
                                 struct nlattr *freq, struct nlattr *type,
                                 struct nlattr *bw, struct nlattr *cf1,
-                                struct nlattr *cf2, int finished)
+                                struct nlattr *cf2,
+                                struct nlattr *punct_bitmap,
+                                int finished)
 {
        struct i802_bss *bss;
        union wpa_event_data data;
@@ -1050,6 +1052,8 @@ static void mlme_event_ch_switch(struct wpa_driver_nl80211_data *drv,
        data.ch_switch.freq = nla_get_u32(freq);
        data.ch_switch.ht_enabled = ht_enabled;
        data.ch_switch.ch_offset = chan_offset;
+       if (punct_bitmap)
+               data.ch_switch.punct_bitmap = (u16) nla_get_u32(punct_bitmap);
        if (bw)
                data.ch_switch.ch_width = convert2width(nla_get_u32(bw));
        if (cf1)
@@ -3599,6 +3603,7 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd,
                                     tb[NL80211_ATTR_CHANNEL_WIDTH],
                                     tb[NL80211_ATTR_CENTER_FREQ1],
                                     tb[NL80211_ATTR_CENTER_FREQ2],
+                                    tb[NL80211_ATTR_PUNCT_BITMAP],
                                     0);
                break;
        case NL80211_CMD_CH_SWITCH_NOTIFY:
@@ -3610,6 +3615,7 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd,
                                     tb[NL80211_ATTR_CHANNEL_WIDTH],
                                     tb[NL80211_ATTR_CENTER_FREQ1],
                                     tb[NL80211_ATTR_CENTER_FREQ2],
+                                    tb[NL80211_ATTR_PUNCT_BITMAP],
                                     1);
                break;
        case NL80211_CMD_DISCONNECT:
index 30b1f74179df73b7afab42e8b821325df20cd795..ff7c75644dce719fb0749e65cca06ba9b4dd564d 100644 (file)
@@ -1839,7 +1839,8 @@ int ap_ctrl_iface_chanswitch(struct wpa_supplicant *wpa_s, const char *pos)
 
 
 void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht,
-                      int offset, int width, int cf1, int cf2, int finished)
+                      int offset, int width, int cf1, int cf2,
+                      u16 punct_bitmap, int finished)
 {
        struct hostapd_iface *iface = wpa_s->ap_iface;
 
@@ -1851,7 +1852,8 @@ void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht,
        if (wpa_s->current_ssid)
                wpa_s->current_ssid->frequency = freq;
        hostapd_event_ch_switch(iface->bss[0], freq, ht,
-                               offset, width, cf1, cf2, finished);
+                               offset, width, cf1, cf2, punct_bitmap,
+                               finished);
 }
 
 
index 865429e969e5f464fa0243c205ed78fd2fb20305..5835ecd876bea0b4d31a5ca5b63308788b4ad9f1 100644 (file)
@@ -73,7 +73,8 @@ int ap_switch_channel(struct wpa_supplicant *wpa_s,
                      struct csa_settings *settings);
 int ap_ctrl_iface_chanswitch(struct wpa_supplicant *wpa_s, const char *txtaddr);
 void wpas_ap_ch_switch(struct wpa_supplicant *wpa_s, int freq, int ht,
-                      int offset, int width, int cf1, int cf2, int finished);
+                      int offset, int width, int cf1, int cf2,
+                      u16 punct_bitmap, int finished);
 struct wpabuf * wpas_ap_wps_nfc_config_token(struct wpa_supplicant *wpa_s,
                                             int ndef);
 #ifdef CONFIG_AP
index 8f0ed2033da4fc27d76e60e8e2cc3ba3f5586b78..ebac8a1526b18d3e47660603e545bb442f7b4e2b 100644 (file)
@@ -5622,6 +5622,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
                                          data->ch_switch.ch_width,
                                          data->ch_switch.cf1,
                                          data->ch_switch.cf2,
+                                         data->ch_switch.punct_bitmap,
                                          1);
                }
 #endif /* CONFIG_AP */