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 5074225..d4ad8ea 100644 --- a/src/ap/ap_drv_ops.c +++ b/src/ap/ap_drv_ops.c @@ -573,7 +573,8 @@ int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode, int ht_enabled, int vht_enabled, int he_enabled, bool 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; @@ -589,7 +590,8 @@ int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode, 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) @@ -883,7 +885,8 @@ int hostapd_start_dfs_cac(struct hostapd_iface *iface, int he_enabled, bool eht_enabled, int sec_channel_offset, int oper_chwidth, int center_segment0, int center_segment1, - bool radar_background) + bool radar_background, + u16 ru_punct_bitmap, u8 ru_punct_ofdma) { struct hostapd_data *hapd = iface->bss[0]; struct hostapd_freq_params data; @@ -908,7 +911,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 19633f9..d29e523 100644 --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h @@ -68,7 +68,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, bool 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, @@ -133,7 +134,8 @@ int hostapd_start_dfs_cac(struct hostapd_iface *iface, int he_enabled, bool eht_enabled, int sec_channel_offset, int oper_chwidth, int center_segment0, int center_segment1, - bool radar_background); + bool radar_background, + 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 4d254f0..ecb142c 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -2208,7 +2208,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; for (i = 0; i < hapd->iface->num_hw_features; i++) { diff --git a/src/ap/dfs.c b/src/ap/dfs.c index 4a61da6..98b259e 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -986,7 +986,8 @@ int hostapd_handle_dfs(struct hostapd_iface *iface) hostapd_get_oper_chwidth(iface->conf), hostapd_get_oper_centr_freq_seg0_idx(iface->conf), hostapd_get_oper_centr_freq_seg1_idx(iface->conf), - dfs_use_radar_background(iface)); + dfs_use_radar_background(iface), + iface->conf->ru_punct_bitmap, iface->conf->ru_punct_ofdma); if (res) { wpa_printf(MSG_ERROR, "DFS start_dfs_cac() failed, %d", res); @@ -1082,7 +1083,9 @@ static int hostapd_dfs_request_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, @@ -1158,7 +1161,9 @@ static void hostpad_dfs_update_background_chain(struct hostapd_iface *iface) iface->conf->ieee80211be, sec, hostapd_get_oper_chwidth(iface->conf), oper_centr_freq_seg0_idx, - oper_centr_freq_seg1_idx, true)) { + oper_centr_freq_seg1_idx, true, + iface->conf->ru_punct_bitmap, + iface->conf->ru_punct_ofdma)) { wpa_printf(MSG_ERROR, "DFS failed to start CAC offchannel"); iface->radar_background.channel = -1; return; @@ -1228,7 +1233,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], - 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 9556dda..ac509b4 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -2422,7 +2422,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; @@ -3885,7 +3887,9 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd, NULL, mode ? &mode->eht_capab[IEEE80211_MODE_AP] : NULL, - hapd->iconf->he_6ghz_reg_pwr_type)) + 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 4f4cd66..a6056de 100644 --- a/src/common/hw_features_common.c +++ b/src/common/hw_features_common.c @@ -389,7 +389,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; @@ -406,6 +407,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 == CONF_OPER_CHWIDTH_80MHZ) data->bandwidth = 80; else if (oper_chwidth == CONF_OPER_CHWIDTH_160MHZ || diff --git a/src/common/hw_features_common.h b/src/common/hw_features_common.h index 398a257..bda5653 100644 --- a/src/common/hw_features_common.h +++ b/src/common/hw_features_common.h @@ -46,7 +46,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 aaf04ab..88acf9c 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -860,6 +860,20 @@ struct hostapd_freq_params { */ u8 he_6ghz_reg_pwr_type; + /** + * 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; + /** * link_id: If >=0 indicates the link of the AP MLD to configure */ diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index dcf9194..91b1cb2 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_seg1_idx(ifmsh->conf), ifmsh->conf->vht_capab, he_capab, NULL, - ifmsh->conf->he_6ghz_reg_pwr_type)) { + 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;