From c68ba759850c7e1e35c017884b417b670998b820 Mon Sep 17 00:00:00 2001 From: Muna Sinada Date: Wed, 1 Dec 2021 15:53:47 -0800 Subject: [PATCH 3/6] ru_puncturing: add bitmap to frequency parameters Add ru_punct_bitmap and ru_punct_ofdma in frequency settings so that all commands using this code path will be able to configure the bitmap as well. Signed-off-by: Muna Sinada Signed-off-by: Aloka Dixit --- src/ap/ap_drv_ops.c | 12 ++++++++---- src/ap/ap_drv_ops.h | 6 ++++-- src/ap/beacon.c | 4 +++- src/ap/dfs.c | 11 ++++++++--- src/ap/hostapd.c | 8 ++++++-- src/common/hw_features_common.c | 5 ++++- src/common/hw_features_common.h | 3 ++- src/drivers/driver.h | 14 ++++++++++++++ wpa_supplicant/mesh.c | 4 +++- wpa_supplicant/wpa_supplicant.c | 3 ++- 10 files changed, 54 insertions(+), 16 deletions(-) diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c index cc2ee5e2edcc..2ba885898cd6 100644 --- a/src/ap/ap_drv_ops.c +++ b/src/ap/ap_drv_ops.c @@ -552,7 +552,8 @@ int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode, int ht_enabled, int vht_enabled, int he_enabled, int eht_enabled, int sec_channel_offset, int oper_chwidth, - int center_segment0, int center_segment1) + int center_segment0, int center_segment1, + u16 ru_punct_bitmap, u8 ru_punct_ofdma) { struct hostapd_freq_params data; struct hostapd_hw_modes *cmode = hapd->iface->current_mode; @@ -567,7 +568,8 @@ int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode, &cmode->he_capab[IEEE80211_MODE_AP] : NULL, cmode ? &cmode->eht_capab[IEEE80211_MODE_AP] : NULL, - hapd->iconf->he_6ghz_reg_pwr_type)) + hapd->iconf->he_6ghz_reg_pwr_type, + ru_punct_bitmap, ru_punct_ofdma)) return -1; if (hapd->driver == NULL) @@ -819,7 +821,8 @@ int hostapd_start_dfs_cac(struct hostapd_iface *iface, int channel, int ht_enabled, int vht_enabled, int he_enabled, int eht_enabled, int sec_channel_offset, int oper_chwidth, - int center_segment0, int center_segment1) + int center_segment0, int center_segment1, + u16 ru_punct_bitmap, u8 ru_punct_ofdma) { struct hostapd_data *hapd = iface->bss[0]; struct hostapd_freq_params data; @@ -844,7 +847,8 @@ int hostapd_start_dfs_cac(struct hostapd_iface *iface, cmode->vht_capab, &cmode->he_capab[IEEE80211_MODE_AP], &cmode->eht_capab[IEEE80211_MODE_AP], - hapd->iconf->he_6ghz_reg_pwr_type)) { + hapd->iconf->he_6ghz_reg_pwr_type, + ru_punct_bitmap, ru_punct_ofdma)) { wpa_printf(MSG_ERROR, "Can't set freq params"); return -1; } diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h index fcac1eeee6dc..9155f1abca9e 100644 --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h @@ -67,7 +67,8 @@ int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode, int freq, int channel, int edmg, u8 edmg_channel, int ht_enabled, int vht_enabled, int he_enabled, int eht_enabled, int sec_channel_offset, int oper_chwidth, - int center_segment0, int center_segment1); + int center_segment0, int center_segment1, + u16 ru_punct_bitmap, u8 ru_punct_ofdma); int hostapd_set_rts(struct hostapd_data *hapd, int rts); int hostapd_set_frag(struct hostapd_data *hapd, int frag); int hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr, @@ -131,7 +132,8 @@ int hostapd_start_dfs_cac(struct hostapd_iface *iface, int channel, int ht_enabled, int vht_enabled, int he_enabled, int eht_enabled, int sec_channel_offset, int oper_chwidth, - int center_segment0, int center_segment1); + int center_segment0, int center_segment1, + u16 ru_punct_bitmap, u8 ru_punct_ofdma); int hostapd_drv_do_acs(struct hostapd_data *hapd); int hostapd_drv_update_dh_ie(struct hostapd_data *hapd, const u8 *peer, u16 reason_code, const u8 *ie, size_t ielen); diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 9db8cf12e943..e331f9c95b12 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -2176,7 +2176,9 @@ static int __ieee802_11_set_beacon(struct hostapd_data *hapd) cmode->vht_capab, &cmode->he_capab[IEEE80211_MODE_AP], &cmode->eht_capab[IEEE80211_MODE_AP], - iconf->he_6ghz_reg_pwr_type) == 0) + iconf->he_6ghz_reg_pwr_type, + iconf->ru_punct_bitmap, + iconf->ru_punct_ofdma) == 0) params.freq = &freq; res = hostapd_drv_set_ap(hapd, ¶ms); diff --git a/src/ap/dfs.c b/src/ap/dfs.c index 29d2a8991256..c206eb713629 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -875,7 +875,8 @@ int hostapd_handle_dfs(struct hostapd_iface *iface) iface->conf->secondary_channel, hostapd_get_oper_chwidth(iface->conf), hostapd_get_oper_centr_freq_seg0_idx(iface->conf), - hostapd_get_oper_centr_freq_seg1_idx(iface->conf)); + hostapd_get_oper_centr_freq_seg1_idx(iface->conf), + iface->conf->ru_punct_bitmap, iface->conf->ru_punct_ofdma); if (res) { wpa_printf(MSG_ERROR, "DFS start_dfs_cac() failed, %d", res); @@ -1092,7 +1093,9 @@ static int hostapd_dfs_testmode_set_beacon_csa(struct hostapd_iface *iface) iface->current_mode->vht_capab, &iface->current_mode->he_capab[IEEE80211_MODE_AP], &iface->current_mode->eht_capab[IEEE80211_MODE_AP], - hapd->iconf->he_6ghz_reg_pwr_type); + hapd->iconf->he_6ghz_reg_pwr_type, + iface->conf->ru_punct_bitmap, + iface->conf->ru_punct_ofdma); if (err) { wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params"); @@ -1236,7 +1239,9 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) cmode->vht_capab, &cmode->he_capab[ieee80211_mode], &cmode->eht_capab[ieee80211_mode], - iface->conf->he_6ghz_reg_pwr_type); + iface->conf->he_6ghz_reg_pwr_type, + iface->conf->ru_punct_bitmap, + iface->conf->ru_punct_ofdma); if (err) { wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params"); diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index 0b623a2fcdf1..becb726c760b 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -2123,7 +2123,9 @@ static int hostapd_setup_interface_complete_sync(struct hostapd_iface *iface, hostapd_get_oper_centr_freq_seg0_idx( hapd->iconf), hostapd_get_oper_centr_freq_seg1_idx( - hapd->iconf))) { + hapd->iconf), + hapd->iconf->ru_punct_bitmap, + hapd->iconf->ru_punct_ofdma)) { wpa_printf(MSG_ERROR, "Could not set channel for " "kernel driver"); goto fail; @@ -3533,7 +3535,9 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd, mode ? &mode->he_capab[IEEE80211_MODE_AP] : NULL, mode ? &mode->eht_capab[IEEE80211_MODE_AP] : - NULL, hapd->iconf->he_6ghz_reg_pwr_type)) + NULL, hapd->iconf->he_6ghz_reg_pwr_type, + conf->ru_punct_bitmap, + conf->ru_punct_ofdma)) return -1; switch (params->bandwidth) { diff --git a/src/common/hw_features_common.c b/src/common/hw_features_common.c index 2e03265a2e72..786568b7d970 100644 --- a/src/common/hw_features_common.c +++ b/src/common/hw_features_common.c @@ -388,7 +388,8 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, int center_segment1, u32 vht_caps, struct he_capabilities *he_cap, struct eht_capabilities *eht_cap, - u8 reg_6g_pwr_mode) + u8 reg_6g_pwr_mode, u16 ru_punct_bitmap, + u8 ru_punct_ofdma) { if (!he_cap || !he_cap->he_supported) he_enabled = 0; @@ -403,6 +404,8 @@ 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; + data->ru_punct_bitmap = ru_punct_bitmap; + data->ru_punct_ofdma = ru_punct_ofdma; if (oper_chwidth == CHANWIDTH_80MHZ) data->bandwidth = 80; else if (oper_chwidth == CHANWIDTH_160MHZ || diff --git a/src/common/hw_features_common.h b/src/common/hw_features_common.h index 2971b719aaae..1efe293c9939 100644 --- a/src/common/hw_features_common.h +++ b/src/common/hw_features_common.h @@ -45,7 +45,8 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, int center_segment1, u32 vht_caps, struct he_capabilities *he_caps, struct eht_capabilities *eht_cap, - u8 reg_6g_pwr_mode); + u8 reg_6g_pwr_mode, u16 ru_punct_bitmap, + u8 ru_punct_ofdma); void set_disable_ht40(struct ieee80211_ht_capabilities *htcaps, int disabled); int ieee80211ac_cap_check(u32 hw, u32 conf); diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 2252a651c6ab..baf05489be8e 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -819,6 +819,20 @@ struct hostapd_freq_params { * eht_enabled - Whether EHT is enabled */ int eht_enabled; + + /** + * ru_punct_bitmap - RU puncturing bitmap + * Each bit corresponds to a 20 MHz subchannel, lowest bit for the + * channel with the lowest frequency. Bit set to 1 indicates that the + * subchannel is punctured, otherwise active. + */ + u16 ru_punct_bitmap; + + /** + * ru_punct_ofdma - If ru_punct_bitmap could be one of + * the OFDMA patterns + */ + u8 ru_punct_ofdma; }; /** diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index 15fe87b7e507..97116e049797 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -233,7 +233,9 @@ static int wpas_mesh_update_freq_params(struct wpa_supplicant *wpa_s) hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf), hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf), ifmsh->conf->vht_capab, - he_capab, NULL, ifmsh->conf->he_6ghz_reg_pwr_type)) { + he_capab, NULL, ifmsh->conf->he_6ghz_reg_pwr_type, + ifmsh->conf->ru_punct_bitmap, + ifmsh->conf->ru_punct_ofdma)) { wpa_printf(MSG_ERROR, "Error updating mesh frequency params"); wpa_supplicant_mesh_deinit(wpa_s, true); return -1; diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 07fc3d7ed8ec..cdaf23cf06fe 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2852,7 +2852,8 @@ skip_to_6ghz: 0, freq->sec_channel_offset, chwidth, seg0, seg1, vht_caps, &mode->he_capab[ieee80211_mode], NULL, - 0) != 0) + 0, freq->ru_punct_bitmap, + freq->ru_punct_ofdma) != 0) return; *freq = vht_freq; -- 2.31.1