blob: 8358b979cb3b9cc9cc30010fe39e4486671e8ac0 [file] [log] [blame]
developer05f3b2b2024-08-19 19:17:34 +08001From 562e8a54538b200256ba0e0d820951d88686044b Mon Sep 17 00:00:00 2001
2From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
3Date: Mon, 5 Aug 2024 14:56:17 +0800
4Subject: [PATCH 122/126] mtk: hostapd: fix 6G EHT BW 320 channel switch issue
5
6When channel switching from BW 320 to BW 160, the op class is not
7changed for building csa after beacon.
8Therefore, hostapd_eid_eht_operation will use the old op class to fill
9the EHT operation chwidth info for csa after beacon, leading to
10disconnections for stations due to an invalid chandef.
11
12Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
13---
14 src/ap/hostapd.c | 39 ++++++++++++++++++++++-----------------
15 src/drivers/driver.h | 5 +++++
16 2 files changed, 27 insertions(+), 17 deletions(-)
17
18diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
19index 6f7f13f9f..d06a0395b 100644
20--- a/src/ap/hostapd.c
21+++ b/src/ap/hostapd.c
22@@ -4496,23 +4496,26 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd,
23 mode = hapd->iface->current_mode;
24
25 /* if a pointer to old_params is provided we save previous state */
26- if (old_params &&
27- hostapd_set_freq_params(old_params, conf->hw_mode,
28- hostapd_hw_get_freq(hapd, conf->channel),
29- conf->channel, conf->enable_edmg,
30- conf->edmg_channel, conf->ieee80211n,
31- conf->ieee80211ac, conf->ieee80211ax,
32- conf->ieee80211be, conf->secondary_channel,
33- hostapd_get_oper_chwidth(conf),
34- hostapd_get_oper_centr_freq_seg0_idx(conf),
35- hostapd_get_oper_centr_freq_seg1_idx(conf),
36- conf->vht_capab,
37- mode ? &mode->he_capab[IEEE80211_MODE_AP] :
38- NULL,
39- mode ? &mode->eht_capab[IEEE80211_MODE_AP] :
40- NULL,
41- hostapd_get_punct_bitmap(hapd)))
42- return -1;
43+ if (old_params) {
44+ if (hostapd_set_freq_params(old_params, conf->hw_mode,
45+ hostapd_hw_get_freq(hapd, conf->channel),
46+ conf->channel, conf->enable_edmg,
47+ conf->edmg_channel, conf->ieee80211n,
48+ conf->ieee80211ac, conf->ieee80211ax,
49+ conf->ieee80211be, conf->secondary_channel,
50+ hostapd_get_oper_chwidth(conf),
51+ hostapd_get_oper_centr_freq_seg0_idx(conf),
52+ hostapd_get_oper_centr_freq_seg1_idx(conf),
53+ conf->vht_capab,
54+ mode ? &mode->he_capab[IEEE80211_MODE_AP] :
55+ NULL,
56+ mode ? &mode->eht_capab[IEEE80211_MODE_AP] :
57+ NULL,
58+ hostapd_get_punct_bitmap(hapd)))
59+ return -1;
60+
61+ old_params->op_class = conf->op_class;
62+ }
63
64 switch (params->bandwidth) {
65 case 0:
66@@ -4557,6 +4560,7 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd,
67 conf->ieee80211n = params->ht_enabled;
68 conf->ieee80211ac = params->vht_enabled;
69 conf->secondary_channel = params->sec_channel_offset;
70+ conf->op_class = params->op_class;
71 if (params->center_freq1 &&
72 ieee80211_freq_to_chan(params->center_freq1, &seg0) ==
73 NUM_HOSTAPD_MODES)
74@@ -4624,6 +4628,7 @@ static int hostapd_fill_csa_settings(struct hostapd_data *hapd,
75
76 settings->freq_params.channel = chan;
77
78+ settings->freq_params.op_class = hapd->iface->cs_oper_class;
79 ret = hostapd_change_config_freq(iface->bss[0], iface->conf,
80 &settings->freq_params,
81 &old_freq);
82diff --git a/src/drivers/driver.h b/src/drivers/driver.h
83index f3de2b3bc..829274bfe 100644
84--- a/src/drivers/driver.h
85+++ b/src/drivers/driver.h
86@@ -907,6 +907,11 @@ struct hostapd_freq_params {
87 * link_id: If >=0 indicates the link of the AP MLD to configure
88 */
89 int link_id;
90+
91+ /**
92+ * op_class: Operating class of the channel
93+ */
94+ u8 op_class;
95 };
96
97 /**
98--
992.18.0
100