| From 562e8a54538b200256ba0e0d820951d88686044b Mon Sep 17 00:00:00 2001 |
| From: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
| Date: Mon, 5 Aug 2024 14:56:17 +0800 |
| Subject: [PATCH 122/126] mtk: hostapd: fix 6G EHT BW 320 channel switch issue |
| |
| When channel switching from BW 320 to BW 160, the op class is not |
| changed for building csa after beacon. |
| Therefore, hostapd_eid_eht_operation will use the old op class to fill |
| the EHT operation chwidth info for csa after beacon, leading to |
| disconnections for stations due to an invalid chandef. |
| |
| Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
| --- |
| src/ap/hostapd.c | 39 ++++++++++++++++++++++----------------- |
| src/drivers/driver.h | 5 +++++ |
| 2 files changed, 27 insertions(+), 17 deletions(-) |
| |
| diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c |
| index 6f7f13f9f..d06a0395b 100644 |
| --- a/src/ap/hostapd.c |
| +++ b/src/ap/hostapd.c |
| @@ -4496,23 +4496,26 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd, |
| mode = hapd->iface->current_mode; |
| |
| /* if a pointer to old_params is provided we save previous state */ |
| - if (old_params && |
| - hostapd_set_freq_params(old_params, conf->hw_mode, |
| - hostapd_hw_get_freq(hapd, conf->channel), |
| - conf->channel, conf->enable_edmg, |
| - conf->edmg_channel, conf->ieee80211n, |
| - conf->ieee80211ac, conf->ieee80211ax, |
| - conf->ieee80211be, conf->secondary_channel, |
| - hostapd_get_oper_chwidth(conf), |
| - hostapd_get_oper_centr_freq_seg0_idx(conf), |
| - hostapd_get_oper_centr_freq_seg1_idx(conf), |
| - conf->vht_capab, |
| - mode ? &mode->he_capab[IEEE80211_MODE_AP] : |
| - NULL, |
| - mode ? &mode->eht_capab[IEEE80211_MODE_AP] : |
| - NULL, |
| - hostapd_get_punct_bitmap(hapd))) |
| - return -1; |
| + if (old_params) { |
| + if (hostapd_set_freq_params(old_params, conf->hw_mode, |
| + hostapd_hw_get_freq(hapd, conf->channel), |
| + conf->channel, conf->enable_edmg, |
| + conf->edmg_channel, conf->ieee80211n, |
| + conf->ieee80211ac, conf->ieee80211ax, |
| + conf->ieee80211be, conf->secondary_channel, |
| + hostapd_get_oper_chwidth(conf), |
| + hostapd_get_oper_centr_freq_seg0_idx(conf), |
| + hostapd_get_oper_centr_freq_seg1_idx(conf), |
| + conf->vht_capab, |
| + mode ? &mode->he_capab[IEEE80211_MODE_AP] : |
| + NULL, |
| + mode ? &mode->eht_capab[IEEE80211_MODE_AP] : |
| + NULL, |
| + hostapd_get_punct_bitmap(hapd))) |
| + return -1; |
| + |
| + old_params->op_class = conf->op_class; |
| + } |
| |
| switch (params->bandwidth) { |
| case 0: |
| @@ -4557,6 +4560,7 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd, |
| conf->ieee80211n = params->ht_enabled; |
| conf->ieee80211ac = params->vht_enabled; |
| conf->secondary_channel = params->sec_channel_offset; |
| + conf->op_class = params->op_class; |
| if (params->center_freq1 && |
| ieee80211_freq_to_chan(params->center_freq1, &seg0) == |
| NUM_HOSTAPD_MODES) |
| @@ -4624,6 +4628,7 @@ static int hostapd_fill_csa_settings(struct hostapd_data *hapd, |
| |
| settings->freq_params.channel = chan; |
| |
| + settings->freq_params.op_class = hapd->iface->cs_oper_class; |
| ret = hostapd_change_config_freq(iface->bss[0], iface->conf, |
| &settings->freq_params, |
| &old_freq); |
| diff --git a/src/drivers/driver.h b/src/drivers/driver.h |
| index f3de2b3bc..829274bfe 100644 |
| --- a/src/drivers/driver.h |
| +++ b/src/drivers/driver.h |
| @@ -907,6 +907,11 @@ struct hostapd_freq_params { |
| * link_id: If >=0 indicates the link of the AP MLD to configure |
| */ |
| int link_id; |
| + |
| + /** |
| + * op_class: Operating class of the channel |
| + */ |
| + u8 op_class; |
| }; |
| |
| /** |
| -- |
| 2.18.0 |
| |