EHT: Configure puncturing bitmap during channel switch

Parse, validate, and configure puncturing bitmap if provided in the
channel switch command.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
This commit is contained in:
Aloka Dixit 2023-03-13 21:59:20 -07:00 committed by Jouni Malinen
parent 4942b19fff
commit 29a882bed3
4 changed files with 63 additions and 2 deletions

View file

@ -980,16 +980,27 @@ int hostapd_parse_csa_settings(const char *pos,
} \
} while (0)
#define SET_CSA_SETTING_EXT(str) \
do { \
const char *pos2 = os_strstr(pos, " " #str "="); \
if (pos2) { \
pos2 += sizeof(" " #str "=") - 1; \
settings->str = atoi(pos2); \
} \
} while (0)
SET_CSA_SETTING(center_freq1);
SET_CSA_SETTING(center_freq2);
SET_CSA_SETTING(bandwidth);
SET_CSA_SETTING(sec_channel_offset);
SET_CSA_SETTING_EXT(punct_bitmap);
settings->freq_params.ht_enabled = !!os_strstr(pos, " ht");
settings->freq_params.vht_enabled = !!os_strstr(pos, " vht");
settings->freq_params.he_enabled = !!os_strstr(pos, " he");
settings->freq_params.eht_enabled = !!os_strstr(pos, " eht");
settings->block_tx = !!os_strstr(pos, " blocktx");
#undef SET_CSA_SETTING
#undef SET_CSA_SETTING_EXT
return 0;
}

View file

@ -3655,6 +3655,9 @@ static int hostapd_fill_csa_settings(struct hostapd_data *hapd,
struct hostapd_iface *iface = hapd->iface;
struct hostapd_freq_params old_freq;
int ret;
#ifdef CONFIG_IEEE80211BE
u16 old_punct_bitmap;
#endif /* CONFIG_IEEE80211BE */
u8 chan, bandwidth;
os_memset(&old_freq, 0, sizeof(old_freq));
@ -3700,9 +3703,16 @@ static int hostapd_fill_csa_settings(struct hostapd_data *hapd,
if (ret)
return ret;
#ifdef CONFIG_IEEE80211BE
old_punct_bitmap = iface->conf->punct_bitmap;
iface->conf->punct_bitmap = settings->punct_bitmap;
#endif /* CONFIG_IEEE80211BE */
ret = hostapd_build_beacon_data(hapd, &settings->beacon_after);
/* change back the configuration */
#ifdef CONFIG_IEEE80211BE
iface->conf->punct_bitmap = old_punct_bitmap;
#endif /* CONFIG_IEEE80211BE */
hostapd_change_config_freq(iface->bss[0], iface->conf,
&old_freq, NULL);