mac80211: ath11k: sync with ath-next
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / ath11k / 0045-wifi-ath11k-add-debug-prints-in-regulatory-WMI-event.patch
1 From e238e62ba8868a784e485eb94451c87cd1b85cee Mon Sep 17 00:00:00 2001
2 From: Aditya Kumar Singh <quic_adisi@quicinc.com>
3 Date: Wed, 1 Mar 2023 16:20:59 +0200
4 Subject: [PATCH] wifi: ath11k: add debug prints in regulatory WMI event
5 processing
6
7 Add some more debug prints in processing regulatory WMI event in order to
8 increase more debuggability.
9
10 Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
11 Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.7.0.1-01744-QCAHKSWPL_SILICONZ-1
12 Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
13
14 Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
15 Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
16 Link: https://lore.kernel.org/r/20230110121024.14051-4-quic_adisi@quicinc.com
17 ---
18 drivers/net/wireless/ath/ath11k/reg.c | 2 +-
19 drivers/net/wireless/ath/ath11k/wmi.c | 207 ++++++++++++++++++--------
20 drivers/net/wireless/ath/ath11k/wmi.h | 142 ++++++++++++++++++
21 3 files changed, 291 insertions(+), 60 deletions(-)
22
23 --- a/drivers/net/wireless/ath/ath11k/reg.c
24 +++ b/drivers/net/wireless/ath/ath11k/reg.c
25 @@ -646,7 +646,7 @@ ath11k_reg_build_regd(struct ath11k_base
26 tmp_regd->dfs_region = ath11k_map_fw_dfs_region(reg_info->dfs_region);
27
28 ath11k_dbg(ab, ATH11K_DBG_REG,
29 - "\r\nCountry %s, CFG Regdomain %s FW Regdomain %d, num_reg_rules %d\n",
30 + "Country %s, CFG Regdomain %s FW Regdomain %d, num_reg_rules %d\n",
31 alpha2, ath11k_reg_get_regdom_str(tmp_regd->dfs_region),
32 reg_info->dfs_region, num_rules);
33 /* Update reg_rules[] below. Firmware is expected to
34 --- a/drivers/net/wireless/ath/ath11k/wmi.c
35 +++ b/drivers/net/wireless/ath/ath11k/wmi.c
36 @@ -4925,6 +4925,26 @@ static int ath11k_pull_vdev_start_resp_t
37 return 0;
38 }
39
40 +static void ath11k_print_reg_rule(struct ath11k_base *ab, const char *band,
41 + u32 num_reg_rules,
42 + struct cur_reg_rule *reg_rule_ptr)
43 +{
44 + struct cur_reg_rule *reg_rule = reg_rule_ptr;
45 + u32 count;
46 +
47 + ath11k_dbg(ab, ATH11K_DBG_WMI, "number of reg rules in %s band: %d\n",
48 + band, num_reg_rules);
49 +
50 + for (count = 0; count < num_reg_rules; count++) {
51 + ath11k_dbg(ab, ATH11K_DBG_WMI,
52 + "reg rule %d: (%d - %d @ %d) (%d, %d) (FLAGS %d)\n",
53 + count + 1, reg_rule->start_freq, reg_rule->end_freq,
54 + reg_rule->max_bw, reg_rule->ant_gain,
55 + reg_rule->reg_power, reg_rule->flags);
56 + reg_rule++;
57 + }
58 +}
59 +
60 static struct cur_reg_rule
61 *create_reg_rules_from_wmi(u32 num_reg_rules,
62 struct wmi_regulatory_rule_struct *wmi_reg_rule)
63 @@ -5006,6 +5026,10 @@ static int ath11k_pull_reg_chan_list_upd
64 reg_info->ctry_code = chan_list_event_hdr->country_id;
65 reg_info->reg_dmn_pair = chan_list_event_hdr->domain_code;
66
67 + ath11k_dbg(ab, ATH11K_DBG_WMI,
68 + "status_code %s",
69 + ath11k_cc_status_to_str(reg_info->status_code));
70 +
71 reg_info->status_code =
72 ath11k_wmi_cc_setting_code_to_reg(chan_list_event_hdr->status_code);
73
74 @@ -5020,13 +5044,13 @@ static int ath11k_pull_reg_chan_list_upd
75 num_5ghz_reg_rules = reg_info->num_5ghz_reg_rules;
76
77 ath11k_dbg(ab, ATH11K_DBG_WMI,
78 - "%s:cc %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d",
79 - __func__, reg_info->alpha2, reg_info->dfs_region,
80 + "cc %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d",
81 + reg_info->alpha2, reg_info->dfs_region,
82 reg_info->min_bw_2ghz, reg_info->max_bw_2ghz,
83 reg_info->min_bw_5ghz, reg_info->max_bw_5ghz);
84
85 ath11k_dbg(ab, ATH11K_DBG_WMI,
86 - "%s: num_2ghz_reg_rules %d num_5ghz_reg_rules %d", __func__,
87 + "num_2ghz_reg_rules %d num_5ghz_reg_rules %d",
88 num_2ghz_reg_rules, num_5ghz_reg_rules);
89
90 wmi_reg_rule =
91 @@ -5043,6 +5067,10 @@ static int ath11k_pull_reg_chan_list_upd
92 ath11k_warn(ab, "Unable to Allocate memory for 2 GHz rules\n");
93 return -ENOMEM;
94 }
95 +
96 + ath11k_print_reg_rule(ab, "2 GHz",
97 + num_2ghz_reg_rules,
98 + reg_info->reg_rules_2ghz_ptr);
99 }
100
101 if (num_5ghz_reg_rules) {
102 @@ -5055,6 +5083,10 @@ static int ath11k_pull_reg_chan_list_upd
103 ath11k_warn(ab, "Unable to Allocate memory for 5 GHz rules\n");
104 return -ENOMEM;
105 }
106 +
107 + ath11k_print_reg_rule(ab, "5 GHz",
108 + num_5ghz_reg_rules,
109 + reg_info->reg_rules_5ghz_ptr);
110 }
111
112 ath11k_dbg(ab, ATH11K_DBG_WMI, "processed regulatory channel list\n");
113 @@ -5128,7 +5160,7 @@ static int ath11k_pull_reg_chan_list_ext
114 struct cur_regulatory_info *reg_info)
115 {
116 const void **tb;
117 - const struct wmi_reg_chan_list_cc_ext_event *ext_chan_list_event_hdr;
118 + const struct wmi_reg_chan_list_cc_ext_event *ev;
119 struct wmi_regulatory_ext_rule *ext_wmi_reg_rule;
120 u32 num_2ghz_reg_rules, num_5ghz_reg_rules;
121 u32 num_6ghz_reg_rules_ap[WMI_REG_CURRENT_MAX_AP_TYPE];
122 @@ -5145,31 +5177,29 @@ static int ath11k_pull_reg_chan_list_ext
123 return ret;
124 }
125
126 - ext_chan_list_event_hdr = tb[WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT];
127 - if (!ext_chan_list_event_hdr) {
128 + ev = tb[WMI_TAG_REG_CHAN_LIST_CC_EXT_EVENT];
129 + if (!ev) {
130 ath11k_warn(ab, "failed to fetch reg chan list ext update ev\n");
131 kfree(tb);
132 return -EPROTO;
133 }
134
135 - reg_info->num_2ghz_reg_rules =
136 - ext_chan_list_event_hdr->num_2ghz_reg_rules;
137 - reg_info->num_5ghz_reg_rules =
138 - ext_chan_list_event_hdr->num_5ghz_reg_rules;
139 + reg_info->num_2ghz_reg_rules = ev->num_2ghz_reg_rules;
140 + reg_info->num_5ghz_reg_rules = ev->num_5ghz_reg_rules;
141 reg_info->num_6ghz_rules_ap[WMI_REG_INDOOR_AP] =
142 - ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_lpi;
143 + ev->num_6ghz_reg_rules_ap_lpi;
144 reg_info->num_6ghz_rules_ap[WMI_REG_STANDARD_POWER_AP] =
145 - ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_sp;
146 + ev->num_6ghz_reg_rules_ap_sp;
147 reg_info->num_6ghz_rules_ap[WMI_REG_VERY_LOW_POWER_AP] =
148 - ext_chan_list_event_hdr->num_6ghz_reg_rules_ap_vlp;
149 + ev->num_6ghz_reg_rules_ap_vlp;
150
151 for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) {
152 reg_info->num_6ghz_rules_client[WMI_REG_INDOOR_AP][i] =
153 - ext_chan_list_event_hdr->num_6ghz_reg_rules_client_lpi[i];
154 + ev->num_6ghz_reg_rules_client_lpi[i];
155 reg_info->num_6ghz_rules_client[WMI_REG_STANDARD_POWER_AP][i] =
156 - ext_chan_list_event_hdr->num_6ghz_reg_rules_client_sp[i];
157 + ev->num_6ghz_reg_rules_client_sp[i];
158 reg_info->num_6ghz_rules_client[WMI_REG_VERY_LOW_POWER_AP][i] =
159 - ext_chan_list_event_hdr->num_6ghz_reg_rules_client_vlp[i];
160 + ev->num_6ghz_reg_rules_client_vlp[i];
161 }
162
163 num_2ghz_reg_rules = reg_info->num_2ghz_reg_rules;
164 @@ -5231,57 +5261,79 @@ static int ath11k_pull_reg_chan_list_ext
165 return -EINVAL;
166 }
167
168 - memcpy(reg_info->alpha2, &ext_chan_list_event_hdr->alpha2,
169 - REG_ALPHA2_LEN);
170 + memcpy(reg_info->alpha2, &ev->alpha2, REG_ALPHA2_LEN);
171 +
172 + reg_info->dfs_region = ev->dfs_region;
173 + reg_info->phybitmap = ev->phybitmap;
174 + reg_info->num_phy = ev->num_phy;
175 + reg_info->phy_id = ev->phy_id;
176 + reg_info->ctry_code = ev->country_id;
177 + reg_info->reg_dmn_pair = ev->domain_code;
178
179 - reg_info->dfs_region = ext_chan_list_event_hdr->dfs_region;
180 - reg_info->phybitmap = ext_chan_list_event_hdr->phybitmap;
181 - reg_info->num_phy = ext_chan_list_event_hdr->num_phy;
182 - reg_info->phy_id = ext_chan_list_event_hdr->phy_id;
183 - reg_info->ctry_code = ext_chan_list_event_hdr->country_id;
184 - reg_info->reg_dmn_pair = ext_chan_list_event_hdr->domain_code;
185 + ath11k_dbg(ab, ATH11K_DBG_WMI,
186 + "status_code %s",
187 + ath11k_cc_status_to_str(reg_info->status_code));
188
189 reg_info->status_code =
190 - ath11k_wmi_cc_setting_code_to_reg(ext_chan_list_event_hdr->status_code);
191 + ath11k_wmi_cc_setting_code_to_reg(ev->status_code);
192
193 reg_info->is_ext_reg_event = true;
194
195 - reg_info->min_bw_2ghz = ext_chan_list_event_hdr->min_bw_2ghz;
196 - reg_info->max_bw_2ghz = ext_chan_list_event_hdr->max_bw_2ghz;
197 - reg_info->min_bw_5ghz = ext_chan_list_event_hdr->min_bw_5ghz;
198 - reg_info->max_bw_5ghz = ext_chan_list_event_hdr->max_bw_5ghz;
199 + reg_info->min_bw_2ghz = ev->min_bw_2ghz;
200 + reg_info->max_bw_2ghz = ev->max_bw_2ghz;
201 + reg_info->min_bw_5ghz = ev->min_bw_5ghz;
202 + reg_info->max_bw_5ghz = ev->max_bw_5ghz;
203
204 reg_info->min_bw_6ghz_ap[WMI_REG_INDOOR_AP] =
205 - ext_chan_list_event_hdr->min_bw_6ghz_ap_lpi;
206 + ev->min_bw_6ghz_ap_lpi;
207 reg_info->max_bw_6ghz_ap[WMI_REG_INDOOR_AP] =
208 - ext_chan_list_event_hdr->max_bw_6ghz_ap_lpi;
209 + ev->max_bw_6ghz_ap_lpi;
210 reg_info->min_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP] =
211 - ext_chan_list_event_hdr->min_bw_6ghz_ap_sp;
212 + ev->min_bw_6ghz_ap_sp;
213 reg_info->max_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP] =
214 - ext_chan_list_event_hdr->max_bw_6ghz_ap_sp;
215 + ev->max_bw_6ghz_ap_sp;
216 reg_info->min_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] =
217 - ext_chan_list_event_hdr->min_bw_6ghz_ap_vlp;
218 + ev->min_bw_6ghz_ap_vlp;
219 reg_info->max_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] =
220 - ext_chan_list_event_hdr->max_bw_6ghz_ap_vlp;
221 + ev->max_bw_6ghz_ap_vlp;
222 +
223 + ath11k_dbg(ab, ATH11K_DBG_WMI,
224 + "6 GHz AP BW: LPI (%d - %d), SP (%d - %d), VLP (%d - %d)\n",
225 + reg_info->min_bw_6ghz_ap[WMI_REG_INDOOR_AP],
226 + reg_info->max_bw_6ghz_ap[WMI_REG_INDOOR_AP],
227 + reg_info->min_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP],
228 + reg_info->max_bw_6ghz_ap[WMI_REG_STANDARD_POWER_AP],
229 + reg_info->min_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP],
230 + reg_info->max_bw_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP]);
231
232 for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) {
233 reg_info->min_bw_6ghz_client[WMI_REG_INDOOR_AP][i] =
234 - ext_chan_list_event_hdr->min_bw_6ghz_client_lpi[i];
235 + ev->min_bw_6ghz_client_lpi[i];
236 reg_info->max_bw_6ghz_client[WMI_REG_INDOOR_AP][i] =
237 - ext_chan_list_event_hdr->max_bw_6ghz_client_lpi[i];
238 + ev->max_bw_6ghz_client_lpi[i];
239 reg_info->min_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] =
240 - ext_chan_list_event_hdr->min_bw_6ghz_client_sp[i];
241 + ev->min_bw_6ghz_client_sp[i];
242 reg_info->max_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] =
243 - ext_chan_list_event_hdr->max_bw_6ghz_client_sp[i];
244 + ev->max_bw_6ghz_client_sp[i];
245 reg_info->min_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] =
246 - ext_chan_list_event_hdr->min_bw_6ghz_client_vlp[i];
247 + ev->min_bw_6ghz_client_vlp[i];
248 reg_info->max_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] =
249 - ext_chan_list_event_hdr->max_bw_6ghz_client_vlp[i];
250 + ev->max_bw_6ghz_client_vlp[i];
251 +
252 + ath11k_dbg(ab, ATH11K_DBG_WMI,
253 + "6 GHz %s BW: LPI (%d - %d), SP (%d - %d), VLP (%d - %d)\n",
254 + ath11k_6ghz_client_type_to_str(i),
255 + reg_info->min_bw_6ghz_client[WMI_REG_INDOOR_AP][i],
256 + reg_info->max_bw_6ghz_client[WMI_REG_INDOOR_AP][i],
257 + reg_info->min_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i],
258 + reg_info->max_bw_6ghz_client[WMI_REG_STANDARD_POWER_AP][i],
259 + reg_info->min_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i],
260 + reg_info->max_bw_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i]);
261 }
262
263 ath11k_dbg(ab, ATH11K_DBG_WMI,
264 - "%s:cc_ext %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d",
265 - __func__, reg_info->alpha2, reg_info->dfs_region,
266 + "cc_ext %s dsf %d BW: min_2ghz %d max_2ghz %d min_5ghz %d max_5ghz %d",
267 + reg_info->alpha2, reg_info->dfs_region,
268 reg_info->min_bw_2ghz, reg_info->max_bw_2ghz,
269 reg_info->min_bw_5ghz, reg_info->max_bw_5ghz);
270
271 @@ -5310,9 +5362,8 @@ static int ath11k_pull_reg_chan_list_ext
272 num_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][j]);
273
274 ext_wmi_reg_rule =
275 - (struct wmi_regulatory_ext_rule *)((u8 *)ext_chan_list_event_hdr
276 - + sizeof(*ext_chan_list_event_hdr)
277 - + sizeof(struct wmi_tlv));
278 + (struct wmi_regulatory_ext_rule *)((u8 *)ev + sizeof(*ev) +
279 + sizeof(struct wmi_tlv));
280 if (num_2ghz_reg_rules) {
281 reg_info->reg_rules_2ghz_ptr =
282 create_ext_reg_rules_from_wmi(num_2ghz_reg_rules,
283 @@ -5323,6 +5374,10 @@ static int ath11k_pull_reg_chan_list_ext
284 ath11k_warn(ab, "Unable to Allocate memory for 2 GHz rules\n");
285 return -ENOMEM;
286 }
287 +
288 + ath11k_print_reg_rule(ab, "2 GHz",
289 + num_2ghz_reg_rules,
290 + reg_info->reg_rules_2ghz_ptr);
291 }
292
293 ext_wmi_reg_rule += num_2ghz_reg_rules;
294 @@ -5358,6 +5413,10 @@ static int ath11k_pull_reg_chan_list_ext
295 ath11k_warn(ab, "Unable to Allocate memory for 5 GHz rules\n");
296 return -ENOMEM;
297 }
298 +
299 + ath11k_print_reg_rule(ab, "5 GHz",
300 + num_5ghz_reg_rules,
301 + reg_info->reg_rules_5ghz_ptr);
302 }
303
304 /* We have adjusted the number of 5 GHz reg rules above. But still those
305 @@ -5378,10 +5437,17 @@ static int ath11k_pull_reg_chan_list_ext
306 return -ENOMEM;
307 }
308
309 + ath11k_print_reg_rule(ab, ath11k_6ghz_ap_type_to_str(i),
310 + num_6ghz_reg_rules_ap[i],
311 + reg_info->reg_rules_6ghz_ap_ptr[i]);
312 +
313 ext_wmi_reg_rule += num_6ghz_reg_rules_ap[i];
314 }
315
316 for (j = 0; j < WMI_REG_CURRENT_MAX_AP_TYPE; j++) {
317 + ath11k_dbg(ab, ATH11K_DBG_WMI,
318 + "6 GHz AP type %s", ath11k_6ghz_ap_type_to_str(j));
319 +
320 for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) {
321 reg_info->reg_rules_6ghz_client_ptr[j][i] =
322 create_ext_reg_rules_from_wmi(num_6ghz_client[j][i],
323 @@ -5393,35 +5459,58 @@ static int ath11k_pull_reg_chan_list_ext
324 return -ENOMEM;
325 }
326
327 + ath11k_print_reg_rule(ab,
328 + ath11k_6ghz_client_type_to_str(i),
329 + num_6ghz_client[j][i],
330 + reg_info->reg_rules_6ghz_client_ptr[j][i]);
331 +
332 ext_wmi_reg_rule += num_6ghz_client[j][i];
333 }
334 }
335
336 - reg_info->client_type = ext_chan_list_event_hdr->client_type;
337 - reg_info->rnr_tpe_usable = ext_chan_list_event_hdr->rnr_tpe_usable;
338 + reg_info->client_type = ev->client_type;
339 + reg_info->rnr_tpe_usable = ev->rnr_tpe_usable;
340 reg_info->unspecified_ap_usable =
341 - ext_chan_list_event_hdr->unspecified_ap_usable;
342 + ev->unspecified_ap_usable;
343 reg_info->domain_code_6ghz_ap[WMI_REG_INDOOR_AP] =
344 - ext_chan_list_event_hdr->domain_code_6ghz_ap_lpi;
345 + ev->domain_code_6ghz_ap_lpi;
346 reg_info->domain_code_6ghz_ap[WMI_REG_STANDARD_POWER_AP] =
347 - ext_chan_list_event_hdr->domain_code_6ghz_ap_sp;
348 + ev->domain_code_6ghz_ap_sp;
349 reg_info->domain_code_6ghz_ap[WMI_REG_VERY_LOW_POWER_AP] =
350 - ext_chan_list_event_hdr->domain_code_6ghz_ap_vlp;
351 + ev->domain_code_6ghz_ap_vlp;
352 +
353 + ath11k_dbg(ab, ATH11K_DBG_WMI,
354 + "6 GHz reg info client type %s rnr_tpe_usable %d unspecified_ap_usable %d AP sub domain: lpi %s, sp %s, vlp %s\n",
355 + ath11k_6ghz_client_type_to_str(reg_info->client_type),
356 + reg_info->rnr_tpe_usable,
357 + reg_info->unspecified_ap_usable,
358 + ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_ap_lpi),
359 + ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_ap_sp),
360 + ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_ap_vlp));
361
362 for (i = 0; i < WMI_REG_MAX_CLIENT_TYPE; i++) {
363 reg_info->domain_code_6ghz_client[WMI_REG_INDOOR_AP][i] =
364 - ext_chan_list_event_hdr->domain_code_6ghz_client_lpi[i];
365 + ev->domain_code_6ghz_client_lpi[i];
366 reg_info->domain_code_6ghz_client[WMI_REG_STANDARD_POWER_AP][i] =
367 - ext_chan_list_event_hdr->domain_code_6ghz_client_sp[i];
368 + ev->domain_code_6ghz_client_sp[i];
369 reg_info->domain_code_6ghz_client[WMI_REG_VERY_LOW_POWER_AP][i] =
370 - ext_chan_list_event_hdr->domain_code_6ghz_client_vlp[i];
371 + ev->domain_code_6ghz_client_vlp[i];
372 +
373 + ath11k_dbg(ab, ATH11K_DBG_WMI,
374 + "6 GHz client type %s client sub domain: lpi %s, sp %s, vlp %s\n",
375 + ath11k_6ghz_client_type_to_str(i),
376 + ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_client_lpi[i]),
377 + ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_client_sp[i]),
378 + ath11k_sub_reg_6ghz_to_str(ev->domain_code_6ghz_client_vlp[i])
379 + );
380 }
381
382 - reg_info->domain_code_6ghz_super_id =
383 - ext_chan_list_event_hdr->domain_code_6ghz_super_id;
384 + reg_info->domain_code_6ghz_super_id = ev->domain_code_6ghz_super_id;
385
386 - ath11k_dbg(ab, ATH11K_DBG_WMI, "6 GHz client_type: %d domain_code_6ghz_super_id: %d",
387 - reg_info->client_type, reg_info->domain_code_6ghz_super_id);
388 + ath11k_dbg(ab, ATH11K_DBG_WMI,
389 + "6 GHz client_type %s 6 GHz super domain %s",
390 + ath11k_6ghz_client_type_to_str(reg_info->client_type),
391 + ath11k_super_reg_6ghz_to_str(reg_info->domain_code_6ghz_super_id));
392
393 ath11k_dbg(ab, ATH11K_DBG_WMI, "processed regulatory ext channel list\n");
394
395 --- a/drivers/net/wireless/ath/ath11k/wmi.h
396 +++ b/drivers/net/wireless/ath/ath11k/wmi.h
397 @@ -4139,6 +4139,7 @@ enum cc_setting_code {
398
399 /* add new setting code above, update in
400 * @enum wmi_reg_cc_setting_code as well.
401 + * Also handle it in ath11k_cc_status_to_str()
402 */
403 };
404
405 @@ -4163,21 +4164,162 @@ ath11k_wmi_cc_setting_code_to_reg(enum w
406 return REG_SET_CC_STATUS_FAIL;
407 }
408
409 +static inline const char *ath11k_cc_status_to_str(enum cc_setting_code code)
410 +{
411 + switch (code) {
412 + case REG_SET_CC_STATUS_PASS:
413 + return "REG_SET_CC_STATUS_PASS";
414 + case REG_CURRENT_ALPHA2_NOT_FOUND:
415 + return "REG_CURRENT_ALPHA2_NOT_FOUND";
416 + case REG_INIT_ALPHA2_NOT_FOUND:
417 + return "REG_INIT_ALPHA2_NOT_FOUND";
418 + case REG_SET_CC_CHANGE_NOT_ALLOWED:
419 + return "REG_SET_CC_CHANGE_NOT_ALLOWED";
420 + case REG_SET_CC_STATUS_NO_MEMORY:
421 + return "REG_SET_CC_STATUS_NO_MEMORY";
422 + case REG_SET_CC_STATUS_FAIL:
423 + return "REG_SET_CC_STATUS_FAIL";
424 + }
425 +
426 + return "Unknown CC status";
427 +}
428 +
429 enum wmi_reg_6ghz_ap_type {
430 WMI_REG_INDOOR_AP = 0,
431 WMI_REG_STANDARD_POWER_AP = 1,
432 WMI_REG_VERY_LOW_POWER_AP = 2,
433
434 + /* add AP type above, handle in ath11k_6ghz_ap_type_to_str()
435 + */
436 WMI_REG_CURRENT_MAX_AP_TYPE,
437 WMI_REG_MAX_AP_TYPE = 7,
438 };
439
440 +static inline const char *
441 +ath11k_6ghz_ap_type_to_str(enum wmi_reg_6ghz_ap_type type)
442 +{
443 + switch (type) {
444 + case WMI_REG_INDOOR_AP:
445 + return "INDOOR AP";
446 + case WMI_REG_STANDARD_POWER_AP:
447 + return "STANDARD POWER AP";
448 + case WMI_REG_VERY_LOW_POWER_AP:
449 + return "VERY LOW POWER AP";
450 + case WMI_REG_CURRENT_MAX_AP_TYPE:
451 + return "CURRENT_MAX_AP_TYPE";
452 + case WMI_REG_MAX_AP_TYPE:
453 + return "MAX_AP_TYPE";
454 + }
455 +
456 + return "unknown 6 GHz AP type";
457 +}
458 +
459 enum wmi_reg_6ghz_client_type {
460 WMI_REG_DEFAULT_CLIENT = 0,
461 WMI_REG_SUBORDINATE_CLIENT = 1,
462 WMI_REG_MAX_CLIENT_TYPE = 2,
463 +
464 + /* add client type above, handle it in
465 + * ath11k_6ghz_client_type_to_str()
466 + */
467 +};
468 +
469 +static inline const char *
470 +ath11k_6ghz_client_type_to_str(enum wmi_reg_6ghz_client_type type)
471 +{
472 + switch (type) {
473 + case WMI_REG_DEFAULT_CLIENT:
474 + return "DEFAULT CLIENT";
475 + case WMI_REG_SUBORDINATE_CLIENT:
476 + return "SUBORDINATE CLIENT";
477 + case WMI_REG_MAX_CLIENT_TYPE:
478 + return "MAX_CLIENT_TYPE";
479 + }
480 +
481 + return "unknown 6 GHz client type";
482 +}
483 +
484 +enum reg_subdomains_6ghz {
485 + EMPTY_6GHZ = 0x0,
486 + FCC1_CLIENT_LPI_REGULAR_6GHZ = 0x01,
487 + FCC1_CLIENT_SP_6GHZ = 0x02,
488 + FCC1_AP_LPI_6GHZ = 0x03,
489 + FCC1_CLIENT_LPI_SUBORDINATE = FCC1_AP_LPI_6GHZ,
490 + FCC1_AP_SP_6GHZ = 0x04,
491 + ETSI1_LPI_6GHZ = 0x10,
492 + ETSI1_VLP_6GHZ = 0x11,
493 + ETSI2_LPI_6GHZ = 0x12,
494 + ETSI2_VLP_6GHZ = 0x13,
495 + APL1_LPI_6GHZ = 0x20,
496 + APL1_VLP_6GHZ = 0x21,
497 +
498 + /* add sub-domain above, handle it in
499 + * ath11k_sub_reg_6ghz_to_str()
500 + */
501 +};
502 +
503 +static inline const char *
504 +ath11k_sub_reg_6ghz_to_str(enum reg_subdomains_6ghz sub_id)
505 +{
506 + switch (sub_id) {
507 + case EMPTY_6GHZ:
508 + return "N/A";
509 + case FCC1_CLIENT_LPI_REGULAR_6GHZ:
510 + return "FCC1_CLIENT_LPI_REGULAR_6GHZ";
511 + case FCC1_CLIENT_SP_6GHZ:
512 + return "FCC1_CLIENT_SP_6GHZ";
513 + case FCC1_AP_LPI_6GHZ:
514 + return "FCC1_AP_LPI_6GHZ/FCC1_CLIENT_LPI_SUBORDINATE";
515 + case FCC1_AP_SP_6GHZ:
516 + return "FCC1_AP_SP_6GHZ";
517 + case ETSI1_LPI_6GHZ:
518 + return "ETSI1_LPI_6GHZ";
519 + case ETSI1_VLP_6GHZ:
520 + return "ETSI1_VLP_6GHZ";
521 + case ETSI2_LPI_6GHZ:
522 + return "ETSI2_LPI_6GHZ";
523 + case ETSI2_VLP_6GHZ:
524 + return "ETSI2_VLP_6GHZ";
525 + case APL1_LPI_6GHZ:
526 + return "APL1_LPI_6GHZ";
527 + case APL1_VLP_6GHZ:
528 + return "APL1_VLP_6GHZ";
529 + }
530 +
531 + return "unknown sub reg id";
532 +}
533 +
534 +enum reg_super_domain_6ghz {
535 + FCC1_6GHZ = 0x01,
536 + ETSI1_6GHZ = 0x02,
537 + ETSI2_6GHZ = 0x03,
538 + APL1_6GHZ = 0x04,
539 + FCC1_6GHZ_CL = 0x05,
540 +
541 + /* add super domain above, handle it in
542 + * ath11k_super_reg_6ghz_to_str()
543 + */
544 };
545
546 +static inline const char *
547 +ath11k_super_reg_6ghz_to_str(enum reg_super_domain_6ghz domain_id)
548 +{
549 + switch (domain_id) {
550 + case FCC1_6GHZ:
551 + return "FCC1_6GHZ";
552 + case ETSI1_6GHZ:
553 + return "ETSI1_6GHZ";
554 + case ETSI2_6GHZ:
555 + return "ETSI2_6GHZ";
556 + case APL1_6GHZ:
557 + return "APL1_6GHZ";
558 + case FCC1_6GHZ_CL:
559 + return "FCC1_6GHZ_CL";
560 + }
561 +
562 + return "unknown domain id";
563 +}
564 +
565 struct cur_reg_rule {
566 u16 start_freq;
567 u16 end_freq;