xref: /wlan-dirver/qca-wifi-host-cmn/umac/regulatory/dispatcher/inc/reg_services_public_struct.h (revision 5ee6661e575b5422cbb88a7703b46f397b551bd9)
1 /*
2  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20  /**
21  * DOC: reg_services_public_struct.h
22  * This file contains regulatory data structures
23  */
24 
25 #ifndef __REG_SERVICES_PUBLIC_STRUCT_H_
26 #define __REG_SERVICES_PUBLIC_STRUCT_H_
27 
28 #ifdef CONFIG_AFC_SUPPORT
29 #include <wlan_reg_afc.h>
30 #endif
31 
32 #ifdef CONFIG_BAND_6GHZ
33 #define REG_MAX_CHANNELS_PER_OPERATING_CLASS        70
34 /*
35  * These tx-power macros are present till the 6G regdomains are defined to
36  * support tx-power values for various client types.
37  */
38 #define REG_PSD_MAX_TXPOWER_FOR_DEFAULT_CLIENT      (-1) /* dBm */
39 #define REG_PSD_MAX_TXPOWER_FOR_SUBORDINATE_CLIENT  5    /* dBm */
40 #define REG_EIRP_MAX_TXPOWER_FOR_SUBORDINATE_CLIENT 24   /* dBm */
41 #else
42 #define REG_MAX_CHANNELS_PER_OPERATING_CLASS        28
43 #endif
44 
45 #define REG_MAX_SUPP_OPER_CLASSES 32
46 #define REG_MAX_CHAN_CHANGE_CBKS 30
47 #define REG_INVALID_TXPOWER 255
48 #define MAX_STA_VDEV_CNT 4
49 #define INVALID_VDEV_ID 0xFF
50 #define INVALID_CHANNEL_NUM 0x0
51 #define CH_AVOID_MAX_RANGE   (NUM_5GHZ_CHANNELS + NUM_24GHZ_CHANNELS)
52 #define REG_ALPHA2_LEN 2
53 #define MAX_REG_RULES 10
54 #define MAX_6G_REG_RULES 5
55 
56 #define REGULATORY_CHAN_DISABLED     BIT(0)
57 #define REGULATORY_CHAN_NO_IR        BIT(1)
58 #define REGULATORY_CHAN_RADAR        BIT(3)
59 #define REGULATORY_CHAN_NO_OFDM      BIT(6)
60 #define REGULATORY_CHAN_INDOOR_ONLY  BIT(9)
61 #define REGULATORY_CHAN_AFC          BIT(13)
62 #define REGULATORY_CHAN_AFC_NOT_DONE BIT(16)
63 
64 #define REGULATORY_CHAN_NO_HT40      BIT(4)
65 #define REGULATORY_CHAN_NO_80MHZ     BIT(7)
66 #define REGULATORY_CHAN_NO_160MHZ    BIT(8)
67 #define REGULATORY_CHAN_NO_20MHZ     BIT(11)
68 #define REGULATORY_CHAN_NO_10MHZ     BIT(12)
69 #define REGULATORY_CHAN_INVALID      BIT(14)
70 
71 #define REGULATORY_PHYMODE_NO11A     BIT(0)
72 #define REGULATORY_PHYMODE_NO11B     BIT(1)
73 #define REGULATORY_PHYMODE_NO11G     BIT(2)
74 #define REGULATORY_CHAN_NO11N        BIT(3)
75 #define REGULATORY_PHYMODE_NO11AC    BIT(4)
76 #define REGULATORY_PHYMODE_NO11AX    BIT(5)
77 #ifdef WLAN_FEATURE_11BE
78 #define REGULATORY_PHYMODE_NO11BE    BIT(6)
79 #endif
80 
81 #define BW_5_MHZ      5
82 #define BW_10_MHZ     10
83 #define BW_20_MHZ     20
84 #define BW_25_MHZ     25
85 #define BW_40_MHZ     40
86 #define BW_80_MHZ     80
87 #define BW_160_MHZ    160
88 #ifdef WLAN_FEATURE_11BE
89 #define BW_320_MHZ    320
90 #endif
91 #define BW_40_MHZ     40
92 
93 #define MAX_NUM_PWR_LEVEL 16
94 
95 #ifdef CONFIG_REG_CLIENT
96 #define MAX_NUM_FCC_RULES 2
97 #endif
98 
99 /**
100  * enum dfs_reg - DFS region
101  * @DFS_UNINIT_REGION: un-initialized region
102  * @DFS_FCC_REGION: FCC region
103  * @DFS_ETSI_REGION: ETSI region
104  * @DFS_MKK_REGION: MKK region
105  * @DFS_CN_REGION: China region
106  * @DFS_KR_REGION: Korea region
107  * @DFS_MKK_REGION: MKKN region
108  * that supports updated W53 RADAR pattern
109  * detection.
110  * @DFS_UNDEF_REGION: Undefined region
111  */
112 
113 enum dfs_reg {
114 	DFS_UNINIT_REGION = 0,
115 	DFS_FCC_REGION = 1,
116 	DFS_ETSI_REGION = 2,
117 	DFS_MKK_REGION = 3,
118 	DFS_CN_REGION = 4,
119 	DFS_KR_REGION = 5,
120 	DFS_MKKN_REGION = 6,
121 	DFS_UNDEF_REGION = 0xFFFF,
122 };
123 
124 /** enum op_class_table_num
125  * OP_CLASS_US- Class corresponds to US
126  * OP_CLASS_EU- Class corresponds to EU
127  * OP_CLASS_JAPAN- Class corresponds to JAPAN
128  * OP_CLASS_GLOBAL- Class corresponds to GLOBAL
129  * OP_CLASS_CHINA- Class corresponds to CHINA
130  */
131 enum op_class_table_num {
132 	OP_CLASS_US = 1,
133 	OP_CLASS_EU,
134 	OP_CLASS_JAPAN,
135 	OP_CLASS_GLOBAL,
136 	OP_CLASS_CHINA
137 };
138 
139 /**
140  * enum channel_enum - channel enumeration
141  * @CHAN_ENUM_2412: channel with freq 2412
142  * @CHAN_ENUM_2417: channel with freq 2417
143  * @CHAN_ENUM_2422: channel with freq 2422
144  * @CHAN_ENUM_2427: channel with freq 2427
145  * @CHAN_ENUM_2432: channel with freq 2432
146  * @CHAN_ENUM_2437: channel with freq 2437
147  * @CHAN_ENUM_2442: channel with freq 2442
148  * @CHAN_ENUM_2447: channel with freq 2447
149  * @CHAN_ENUM_2452: channel with freq 2452
150  * @CHAN_ENUM_2457: channel with freq 2457
151  * @CHAN_ENUM_2462: channel with freq 2462
152  * @CHAN_ENUM_2467: channel with freq 2467
153  * @CHAN_ENUM_2472: channel with freq 2472
154  * @CHAN_ENUM_2484: channel with freq 2484
155  * @CHAN_ENUM_4912: channel with freq 4912
156  * @CHAN_ENUM_4915: channel with freq 4915
157  * @CHAN_ENUM_4917: channel with freq 4917
158  * @CHAN_ENUM_4920: channel with freq 4920
159  * @CHAN_ENUM_4922: channel with freq 4922
160  * @CHAN_ENUM_4925: channel with freq 4925
161  * @CHAN_ENUM_4927: channel with freq 4927
162  * @CHAN_ENUM_4932: channel with freq 4932
163  * @CHAN_ENUM_4935: channel with freq 4935
164  * @CHAN_ENUM_4937: channel with freq 4937
165  * @CHAN_ENUM_4940: channel with freq 4940
166  * @CHAN_ENUM_4942: channel with freq 4942
167  * @CHAN_ENUM_4945: channel with freq 4945
168  * @CHAN_ENUM_4947: channel with freq 4947
169  * @CHAN_ENUM_4950: channel with freq 4950
170  * @CHAN_ENUM_4952: channel with freq 4952
171  * @CHAN_ENUM_4955: channel with freq 4955
172  * @CHAN_ENUM_4957: channel with freq 4957
173  * @CHAN_ENUM_4960: channel with freq 4960
174  * @CHAN_ENUM_4962: channel with freq 4962
175  * @CHAN_ENUM_4965: channel with freq 4965
176  * @CHAN_ENUM_4967: channel with freq 4967
177  * @CHAN_ENUM_4970: channel with freq 4970
178  * @CHAN_ENUM_4972: channel with freq 4972
179  * @CHAN_ENUM_4975: channel with freq 4975
180  * @CHAN_ENUM_4977: channel with freq 4977
181  * @CHAN_ENUM_4980: channel with freq 4980
182  * @CHAN_ENUM_4982: channel with freq 4982
183  * @CHAN_ENUM_4985: channel with freq 4985
184  * @CHAN_ENUM_4987: channel with freq 4987
185  * @CHAN_ENUM_5032: channel with freq 5032
186  * @CHAN_ENUM_5035: channel with freq 5035
187  * @CHAN_ENUM_5037: channel with freq 5037
188  * @CHAN_ENUM_5040: channel with freq 5040
189  * @CHAN_ENUM_5042: channel with freq 5042
190  * @CHAN_ENUM_5045: channel with freq 5045
191  * @CHAN_ENUM_5047: channel with freq 5047
192  * @CHAN_ENUM_5052: channel with freq 5052
193  * @CHAN_ENUM_5055: channel with freq 5055
194  * @CHAN_ENUM_5057: channel with freq 5057
195  * @CHAN_ENUM_5060: channel with freq 5060
196  * @CHAN_ENUM_5080: channel with freq 5080
197  * @CHAN_ENUM_5180: channel with freq 5180
198  * @CHAN_ENUM_5200: channel with freq 5200
199  * @CHAN_ENUM_5220: channel with freq 5220
200  * @CHAN_ENUM_5240: channel with freq 5240
201  * @CHAN_ENUM_5260: channel with freq 5260
202  * @CHAN_ENUM_5280: channel with freq 5280
203  * @CHAN_ENUM_5300: channel with freq 5300
204  * @CHAN_ENUM_5320: channel with freq 5320
205  * @CHAN_ENUM_5500: channel with freq 5500
206  * @CHAN_ENUM_5520: channel with freq 5520
207  * @CHAN_ENUM_5540: channel with freq 5540
208  * @CHAN_ENUM_5560: channel with freq 5560
209  * @CHAN_ENUM_5580: channel with freq 5580
210  * @CHAN_ENUM_5600: channel with freq 5600
211  * @CHAN_ENUM_5620: channel with freq 5620
212  * @CHAN_ENUM_5640: channel with freq 5640
213  * @CHAN_ENUM_5660: channel with freq 5660
214  * @CHAN_ENUM_5680: channel with freq 5680
215  * @CHAN_ENUM_5700: channel with freq 5700
216  * @CHAN_ENUM_5720: channel with freq 5720
217  * @CHAN_ENUM_5745: channel with freq 5745
218  * @CHAN_ENUM_5765: channel with freq 5765
219  * @CHAN_ENUM_5785: channel with freq 5785
220  * @CHAN_ENUM_5805: channel with freq 5805
221  * @CHAN_ENUM_5825: channel with freq 5825
222  * @CHAN_ENUM_5845: channel with freq 5845
223  * @CHAN_ENUM_5850: channel with freq 5850
224  * @CHAN_ENUM_5855: channel with freq 5855
225  * @CHAN_ENUM_5860: channel with freq 5860
226  * @CHAN_ENUM_5865: channel with freq 5865
227  * @CHAN_ENUM_5870: channel with freq 5870
228  * @CHAN_ENUM_5875: channel with freq 5875
229  * @CHAN_ENUM_5880: channel with freq 5880
230  * @CHAN_ENUM_5885: channel with freq 5885
231  * @CHAN_ENUM_5890: channel with freq 5890
232  * @CHAN_ENUM_5895: channel with freq 5895
233  * @CHAN_ENUM_5900: channel with freq 5900
234  * @CHAN_ENUM_5905: channel with freq 5905
235  * @CHAN_ENUM_5910: channel with freq 5910
236  * @CHAN_ENUM_5915: channel with freq 5915
237  * @CHAN_ENUM_5920: channel with freq 5920
238  * @CHAN_ENUM_5935: channel with freq 5935
239  * @CHAN_ENUM_5955: channel with freq 5955
240  * @CHAN_ENUM_5975: channel with freq 5975
241  * @CHAN_ENUM_5995: channel with freq 5995
242  * @CHAN_ENUM_6015: channel with freq 6015
243  * @CHAN_ENUM_6035: channel with freq 6035
244  * @CHAN_ENUM_6055: channel with freq 6055
245  * @CHAN_ENUM_6075: channel with freq 6075
246  * @CHAN_ENUM_6095: channel with freq 6095
247  * @CHAN_ENUM_6115: channel with freq 6115
248  * @CHAN_ENUM_6135: channel with freq 6135
249  * @CHAN_ENUM_6155: channel with freq 6155
250  * @CHAN_ENUM_6175: channel with freq 6175
251  * @CHAN_ENUM_6195: channel with freq 6195
252  * @CHAN_ENUM_6215: channel with freq 6215
253  * @CHAN_ENUM_6235: channel with freq 6235
254  * @CHAN_ENUM_6255: channel with freq 6255
255  * @CHAN_ENUM_6275: channel with freq 6275
256  * @CHAN_ENUM_6295: channel with freq 6295
257  * @CHAN_ENUM_6315: channel with freq 6315
258  * @CHAN_ENUM_6335: channel with freq 6335
259  * @CHAN_ENUM_6355: channel with freq 6355
260  * @CHAN_ENUM_6375: channel with freq 6375
261  * @CHAN_ENUM_6395: channel with freq 6395
262  * @CHAN_ENUM_6415: channel with freq 6415
263  * @CHAN_ENUM_6435: channel with freq 6435
264  * @CHAN_ENUM_6455: channel with freq 6455
265  * @CHAN_ENUM_6475: channel with freq 6475
266  * @CHAN_ENUM_6495: channel with freq 6495
267  * @CHAN_ENUM_6515: channel with freq 6515
268  * @CHAN_ENUM_6535: channel with freq 6535
269  * @CHAN_ENUM_6555: channel with freq 6555
270  * @CHAN_ENUM_6575: channel with freq 6575
271  * @CHAN_ENUM_6595: channel with freq 6595
272  * @CHAN_ENUM_6615: channel with freq 6615
273  * @CHAN_ENUM_6635: channel with freq 6635
274  * @CHAN_ENUM_6655: channel with freq 6655
275  * @CHAN_ENUM_6675: channel with freq 6675
276  * @CHAN_ENUM_6695: channel with freq 6695
277  * @CHAN_ENUM_6715: channel with freq 6715
278  * @CHAN_ENUM_6735: channel with freq 6735
279  * @CHAN_ENUM_6755: channel with freq 6755
280  * @CHAN_ENUM_6775: channel with freq 6775
281  * @CHAN_ENUM_6795: channel with freq 6795
282  * @CHAN_ENUM_6815: channel with freq 6815
283  * @CHAN_ENUM_6835: channel with freq 6835
284  * @CHAN_ENUM_6855: channel with freq 6855
285  * @CHAN_ENUM_6875: channel with freq 6875
286  * @CHAN_ENUM_6895: channel with freq 6895
287  * @CHAN_ENUM_6915: channel with freq 6915
288  * @CHAN_ENUM_6935: channel with freq 6935
289  * @CHAN_ENUM_6955: channel with freq 6955
290  * @CHAN_ENUM_6975: channel with freq 6975
291  * @CHAN_ENUM_6995: channel with freq 6995
292  * @CHAN_ENUM_7015: channel with freq 7015
293  * @CHAN_ENUM_7035: channel with freq 7035
294  * @CHAN_ENUM_7055: channel with freq 7055
295  * @CHAN_ENUM_7075: channel with freq 7075
296  * @CHAN_ENUM_7095: channel with freq 7095
297  * @CHAN_ENUM_7115: channel with freq 7115
298  */
299 enum channel_enum {
300 	CHAN_ENUM_2412,
301 	CHAN_ENUM_2417,
302 	CHAN_ENUM_2422,
303 	CHAN_ENUM_2427,
304 	CHAN_ENUM_2432,
305 	CHAN_ENUM_2437,
306 	CHAN_ENUM_2442,
307 	CHAN_ENUM_2447,
308 	CHAN_ENUM_2452,
309 	CHAN_ENUM_2457,
310 	CHAN_ENUM_2462,
311 	CHAN_ENUM_2467,
312 	CHAN_ENUM_2472,
313 	CHAN_ENUM_2484,
314 #ifdef CONFIG_49GHZ_CHAN
315 	CHAN_ENUM_4912,
316 	CHAN_ENUM_4915,
317 	CHAN_ENUM_4917,
318 	CHAN_ENUM_4920,
319 	CHAN_ENUM_4922,
320 	CHAN_ENUM_4925,
321 	CHAN_ENUM_4927,
322 	CHAN_ENUM_4932,
323 	CHAN_ENUM_4935,
324 	CHAN_ENUM_4937,
325 	CHAN_ENUM_4940,
326 	CHAN_ENUM_4942,
327 	CHAN_ENUM_4945,
328 	CHAN_ENUM_4947,
329 	CHAN_ENUM_4950,
330 	CHAN_ENUM_4952,
331 	CHAN_ENUM_4955,
332 	CHAN_ENUM_4957,
333 	CHAN_ENUM_4960,
334 	CHAN_ENUM_4962,
335 	CHAN_ENUM_4965,
336 	CHAN_ENUM_4967,
337 	CHAN_ENUM_4970,
338 	CHAN_ENUM_4972,
339 	CHAN_ENUM_4975,
340 	CHAN_ENUM_4977,
341 	CHAN_ENUM_4980,
342 	CHAN_ENUM_4982,
343 	CHAN_ENUM_4985,
344 	CHAN_ENUM_4987,
345 	CHAN_ENUM_5032,
346 	CHAN_ENUM_5035,
347 	CHAN_ENUM_5037,
348 	CHAN_ENUM_5040,
349 	CHAN_ENUM_5042,
350 	CHAN_ENUM_5045,
351 	CHAN_ENUM_5047,
352 	CHAN_ENUM_5052,
353 	CHAN_ENUM_5055,
354 	CHAN_ENUM_5057,
355 	CHAN_ENUM_5060,
356 	CHAN_ENUM_5080,
357 #endif /* CONFIG_49GHZ_CHAN */
358 	CHAN_ENUM_5180,
359 	CHAN_ENUM_5200,
360 	CHAN_ENUM_5220,
361 	CHAN_ENUM_5240,
362 	CHAN_ENUM_5260,
363 	CHAN_ENUM_5280,
364 	CHAN_ENUM_5300,
365 	CHAN_ENUM_5320,
366 	CHAN_ENUM_5500,
367 	CHAN_ENUM_5520,
368 	CHAN_ENUM_5540,
369 	CHAN_ENUM_5560,
370 	CHAN_ENUM_5580,
371 	CHAN_ENUM_5600,
372 	CHAN_ENUM_5620,
373 	CHAN_ENUM_5640,
374 	CHAN_ENUM_5660,
375 	CHAN_ENUM_5680,
376 	CHAN_ENUM_5700,
377 	CHAN_ENUM_5720,
378 	CHAN_ENUM_5745,
379 	CHAN_ENUM_5765,
380 	CHAN_ENUM_5785,
381 	CHAN_ENUM_5805,
382 	CHAN_ENUM_5825,
383 	CHAN_ENUM_5845,
384 #ifdef WLAN_FEATURE_DSRC
385 	CHAN_ENUM_5850,
386 	CHAN_ENUM_5855,
387 	CHAN_ENUM_5860,
388 #endif
389 	CHAN_ENUM_5865,
390 #ifdef WLAN_FEATURE_DSRC
391 	CHAN_ENUM_5870,
392 	CHAN_ENUM_5875,
393 	CHAN_ENUM_5880,
394 #endif
395 	CHAN_ENUM_5885,
396 #ifdef WLAN_FEATURE_DSRC
397 	CHAN_ENUM_5890,
398 	CHAN_ENUM_5895,
399 	CHAN_ENUM_5900,
400 	CHAN_ENUM_5905,
401 	CHAN_ENUM_5910,
402 	CHAN_ENUM_5915,
403 	CHAN_ENUM_5920,
404 #endif /* WLAN_FEATURE_DSRC */
405 #ifdef CONFIG_BAND_6GHZ
406 	CHAN_ENUM_5935,
407 	CHAN_ENUM_5955,
408 	CHAN_ENUM_5975,
409 	CHAN_ENUM_5995,
410 	CHAN_ENUM_6015,
411 	CHAN_ENUM_6035,
412 	CHAN_ENUM_6055,
413 	CHAN_ENUM_6075,
414 	CHAN_ENUM_6095,
415 	CHAN_ENUM_6115,
416 	CHAN_ENUM_6135,
417 	CHAN_ENUM_6155,
418 	CHAN_ENUM_6175,
419 	CHAN_ENUM_6195,
420 	CHAN_ENUM_6215,
421 	CHAN_ENUM_6235,
422 	CHAN_ENUM_6255,
423 	CHAN_ENUM_6275,
424 	CHAN_ENUM_6295,
425 	CHAN_ENUM_6315,
426 	CHAN_ENUM_6335,
427 	CHAN_ENUM_6355,
428 	CHAN_ENUM_6375,
429 	CHAN_ENUM_6395,
430 	CHAN_ENUM_6415,
431 	CHAN_ENUM_6435,
432 	CHAN_ENUM_6455,
433 	CHAN_ENUM_6475,
434 	CHAN_ENUM_6495,
435 	CHAN_ENUM_6515,
436 	CHAN_ENUM_6535,
437 	CHAN_ENUM_6555,
438 	CHAN_ENUM_6575,
439 	CHAN_ENUM_6595,
440 	CHAN_ENUM_6615,
441 	CHAN_ENUM_6635,
442 	CHAN_ENUM_6655,
443 	CHAN_ENUM_6675,
444 	CHAN_ENUM_6695,
445 	CHAN_ENUM_6715,
446 	CHAN_ENUM_6735,
447 	CHAN_ENUM_6755,
448 	CHAN_ENUM_6775,
449 	CHAN_ENUM_6795,
450 	CHAN_ENUM_6815,
451 	CHAN_ENUM_6835,
452 	CHAN_ENUM_6855,
453 	CHAN_ENUM_6875,
454 	CHAN_ENUM_6895,
455 	CHAN_ENUM_6915,
456 	CHAN_ENUM_6935,
457 	CHAN_ENUM_6955,
458 	CHAN_ENUM_6975,
459 	CHAN_ENUM_6995,
460 	CHAN_ENUM_7015,
461 	CHAN_ENUM_7035,
462 	CHAN_ENUM_7055,
463 	CHAN_ENUM_7075,
464 	CHAN_ENUM_7095,
465 	CHAN_ENUM_7115,
466 #endif /* CONFIG_BAND_6GHZ */
467 
468 	NUM_CHANNELS,
469 
470 	MIN_CHANNEL = CHAN_ENUM_2412,
471 	MAX_CHANNEL = (NUM_CHANNELS - 1),
472 
473 	MIN_24GHZ_CHANNEL = CHAN_ENUM_2412,
474 	MAX_24GHZ_CHANNEL = CHAN_ENUM_2484,
475 	NUM_24GHZ_CHANNELS = (MAX_24GHZ_CHANNEL - MIN_24GHZ_CHANNEL + 1),
476 
477 	INVALID_CHANNEL = NUM_CHANNELS,
478 
479 #ifdef CONFIG_49GHZ_CHAN
480 	MIN_49GHZ_CHANNEL = CHAN_ENUM_4912,
481 	MAX_49GHZ_CHANNEL = CHAN_ENUM_5080,
482 	NUM_49GHZ_CHANNELS = (MAX_49GHZ_CHANNEL - MIN_49GHZ_CHANNEL + 1),
483 #else
484 	MIN_49GHZ_CHANNEL = INVALID_CHANNEL,
485 	MAX_49GHZ_CHANNEL = INVALID_CHANNEL,
486 	NUM_49GHZ_CHANNELS = 0,
487 #endif /* CONFIG_49GHZ_CHAN */
488 
489 	MIN_5GHZ_CHANNEL = CHAN_ENUM_5180,
490 #ifdef WLAN_FEATURE_DSRC
491 	MAX_5GHZ_CHANNEL = CHAN_ENUM_5920,
492 #else
493 	MAX_5GHZ_CHANNEL = CHAN_ENUM_5885,
494 #endif
495 	NUM_5GHZ_CHANNELS = (MAX_5GHZ_CHANNEL - MIN_5GHZ_CHANNEL + 1),
496 
497 #ifdef WLAN_FEATURE_DSRC
498 	MIN_DSRC_CHANNEL = CHAN_ENUM_5850,
499 	MAX_DSRC_CHANNEL = CHAN_ENUM_5920,
500 	NUM_DSRC_CHANNELS = (MAX_DSRC_CHANNEL - MIN_DSRC_CHANNEL + 1),
501 #endif
502 
503 	MIN_5DOT9_CHANNEL = CHAN_ENUM_5845,
504 	MAX_5DOT9_CHANNEL = CHAN_ENUM_5885,
505 	NUM_5DOT9_CHANNELS = (MAX_5DOT9_CHANNEL - MIN_5DOT9_CHANNEL + 1),
506 
507 #ifdef CONFIG_49GHZ_CHAN
508 #define BAND_5GHZ_START_CHANNEL MIN_49GHZ_CHANNEL
509 #else
510 #define BAND_5GHZ_START_CHANNEL MIN_5GHZ_CHANNEL
511 #endif /* CONFIG_49GHZ_CHAN */
512 
513 #ifdef DISABLE_UNII_SHARED_BANDS
514 	MIN_UNII_1_BAND_CHANNEL = CHAN_ENUM_5180,
515 	MAX_UNII_1_BAND_CHANNEL = CHAN_ENUM_5240,
516 	NUM_UNII_1_BAND_CHANNELS = (MAX_UNII_1_BAND_CHANNEL -
517 				    MIN_UNII_1_BAND_CHANNEL + 1),
518 
519 	MIN_UNII_2A_BAND_CHANNEL = CHAN_ENUM_5260,
520 	MAX_UNII_2A_BAND_CHANNEL = CHAN_ENUM_5320,
521 	NUM_UNII_2A_BAND_CHANNELS = (MAX_UNII_2A_BAND_CHANNEL -
522 				     MIN_UNII_2A_BAND_CHANNEL + 1),
523 #endif
524 
525 #ifdef CONFIG_BAND_6GHZ
526 	MIN_6GHZ_CHANNEL = CHAN_ENUM_5935,
527 	MAX_6GHZ_CHANNEL = CHAN_ENUM_7115,
528 	NUM_6GHZ_CHANNELS = (MAX_6GHZ_CHANNEL - MIN_6GHZ_CHANNEL + 1),
529 	MIN_6GHZ_NON_ORPHAN_CHANNEL = CHAN_ENUM_5955,
530 #else
531 	MIN_6GHZ_CHANNEL = INVALID_CHANNEL,
532 	MAX_6GHZ_CHANNEL = INVALID_CHANNEL,
533 	NUM_6GHZ_CHANNELS = 0,
534 	MIN_6GHZ_NON_ORPHAN_CHANNEL = INVALID_CHANNEL,
535 #endif /* CONFIG_BAND_6GHZ */
536 };
537 
538 /**
539  * enum channel_state - channel state
540  * @CHANNEL_STATE_DISABLE: disabled state
541  * @CHANNEL_STATE_PASSIVE: passive state
542  * @CHANNEL_STATE_DFS: dfs state
543  * @CHANNEL_STATE_ENABLE: enabled state
544  * @CHANNEL_STATE_INVALID: invalid state
545  */
546 enum channel_state {
547 	CHANNEL_STATE_DISABLE,
548 	CHANNEL_STATE_PASSIVE,
549 	CHANNEL_STATE_DFS,
550 	CHANNEL_STATE_ENABLE,
551 	CHANNEL_STATE_INVALID,
552 };
553 
554 /**
555  * enum reg_6g_ap_type - Regulatory AP type for regulatory info subfield.
556  * @REG_INDOOR_AP: Indoor AP
557  * @REG_STANDARD_POWER_AP: Standard Power AP
558  * @REG_VERY_LOW_POWER_AP: Very low power AP
559  * @REG_CURRENT_MAX_AP_TYPE: current maximum, used to determine array size
560  * @REG_MAX_SUPP_AP_TYPE: Current maximum AP power typer supported in the IEEE
561  * standard.
562  * @REG_MAX_AP_TYPE: Maximum value possible for (3 bits) regulatory info
563  * sub-field in the 6G HE Operation IE
564  */
565 enum reg_6g_ap_type {
566 	REG_INDOOR_AP = 0,
567 	REG_STANDARD_POWER_AP = 1,
568 	REG_VERY_LOW_POWER_AP = 2,
569 	REG_CURRENT_MAX_AP_TYPE,
570 	REG_MAX_SUPP_AP_TYPE = REG_VERY_LOW_POWER_AP,
571 	REG_MAX_AP_TYPE = 7,
572 };
573 
574 /**
575  * enum reg_6g_client_type - Regulatory client type for max tx-power category
576  * @REG_DEFAULT_CLIENT: Default client
577  * @REG_SUBORDINATE_CLIENT: Subordinate client
578  * @REG_MAX_CLIENT_TYPE: Maximum value possible for max tx-power category
579  * (2 bits) sub-field in the TPE (Transmit Power Envelope) IE
580  * REG_INVALID_CLIENT_TYPE: Invalid client type
581  */
582 enum reg_6g_client_type {
583 	REG_DEFAULT_CLIENT = 0,
584 	REG_SUBORDINATE_CLIENT = 1,
585 	REG_MAX_CLIENT_TYPE = 2,
586 	REG_INVALID_CLIENT_TYPE = REG_MAX_CLIENT_TYPE,
587 };
588 
589 /**
590  * enum reg_domain: reg domain
591  * @REGDOMAIN_FCC: FCC domain
592  * @REGDOMAIN_ETSI: ETSI domain
593  * @REGDOMAIN_JAPAN: JAPAN domain
594  * @REGDOMAIN_WORLD: WORLD domain
595  * @REGDOMAIN_COUNT: Max domain
596  */
597 typedef enum {
598 	REGDOMAIN_FCC,
599 	REGDOMAIN_ETSI,
600 	REGDOMAIN_JAPAN,
601 	REGDOMAIN_WORLD,
602 	REGDOMAIN_COUNT
603 } v_REGDOMAIN_t;
604 
605 /**
606  * enum ctl_value - CTL value
607  * @CTL_FCC: CTL FCC
608  * @CTL_MKK: CTL MKK
609  * @CTL_ETSI: CTL ETSI
610  * @CTL_KOR: CTL KOR
611  * @CTL_CHN: CTL CHINA
612  * @CTL_USER_DEF: CTL USER_DEF
613  * @CTL_NONE: CTL NONE
614  */
615 enum ctl_value {
616 	CTL_FCC = 0x10,
617 	CTL_ETSI = 0x30,
618 	CTL_MKK = 0x40,
619 	CTL_KOR = 0x50,
620 	CTL_CHN = 0x60,
621 	CTL_USER_DEF = 0x70,
622 	CTL_NONE = 0xff
623 };
624 
625 /**
626  * struct freq_range: The range/band of frequencies, indicated by left and right
627  * edge frequencies.
628  * @left: Left edge frequency(inclusive)
629  * @right: Right edge frequency(inclusive)
630  */
631 struct freq_range {
632 	qdf_freq_t left;
633 	qdf_freq_t right;
634 };
635 
636 /**
637  * struct ch_params
638  * @ch_width: channel width
639  * @sec_ch_offset: secondary channel offset
640  * @center_freq_seg0: channel number for segment 0
641  * @center_freq_seg1: channel number segment 1
642  * @mhz_freq_seg0: Center frequency for segment 0
643  * @mhz_freq_seg1: Center frequency for segment 1
644  * @reg_punc_bitmap: Output puncturing bitmap
645  * @is_create_punc_bitmap: Whether puncturing bitmap is to be created or not
646  *                         Parameter 'reg_punc_bitmap' is valid only if
647  *                         is_create_punc_bitmap is true
648  */
649 struct ch_params {
650 	enum phy_ch_width ch_width;
651 	uint8_t sec_ch_offset;
652 	uint8_t center_freq_seg0;
653 	uint8_t center_freq_seg1;
654 	qdf_freq_t mhz_freq_seg0;
655 	qdf_freq_t mhz_freq_seg1;
656 #ifdef WLAN_FEATURE_11BE
657 	uint16_t reg_punc_bitmap;
658 	bool is_create_punc_bitmap;
659 #endif
660 };
661 
662 /**
663  * struct reg_channel_list
664  * @num_ch_params: Number of chan_param elements
665  * @chan_param: Object of type struct ch_params to hold channel params
666  * Currently chan_param is an array of 2 because maximum possible 320
667  * channels for a given primary channel is 2. This may be dynamically
668  * allocated in the future by the caller if num_ch_params is greater than 2.
669  *
670  */
671 #ifdef WLAN_FEATURE_11BE
672 #define MAX_NUM_CHAN_PARAM 2
673 struct reg_channel_list {
674 	uint8_t num_ch_params;
675 	struct ch_params chan_param[MAX_NUM_CHAN_PARAM];
676 };
677 #endif
678 
679 /**
680  * struct channel_power
681  * @center_freq: Channel Center Frequency
682  * @chan_num: channel number
683  * @tx_power: TX power
684  */
685 struct channel_power {
686 	qdf_freq_t center_freq;
687 	uint8_t chan_num;
688 	uint32_t tx_power;
689 };
690 
691 /**
692  * enum offset_t: channel offset
693  * @BW20: 20 mhz channel
694  * @BW40_LOW_PRIMARY: lower channel in 40 mhz
695  * @BW40_HIGH_PRIMARY: higher channel in 40 mhz
696  * @BW80: 80 mhz channel
697  * @BWALL: unknown bandwidth
698  */
699 enum offset_t {
700 	BW20 = 0,
701 	BW40_LOW_PRIMARY = 1,
702 	BW40_HIGH_PRIMARY = 3,
703 	BW80,
704 	BWALL,
705 	BW_INVALID = 0xFF
706 };
707 
708 /**
709  * enum behav_limit - behavior limit
710  * @BEHAV_NONE: none
711  * @BEHAV_BW40_LOW_PRIMARY: BW40 low primary
712  * @BEHAV_BW40_HIGH_PRIMARY: BW40 high primary
713  * @BEHAV_BW80_PLUS: BW 80 plus
714  * @BEHAV_INVALID: invalid behavior
715  */
716 enum behav_limit {
717 	BEHAV_NONE,
718 	BEHAV_BW40_LOW_PRIMARY,
719 	BEHAV_BW40_HIGH_PRIMARY,
720 	BEHAV_BW80_PLUS,
721 	BEHAV_INVALID = 0xFF
722 };
723 
724 /**
725  * struct c_freq_lst: The list data structure for the center frequencies
726  * @num_cfis: Number of center frequencies
727  * @p_cfis_arr: Start address of the array of center frequency indices. Center
728  *              for 40/80/160/320MHz band channel opclasses. For 20MHz the list
729  *              is empty as it is already available in @channels variable.
730  */
731 struct c_freq_lst {
732 	uint8_t num_cfis;
733 	const uint8_t *p_cfis_arr;
734 };
735 
736 /**
737  * struct reg_dmn_op_class_map_t: operating class
738  * @op_class: operating class number
739  * @chan_spacing: channel spacing
740  * @offset: offset
741  * @behav_limit: OR of bitmaps of enum behav_limit
742  * @start_freq: starting frequency
743  * @channels: channel set
744  * @p_cfi_lst_obj: Pointer to center frequency indices list
745  */
746 struct reg_dmn_op_class_map_t {
747 	uint8_t op_class;
748 	uint16_t chan_spacing;
749 	enum offset_t offset;
750 	uint16_t behav_limit;
751 	qdf_freq_t start_freq;
752 	uint8_t channels[REG_MAX_CHANNELS_PER_OPERATING_CLASS];
753 	const struct c_freq_lst *p_cfi_lst_obj;
754 };
755 
756 /**
757  * enum opclass_config: Opclass configuration
758  * @OPCLASSES_SUPPORTED_BY_CUR_HWMODE: Retrieve opclasses that is supported
759  * by the current hw mode.
760  * @OPCLASSES_NOT_SUPPORTED_BY_CUR_HWMODE: Retrieve opclasses that are not
761  * supported by the current hw mode.
762  * OPCLASSES_SUPPORTED_BY_DOMAIN: Populate the opclass supported by the radio
763  * without considering the capability of current hwmode.
764  */
765 enum opclass_config {
766 	OPCLASSES_SUPPORTED_BY_CUR_HWMODE = 1,
767 	OPCLASSES_NOT_SUPPORTED_BY_CUR_HWMODE = 2,
768 	OPCLASSES_SUPPORTED_BY_DOMAIN = 3
769 };
770 
771 /**
772  * struct regdmn_ap_cap_opclass_t: AP Cap operation class table
773  * @op_class: operating class number
774  * @ch_width: channel width in MHz
775  * @start_freq: Starting Frequency in MHz
776  * @behav_limit: OR of bitmaps of enum behav_limit
777  * @max_tx_pwr_dbm: Maximum tx power in dbm
778  * @num_supported_chan: Number of supported channels
779  * @num_non_supported_chan: Number of non-supported channels
780  * @sup_chan_list: Array of supported channel numbers
781  * @non_sup_chan_list: Array of non supported channel numbers
782  */
783 struct regdmn_ap_cap_opclass_t {
784 	uint8_t op_class;
785 	uint16_t ch_width;
786 	qdf_freq_t start_freq;
787 	uint16_t behav_limit;
788 	uint8_t max_tx_pwr_dbm;
789 	uint8_t num_supported_chan;
790 	uint8_t num_non_supported_chan;
791 	uint8_t sup_chan_list[REG_MAX_CHANNELS_PER_OPERATING_CLASS];
792 	uint8_t non_sup_chan_list[REG_MAX_CHANNELS_PER_OPERATING_CLASS];
793 };
794 
795 /**
796  * struct reg_dmn_supp_op_classes: operating classes
797  * @num_classes: number of classes
798  * @classes: classes
799  */
800 struct reg_dmn_supp_op_classes {
801 	uint8_t num_classes;
802 	uint8_t classes[REG_MAX_SUPP_OPER_CLASSES];
803 };
804 
805 /**
806  * struct reg_start_11d_scan_req: start 11d scan request
807  * @vdev_id: vdev id
808  * @scan_period_msec: scan duration in milli-seconds
809  * @start_interval_msec: offset duration to start the scan in milli-seconds
810  */
811 struct reg_start_11d_scan_req {
812 	uint8_t vdev_id;
813 	uint32_t scan_period_msec;
814 	uint32_t start_interval_msec;
815 };
816 
817 /**
818  * struct reg_11d_scan_msg: 11d scan message structure
819  * @psoc: pointer to psoc object
820  * @enable_11d_supp: enable 11d scan or disable 11d scan
821  */
822 struct reg_11d_scan_msg {
823 	struct wlan_objmgr_psoc *psoc;
824 	bool enable_11d_supp;
825 };
826 /**
827  * struct reg_stop_11d_scan_req: stop 11d scan request
828  * @vdev_id: vdev id
829  */
830 struct reg_stop_11d_scan_req {
831 	uint8_t vdev_id;
832 };
833 
834 /**
835  * struct reg_11d_new_country: regulatory 11d new coutry code
836  * @alpha2: new 11d alpha2
837  */
838 struct reg_11d_new_country {
839 	uint8_t alpha2[REG_ALPHA2_LEN + 1];
840 };
841 
842 /**
843  * enum country_src: country source
844  * @SOURCE_QUERY: source query
845  * @SOURCE_CORE: source regulatory core
846  * @SOURCE_DRIVER: source driver
847  * @SOURCE_USERSPACE: source userspace
848  * @SOURCE_11D: source 11D
849  */
850 enum country_src {
851 	SOURCE_UNKNOWN,
852 	SOURCE_QUERY,
853 	SOURCE_CORE,
854 	SOURCE_DRIVER,
855 	SOURCE_USERSPACE,
856 	SOURCE_11D
857 };
858 
859 #ifdef WLAN_FEATURE_GET_USABLE_CHAN_LIST
860 /**
861  * enum iftype - (virtual) interface types
862  *
863  * @IFTYPE_UNSPECIFIED: unspecified type, driver decides
864  * @IFTYPE_ADHOC: independent BSS member
865  * @IFTYPE_STATION: managed BSS member
866  * @IFTYPE_AP: access point
867  * @IFTYPE_AP_VLAN: VLAN interface for access points; VLAN interfaces
868  *      are a bit special in that they must always be tied to a pre-existing
869  *      AP type interface.
870  * @IFTYPE_WDS: wireless distribution interface
871  * @IFTYPE_MONITOR: monitor interface receiving all frames
872  * @IFTYPE_MESH_POINT: mesh point
873  * @IFTYPE_P2P_CLIENT: P2P client
874  * @IFTYPE_P2P_GO: P2P group owner
875  * @IFTYPE_P2P_DEVICE: P2P device interface type, this is not a netdev
876  *      and therefore can't be created in the normal ways, use the
877  *      %NL80211_CMD_START_P2P_DEVICE and %NL80211_CMD_STOP_P2P_DEVICE
878  *      commands to create and destroy one
879  * @IF_TYPE_OCB: Outside Context of a BSS
880  *      This mode corresponds to the MIB variable dot11OCBActivated=true
881  * @IF_TYPE_NAN: NAN mode
882  * @IFTYPE_MAX: highest interface type number currently defined
883  * @NUM_IFTYPES: number of defined interface types
884  *
885  * These values are used with the %NL80211_ATTR_IFTYPE
886  * to set the type of an interface.
887  *
888  */
889 enum iftype {
890 	IFTYPE_UNSPECIFIED,
891 	IFTYPE_ADHOC,
892 	IFTYPE_STATION,
893 	IFTYPE_AP,
894 	IFTYPE_AP_VLAN,
895 	IFTYPE_WDS,
896 	IFTYPE_MONITOR,
897 	IFTYPE_MESH_POINT,
898 	IFTYPE_P2P_CLIENT,
899 	IFTYPE_P2P_GO,
900 	IFTYPE_P2P_DEVICE,
901 	IFTYPE_OCB,
902 	IFTYPE_NAN,
903 
904 	/* keep last */
905 	NUM_IFTYPES,
906 	IFTYPE_MAX = NUM_IFTYPES - 1
907 };
908 
909 /**
910  * usable_channels_filter - Filters to get usable channels
911  * FILTER_CELLULAR_COEX: Avoid lte coex channels
912  * FILTER_WLAN_CONCURRENCY: Avoid con channels
913  **/
914 enum usable_channels_filter {
915 	FILTER_CELLULAR_COEX = 0,
916 	FILTER_WLAN_CONCURRENCY = 1,
917 };
918 
919 /**
920  * get_usable_chan_res_params - Usable channels resp params
921  * freq : center freq
922  * seg0_freq : seg0 freq
923  * seg1_freq: seg1 freq
924  * bw : bandwidth
925  * state: channel state
926  * iface_mode_mask: interface mode mask
927  **/
928 struct get_usable_chan_res_params {
929 	qdf_freq_t freq;
930 	uint32_t seg0_freq;
931 	uint32_t seg1_freq;
932 	enum phy_ch_width bw;
933 	uint32_t iface_mode_mask;
934 	enum channel_state state;
935 };
936 
937 /**
938  * get_usable_chan_req_params - Usable channels req params
939  * band_mask : band mask
940  * iface_mode_mask: interface mode mask
941  * filter_mask: filter mask
942  **/
943 struct get_usable_chan_req_params {
944 	uint32_t band_mask;
945 	uint32_t iface_mode_mask;
946 	uint32_t filter_mask;
947 };
948 #endif
949 
950 /**
951  * struct regulatory_channel
952  * @center_freq: center frequency
953  * @chan_num: channel number
954  * @state: channel state
955  * @chan_flags: channel flags
956  * @tx_power: TX powers
957  * @min_bw: min bandwidth
958  * @max_bw: max bandwidth
959  * @nol_chan: whether channel is nol
960  * @nol_history: Set NOL-History when STA vap detects RADAR.
961  * @is_chan_hop_blocked: Whether channel is blocked for ACS hopping.
962  * @ht40intol_flags: Contains Flags to indicate whether the 40PLUS/40MINUS
963  *                   version of the channel is blocked by ACS due to
964  *                   intolerance.
965  * @psd_flag: is PSD channel or not
966  * @psd_eirp: PSD power level
967  */
968 struct regulatory_channel {
969 	qdf_freq_t center_freq;
970 	uint8_t chan_num;
971 	enum channel_state state;
972 	uint32_t chan_flags;
973 	uint32_t tx_power;
974 	uint16_t min_bw;
975 	uint16_t max_bw;
976 	uint8_t ant_gain;
977 	bool nol_chan;
978 	bool nol_history;
979 #ifdef CONFIG_HOST_FIND_CHAN
980 	bool is_chan_hop_blocked;
981 	uint8_t ht40intol_flags;
982 #endif
983 #ifdef CONFIG_BAND_6GHZ
984 	bool psd_flag;
985 	uint16_t psd_eirp;
986 #endif
987 };
988 
989 /** struct ap_cli_pwr_mode_info: AP and client power mode information
990  * @is_mode_ap: Is it AP or CLIENT
991  * @cli_type:  Is the client a default or subordinate
992  * @ap_pwr_mode: LPI, SP or VLP
993  */
994 struct ap_cli_pwr_mode_info {
995 	bool is_mode_ap;
996 	enum reg_6g_client_type cli_type;
997 	enum reg_6g_ap_type ap_pwr_mode;
998 };
999 
1000 /**
1001  * enum supported_6g_pwr_types: 6G supported AP and Client power types
1002  * @REG_BEST_PWR_MODE: Best power mode
1003  * @REG_CURRENT_PWR_MODE: Current power mode
1004  * @REG_AP_LPI: LPI AP power mode
1005  * @REG_AP_SP: SP AP power mode
1006  * @REG_AP_VLP: VLP AP power mode
1007  * @REG_CLI_DEF_LPI: LPI default client mode
1008  * @REG_CLI_DEF_SP: SP default client mode
1009  * @REG_CLI_DEF_VLP: VLP default client mode
1010  * @REG_CLI_SUB_LPI: LPI subordinate client mode
1011  * @REG_CLI_SUB_SP: SP subordinate client mode
1012  * @REG_CLI_SUB_VLP: VLP subordinate client mode
1013  * @REG_INVALID_PWR_MODE: Invalid power mode
1014  */
1015 enum supported_6g_pwr_types {
1016 	REG_BEST_PWR_MODE    = -1,
1017 	REG_CURRENT_PWR_MODE = 0,
1018 	REG_AP_LPI           = 1,
1019 	REG_AP_SP            = 2,
1020 	REG_AP_VLP           = 3,
1021 	REG_CLI_DEF_LPI      = 4,
1022 	REG_CLI_DEF_SP       = 5,
1023 	REG_CLI_DEF_VLP      = 6,
1024 	REG_CLI_SUB_LPI      = 7,
1025 	REG_CLI_SUB_SP       = 8,
1026 	REG_CLI_SUB_VLP      = 9,
1027 	REG_INVALID_PWR_MODE = 10,
1028 };
1029 
1030 #define MAX_PWR_TYPES 10
1031 /**
1032  * struct psd_val: Regulatory power information
1033  * @psd_flag: Boolean to indicate if PSD is supported or not
1034  * @psd_eirp: PSD power
1035  * @tx_power: Maximum EIRP
1036  */
1037 struct psd_val {
1038 	bool psd_flag;
1039 	uint16_t psd_eirp;
1040 	uint32_t tx_power;
1041 };
1042 
1043 /**
1044  * struct super_chan_info: Information of a 6G channel for every power
1045  * mode
1046  * @power_types: Bitmap whose bit positions indicate the power modes supported
1047  * by a channel
1048  * @best_power_mode: Best power mode of a channel
1049  * @min_bw: Array of minimum bandwidths per power mode
1050  * @max_bw: Array of maximum bandwidths per power mode
1051  * @chan_flags_arr: Array of channel flags
1052  * @reg_chan_pwr: Array of powers
1053  * @state_arr: Array of states
1054  */
1055 struct super_chan_info {
1056 	uint16_t power_types;
1057 	enum supported_6g_pwr_types best_power_mode;
1058 	uint16_t min_bw[MAX_PWR_TYPES];
1059 	uint16_t max_bw[MAX_PWR_TYPES];
1060 	uint32_t chan_flags_arr[MAX_PWR_TYPES];
1061 	struct psd_val reg_chan_pwr[MAX_PWR_TYPES];
1062 	enum channel_state state_arr[MAX_PWR_TYPES];
1063 };
1064 
1065 /**
1066  * struct regulatory: regulatory information
1067  * @reg_domain: regulatory domain pair
1068  * @eeprom_rd_ext: eeprom value
1069  * @country_code: current country in integer
1070  * @alpha2: current alpha2
1071  * @def_country: default country alpha2
1072  * @def_region: DFS region
1073  * @ctl_2g: 2G CTL value
1074  * @ctl_5g: 5G CTL value
1075  * @reg_pair: pointer to regulatory pair
1076  * @cc_src: country code src
1077  * @reg_flags: kernel regulatory flags
1078  */
1079 struct regulatory {
1080 	uint32_t reg_domain;
1081 	uint32_t eeprom_rd_ext;
1082 	uint16_t country_code;
1083 	uint8_t alpha2[REG_ALPHA2_LEN + 1];
1084 	uint8_t ctl_2g;
1085 	uint8_t ctl_5g;
1086 	const void *regpair;
1087 	enum country_src cc_src;
1088 	uint32_t reg_flags;
1089 };
1090 
1091 /**
1092  * struct chan_map
1093  * @center_freq: center freq in mhz
1094  * @chan_num: channel number
1095  * @min_bw: min bw
1096  * @max_bw: max bw
1097  */
1098 struct chan_map {
1099 	qdf_freq_t center_freq;
1100 	uint8_t chan_num;
1101 	uint16_t min_bw;
1102 	uint16_t max_bw;
1103 };
1104 
1105 /**
1106  * struct bonded_channel
1107  * @start_ch: start channel
1108  * @end_ch: end channel
1109  */
1110 struct bonded_channel {
1111 	uint8_t start_ch;
1112 	uint8_t end_ch;
1113 };
1114 
1115 /**
1116  * struct bonded_channel_freq
1117  * @start_freq: start channel frequency
1118  * @end_freq: end channel frequency
1119  */
1120 struct bonded_channel_freq {
1121 	uint16_t start_freq;
1122 	uint16_t end_freq;
1123 };
1124 
1125 struct set_country {
1126 	uint8_t country[REG_ALPHA2_LEN + 1];
1127 	uint8_t pdev_id;
1128 };
1129 /**
1130  * enum ht_sec_ch_offset
1131  * @NO_SEC_CH: no secondary
1132  * @LOW_PRIMARY_CH: low primary
1133  * @HIGH_PRIMARY_CH: high primary
1134  */
1135 enum ht_sec_ch_offset {
1136 	NO_SEC_CH = 0,
1137 	LOW_PRIMARY_CH = 1,
1138 	HIGH_PRIMARY_CH = 3,
1139 };
1140 
1141 enum cc_setting_code {
1142 	REG_SET_CC_STATUS_PASS = 0,
1143 	REG_CURRENT_ALPHA2_NOT_FOUND = 1,
1144 	REG_INIT_ALPHA2_NOT_FOUND = 2,
1145 	REG_SET_CC_CHANGE_NOT_ALLOWED = 3,
1146 	REG_SET_CC_STATUS_NO_MEMORY = 4,
1147 	REG_SET_CC_STATUS_FAIL = 5,
1148 };
1149 
1150 /**
1151  * struct cur_reg_rule
1152  * @start_freq: start frequency
1153  * @end_freq: end frequency
1154  * @max_bw: maximum bandwidth
1155  * @reg_power: regulatory power
1156  * @ant_gain: antenna gain
1157  * @flags: regulatory flags
1158  * @psd_flag: is PSD power used
1159  * @psd_eirp: maximum PSD EIRP value
1160  */
1161 struct cur_reg_rule {
1162 	uint16_t start_freq;
1163 	uint16_t end_freq;
1164 	uint16_t max_bw;
1165 	uint8_t reg_power;
1166 	uint8_t ant_gain;
1167 	uint16_t flags;
1168 	bool psd_flag;
1169 	uint16_t psd_eirp;
1170 };
1171 
1172 #ifdef CONFIG_REG_CLIENT
1173 /**
1174  * struct cur_fcc_rule
1175  * @center_freq: center frequency
1176  * @tx_power: transmission power
1177  */
1178 struct cur_fcc_rule {
1179 	uint16_t center_freq;
1180 	uint8_t tx_power;
1181 };
1182 #endif
1183 
1184 /**
1185  * struct cur_regulatory_info
1186  * @psoc: psoc ptr
1187  * @status_code: status value
1188  * @num_phy: number of phy
1189  * @phy_id: phy id
1190  * @reg_dmn_pair: reg domain pair
1191  * @ctry_code: country code
1192  * @alpha2: country alpha2
1193  * @offload_enabled: offload enabled
1194  * @dfs_reg: dfs region
1195  * @phybitmap: phy bit map
1196  * @min_bw_2g: minimum 2G bw
1197  * @max_bw_2g: maximum 2G bw
1198  * @min_bw_5g: minimum 5G bw
1199  * @max_bw_5g: maximum 5G bw
1200  * @num_2g_reg_rules: number 2G reg rules
1201  * @num_5g_reg_rules: number 5G  and 6G reg rules
1202  * @reg_6g_thresh_priority_freq: All frequencies greater or equal will be given
1203  * priority during channel selection by upper layer
1204  * @reg_rules_2g_ptr: ptr to 2G reg rules
1205  * @reg_rules_5g_ptr: ptr to 5G reg rules
1206  * @client_type: type of client
1207  * @rnr_tpe_usable: if RNR TPE octet is usable for country
1208  * @unspecified_ap_usable: if not set, AP usable for country
1209  * @domain_code_6g_ap: domain code for 6G AP
1210  * @domain_code_6g_client: domain code for 6G client in SP mode
1211  * @domain_code_6g_super_id: 6G super domain ID
1212  * @min_bw_6g_ap: minimum 6G bw for AP
1213  * @max_bw_6g_ap: maximum 6G bw for AP
1214  * @min_bw_6g_client: list of minimum 6G bw for clients
1215  * @max_bw_6g_client: list of maximum 6G bw for clients
1216  * @num_6g_reg_rules_ap: number of 6G reg rules for AP
1217  * @num_6g_reg_rules_client: list of number of 6G reg rules for client
1218  * @reg_rules_6g_ap_ptr: ptr to 6G AP reg rules
1219  * @reg_rules_6g_client_ptr: list of ptr to 6G client reg rules
1220  * @fcc_rules_ptr: ptr to fcc rules
1221  * @num_fcc_rules: Number of fcc rules sent by firmware
1222  */
1223 struct cur_regulatory_info {
1224 	struct wlan_objmgr_psoc *psoc;
1225 	enum cc_setting_code status_code;
1226 	uint8_t num_phy;
1227 	uint8_t phy_id;
1228 	uint16_t reg_dmn_pair;
1229 	uint16_t ctry_code;
1230 	uint8_t alpha2[REG_ALPHA2_LEN + 1];
1231 	bool offload_enabled;
1232 	enum dfs_reg dfs_region;
1233 	uint32_t phybitmap;
1234 	uint32_t min_bw_2g;
1235 	uint32_t max_bw_2g;
1236 	uint32_t min_bw_5g;
1237 	uint32_t max_bw_5g;
1238 	uint32_t num_2g_reg_rules;
1239 	uint32_t num_5g_reg_rules;
1240 	qdf_freq_t reg_6g_thresh_priority_freq;
1241 	struct cur_reg_rule *reg_rules_2g_ptr;
1242 	struct cur_reg_rule *reg_rules_5g_ptr;
1243 	enum reg_6g_client_type client_type;
1244 	bool rnr_tpe_usable;
1245 	bool unspecified_ap_usable;
1246 	uint8_t domain_code_6g_ap[REG_CURRENT_MAX_AP_TYPE];
1247 	uint8_t domain_code_6g_client[REG_CURRENT_MAX_AP_TYPE][REG_MAX_CLIENT_TYPE];
1248 	uint32_t domain_code_6g_super_id;
1249 	uint32_t min_bw_6g_ap[REG_CURRENT_MAX_AP_TYPE];
1250 	uint32_t max_bw_6g_ap[REG_CURRENT_MAX_AP_TYPE];
1251 	uint32_t min_bw_6g_client[REG_CURRENT_MAX_AP_TYPE][REG_MAX_CLIENT_TYPE];
1252 	uint32_t max_bw_6g_client[REG_CURRENT_MAX_AP_TYPE][REG_MAX_CLIENT_TYPE];
1253 	uint32_t num_6g_reg_rules_ap[REG_CURRENT_MAX_AP_TYPE];
1254 	uint32_t num_6g_reg_rules_client[REG_CURRENT_MAX_AP_TYPE][REG_MAX_CLIENT_TYPE];
1255 	struct cur_reg_rule *reg_rules_6g_ap_ptr[REG_CURRENT_MAX_AP_TYPE];
1256 	struct cur_reg_rule *reg_rules_6g_client_ptr[REG_CURRENT_MAX_AP_TYPE][REG_MAX_CLIENT_TYPE];
1257 #ifdef CONFIG_REG_CLIENT
1258 	struct cur_fcc_rule *fcc_rules_ptr;
1259 	uint32_t num_fcc_rules;
1260 #endif
1261 };
1262 
1263 #if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ)
1264 
1265 /**
1266  * reg_afc_event_type indicates the type of AFC event sent from FW to host.
1267  * 1. For sending Power Info REG_AFC_EVENT_POWER_INFO event is used.
1268  * 2. For sending AFC expiry use REG_AFC_EVENT_TIMER_EXPIRY
1269  * This type can be expanded in future as per requirements.
1270  */
1271 enum reg_afc_event_type {
1272 	REG_AFC_EVENT_POWER_INFO = 1,
1273 	REG_AFC_EVENT_TIMER_EXPIRY = 2,
1274 };
1275 
1276 /**
1277  * reg_afc_expiry_event_subtype indicates the subtype.
1278  * 1. At boot up AFC expiry will contain AFC start.
1279  * 2. If AFC timer expires AFC_RENEW status code will be sent to host
1280  *    with expiry event.
1281  * 3. If AFC server is not responding to FW in specified time, FW will
1282  *    indicate host to switch to LPI.
1283  */
1284 enum reg_afc_expiry_event_subtype {
1285 	REG_AFC_EXPIRY_EVENT_START = 1,
1286 	REG_AFC_EXPIRY_EVENT_RENEW = 2,
1287 	REG_AFC_EXPIRY_EVENT_SWITCH_TO_LPI = 3,
1288 	REG_AFC_EXPIRY_EVENT_STOP_TX = 4,
1289 };
1290 
1291 /**
1292  * The following fw_status_code is mutually exclusive
1293  * and is used in power event.
1294  * 0. AFC power event is success.
1295  * 1. If Host does not indicate AFC indication cmd within certain time
1296  *    of AFC expiry, REG_FW_AFC_POWER_EVENT_RESP_NOT_RECEIVED will be used.
1297  * 2. If FW is not able to parse afc_info, parsing_failure will be
1298  *    indicated using REG_FW_AFC_POWER_EVENT_RESP_NOT_RECEIVED.
1299  * 3. If due to some local reason AFC event is failed, AFC event failure
1300  *    is indicated using REG_FW_AFC_POWER_EVENT_FAILURE.
1301  */
1302 enum reg_fw_afc_power_event_status_code {
1303 	REG_FW_AFC_POWER_EVENT_SUCCESS = 0,
1304 	REG_FW_AFC_POWER_EVENT_RESP_NOT_RECEIVED = 1,
1305 	REG_FW_AFC_POWER_EVENT_RESP_PARSING_FAILURE = 2,
1306 	REG_FW_AFC_POWER_EVENT_FAILURE = 3,
1307 };
1308 
1309 /**
1310  * The following reg_afc_server_resp_code is mutually exclusive.
1311  * This response code will be indicated to AFC server.
1312  * These codes are defined in WIFI spec doc for AFC as follows
1313  * -1: General Failure
1314  * 0:  Success
1315  * 100 - 199: General errors related to the protocol
1316  * 300 - 399: Error events specific to message exchange for the
1317  *            Available Spectrum Inquiry
1318  */
1319 enum reg_afc_serv_resp_code {
1320 	REG_AFC_SERV_RESP_GENERAL_FAILURE = -1,
1321 	REG_AFC_SERV_RESP_SUCCESS = 0,
1322 	REG_AFC_SERV_RESP_VERSION_NOT_SUPPORTED = 100,
1323 	REG_AFC_SERV_RESP_DEVICE_UNALLOWED = 101,
1324 	REG_AFC_SERV_RESP_MISSING_PARAM = 102,
1325 	REG_AFC_SERV_RESP_INVALID_VALUE = 103,
1326 	REG_AFC_SERV_RESP_UNEXPECTED_PARAM = 106,
1327 	REG_AFC_SERV_RESP_UNSUPPORTED_SPECTRUM = 300,
1328 };
1329 
1330 /**
1331  * struct afc_freq_obj
1332  * @low_freq: Lower edge frequency
1333  * @high_freq: Upper edge frequency
1334  * @max_psd: Max PSD in 0.01 dBm/MHz units
1335  */
1336 struct afc_freq_obj {
1337 	qdf_freq_t low_freq;
1338 	qdf_freq_t high_freq;
1339 	int16_t max_psd;
1340 };
1341 
1342 /**
1343  * struct chan_eirp_obj
1344  * @cfi: Channel frequency index
1345  * @eirp_power: Max EIRP power in 0.01 dBm units
1346  */
1347 struct chan_eirp_obj {
1348 	uint8_t cfi;
1349 	uint16_t eirp_power;
1350 };
1351 
1352 /**
1353  * struct afc_chan_obj
1354  * @global_opclass: Global Operating class
1355  * @num_chans: Number of channels
1356  * @chan_eirp_info: Pointer to afc channel EIRP object
1357  */
1358 struct afc_chan_obj {
1359 	uint8_t global_opclass;
1360 	uint8_t num_chans;
1361 	struct chan_eirp_obj *chan_eirp_info;
1362 };
1363 
1364 /**
1365  * struct reg_afc_expiry_event
1366  * @request_id: AFC request id generated by the firmware
1367  * @event_subtype: AFC expiry event subtype
1368  */
1369 struct reg_afc_expiry_event {
1370 	uint32_t request_id;
1371 	enum reg_afc_expiry_event_subtype event_subtype;
1372 };
1373 
1374 /**
1375  * struct reg_fw_afc_power_event
1376  * @resp_id: AFC server response id
1377  * @fw_status_code: firmware status code
1378  * @serv_resp_code: AFC server response code
1379  * @afc_wfa_version: AFC version
1380  * @avail_exp_time_d: Expiry date of the AFC power info
1381  * @avail_exp_time_t: Time left for expiry of the AFC power info
1382  * @num_freq_objs: Number of freq objects
1383  * @num_chan_objs: Number of channel objects
1384  * @afc_freq_info: Pointer to AFC freq object
1385  * @afc_chan_info: Pointer to AFC channel object
1386  */
1387 struct reg_fw_afc_power_event {
1388 	uint32_t resp_id;
1389 	enum reg_fw_afc_power_event_status_code fw_status_code;
1390 	enum reg_afc_serv_resp_code serv_resp_code;
1391 	uint32_t afc_wfa_version;
1392 	uint32_t avail_exp_time_d;
1393 	uint32_t avail_exp_time_t;
1394 	uint8_t num_freq_objs;
1395 	uint8_t num_chan_objs;
1396 	struct afc_freq_obj *afc_freq_info;
1397 	struct afc_chan_obj *afc_chan_info;
1398 };
1399 
1400 /**
1401  * struct afc_regulatory_info
1402  * @psoc: psoc ptr
1403  * @phy_id: phy id
1404  * @event_type: AFC event type
1405  * @expiry_info: pointer to information present in the AFC expiry event
1406  * @power_info: pointer to information present in the AFC power event
1407  */
1408 struct afc_regulatory_info {
1409 	struct wlan_objmgr_psoc *psoc;
1410 	uint8_t phy_id;
1411 	enum reg_afc_event_type event_type;
1412 	union {
1413 		struct reg_afc_expiry_event *expiry_info;
1414 		struct reg_fw_afc_power_event *power_info;
1415 	};
1416 };
1417 #endif
1418 
1419 /**
1420  * struct reg_rule_info
1421  * @alpha2: alpha2 of reg rules
1422  * @dfs_region: dfs region
1423  * @num_of_reg_rules: number of reg rules
1424  * @reg_rules: regulatory rules array
1425  * @num_of_6g_client_reg_rules: number of 6g reg rules
1426  * @reg_rules_6g_client: reg rules for all 6g clients
1427  */
1428 struct reg_rule_info {
1429 	uint8_t alpha2[REG_ALPHA2_LEN + 1];
1430 	enum dfs_reg dfs_region;
1431 	uint8_t num_of_reg_rules;
1432 	struct cur_reg_rule reg_rules[MAX_REG_RULES];
1433 #ifdef CONFIG_BAND_6GHZ
1434 	uint8_t num_of_6g_ap_reg_rules[REG_CURRENT_MAX_AP_TYPE];
1435 	struct cur_reg_rule reg_rules_6g_ap[REG_CURRENT_MAX_AP_TYPE][MAX_6G_REG_RULES];
1436 	uint8_t num_of_6g_client_reg_rules[REG_CURRENT_MAX_AP_TYPE];
1437 	struct cur_reg_rule reg_rules_6g_client[REG_CURRENT_MAX_AP_TYPE][MAX_6G_REG_RULES];
1438 #endif
1439 };
1440 
1441 /**
1442  * enum reg_reg_wifi_band
1443  * @REG_BAND_2G: 2G band
1444  * @REG_BAND_5G: 5G band
1445  * @REG_BAND_6G: 6G band
1446  * @REG_BAND_UNKNOWN: Unsupported band
1447  */
1448 enum reg_wifi_band {
1449 	REG_BAND_2G,
1450 	REG_BAND_5G,
1451 	REG_BAND_6G,
1452 	REG_BAND_UNKNOWN
1453 };
1454 
1455 #ifdef DISABLE_UNII_SHARED_BANDS
1456 /**
1457  * enum reg_unii_band
1458  * @REG_UNII_BAND_1: Disable UNII-1 band channels
1459  * @REG_UNII_BAND_2A: Disable UNII-2A band channels
1460  */
1461 enum reg_unii_band {
1462 	REG_UNII_BAND_1 = 0x0,
1463 	REG_UNII_BAND_2A = 0x1,
1464 };
1465 #endif
1466 
1467 #define REG_BAND_MASK_ALL (BIT(REG_BAND_2G) | BIT(REG_BAND_5G) \
1468 			  | BIT(REG_BAND_6G))
1469 
1470 /* Avoid the use of band_info as it does not support 6GHz band. Use
1471  * reg_wifi_band, as it supports the 6GHz band
1472  */
1473 /**
1474  * enum band_info
1475  * @BAND_ALL:all bands
1476  * @BAND_2G: 2G band
1477  * @BAND_5G: 5G band
1478  * @BAND_UNKNOWN: Unsupported band
1479  */
1480 enum band_info {
1481 	BAND_ALL,
1482 	BAND_2G,
1483 	BAND_5G,
1484 	BAND_UNKNOWN
1485 };
1486 
1487 /**
1488  * enum restart_beaconing_on_ch_avoid_rule: control the beaconing entity to
1489  * move away from active LTE channels
1490  * @CH_AVOID_RULE_DO_NOT_RESTART: Do not move from active LTE
1491  *                              channels
1492  * @CH_AVOID_RULE_RESTART: Move from active LTE channels
1493  * @CH_AVOID_RULE_RESTART_24G_ONLY: move from 2.4G active LTE
1494  *                                channels only
1495  */
1496 enum restart_beaconing_on_ch_avoid_rule {
1497 	CH_AVOID_RULE_DO_NOT_RESTART,
1498 	CH_AVOID_RULE_RESTART,
1499 	CH_AVOID_RULE_RESTART_24G_ONLY,
1500 };
1501 
1502 /**
1503  * struct reg_config_vars
1504  * @enable_11d_support: enable 11d support
1505  * @scan_11d_interval: 11d scan interval in ms
1506  * @userspace_ctry_priority: user priority
1507  * @band_capability: band capability
1508  * @dfs_disable: dfs disabled
1509  * @indoor_channel_support: indoor channel support
1510  * @force_ssc_disable_indoor_channel: Disable indoor channel on sap start
1511  * @restart_beaconing: control the beaconing entity to move
1512  * away from active LTE channels
1513  * @enable_srd_chan_in_master_mode: SRD channel support in master mode
1514  * @enable_11d_in_world_mode: enable 11d in world mode
1515  * @enable_5dot9_ghz_chan_in_master_mode: 5.9 GHz channel support in
1516  * master mode
1517  * @retain_nol_across_regdmn_update: Retain the NOL list across the regdomain.
1518  * @coex_unsafe_chan_nb_user_prefer: Honor coex unsafe chan cmd from firmware or
1519  * userspace
1520  * @coex_unsafe_chan_reg_disable: To disable reg channels for received coex
1521  * unsafe channels list
1522  * @sta_sap_scc_on_indoor_channel: Value of sap+sta scc on indoor support
1523  */
1524 struct reg_config_vars {
1525 	uint32_t enable_11d_support;
1526 	uint32_t scan_11d_interval;
1527 	uint32_t userspace_ctry_priority;
1528 	uint32_t band_capability;
1529 	uint32_t dfs_enabled;
1530 	uint32_t indoor_chan_enabled;
1531 	uint32_t force_ssc_disable_indoor_channel;
1532 	enum restart_beaconing_on_ch_avoid_rule restart_beaconing;
1533 	uint8_t enable_srd_chan_in_master_mode;
1534 	bool enable_11d_in_world_mode;
1535 	bool enable_5dot9_ghz_chan_in_master_mode;
1536 	bool retain_nol_across_regdmn_update;
1537 #ifdef FEATURE_WLAN_CH_AVOID_EXT
1538 	bool coex_unsafe_chan_nb_user_prefer;
1539 	bool coex_unsafe_chan_reg_disable;
1540 #endif
1541 	bool sta_sap_scc_on_indoor_channel;
1542 };
1543 
1544 /**
1545  * struct reg_freq_range
1546  * @low_freq: low frequency
1547  * @high_freq: high frequency
1548  */
1549 struct reg_freq_range {
1550 	uint32_t low_freq;
1551 	uint32_t high_freq;
1552 };
1553 
1554 /**
1555  * enum direction
1556  * @NORTHBOUND: northbound
1557  * @SOUTHBOUND: southbound
1558  */
1559 enum direction {
1560 	NORTHBOUND,
1561 	SOUTHBOUND,
1562 };
1563 
1564 /**
1565  * struct mas_chan_params
1566  * @dfs_region: dfs region
1567  * @phybitmap: phybitmap
1568  * @mas_chan_list: master chan list for 2GHz and 5GHz channels
1569  * @is_6g_channel_list_populated: indicates the channel lists are populated
1570  * @mas_chan_list_6g_ap: master chan list for 6GHz AP channels
1571  * @mas_chan_list_6g_client: master chan list for 6GHz client
1572  * @is_6g_afc_power_event_received: indicates if the AFC event is received.
1573  * @mas_chan_list_6g_afc: master chan list for 6GHz AFC
1574  * @default_country: default country
1575  * @current_country: current country
1576  * @def_region_domain: default reg domain
1577  * @def_country_code: default country code
1578  * @reg_dmn_pair: reg domain pair
1579  * @reg_6g_superid: 6G super domain ID
1580  * @ctry_code: country code
1581  * @reg_rules: regulatory rules
1582  * @client_type: type of client
1583  * @rnr_tpe_usable: if RNR TPE octet is usable for country
1584  * @unspecified_ap_usable: if not set, AP usable for country
1585  * @max_bw_5g: Maximum 5g Bandwidth
1586  * @reg_6g_thresh_priority_freq: All frequencies greater or equal will be given
1587  * priority during channel selection by upper layer
1588  */
1589 struct mas_chan_params {
1590 	enum dfs_reg dfs_region;
1591 	uint32_t phybitmap;
1592 	struct regulatory_channel mas_chan_list[NUM_CHANNELS];
1593 #ifdef CONFIG_BAND_6GHZ
1594 	bool is_6g_channel_list_populated;
1595 	struct regulatory_channel mas_chan_list_6g_ap[REG_CURRENT_MAX_AP_TYPE][NUM_6GHZ_CHANNELS];
1596 	struct regulatory_channel mas_chan_list_6g_client[REG_CURRENT_MAX_AP_TYPE][REG_MAX_CLIENT_TYPE][NUM_6GHZ_CHANNELS];
1597 #ifdef CONFIG_AFC_SUPPORT
1598 	bool is_6g_afc_power_event_received;
1599 	struct regulatory_channel mas_chan_list_6g_afc[NUM_6GHZ_CHANNELS];
1600 #endif
1601 #endif
1602 	char default_country[REG_ALPHA2_LEN + 1];
1603 	char current_country[REG_ALPHA2_LEN + 1];
1604 	uint16_t def_region_domain;
1605 	uint16_t def_country_code;
1606 	uint32_t reg_dmn_pair;
1607 	uint16_t reg_6g_superid;
1608 	uint16_t ctry_code;
1609 	struct reg_rule_info reg_rules;
1610 #ifdef CONFIG_BAND_6GHZ
1611 	enum reg_6g_ap_type ap_pwr_type;
1612 	enum reg_6g_client_type client_type;
1613 	bool rnr_tpe_usable;
1614 	bool unspecified_ap_usable;
1615 	qdf_freq_t reg_6g_thresh_priority_freq;
1616 #endif
1617 	uint16_t max_bw_5g;
1618 };
1619 
1620 /**
1621  * enum cc_regdmn_flag: Regdomain flags
1622  * @INVALID:       Invalid flag
1623  * @CC_IS_SET:     Country code is set
1624  * @REGDMN_IS_SET: Regdomain ID is set
1625  * @ALPHA_IS_SET:  Country ISO is set
1626  */
1627 enum cc_regdmn_flag {
1628 	INVALID_CC,
1629 	CC_IS_SET,
1630 	REGDMN_IS_SET,
1631 	ALPHA_IS_SET,
1632 };
1633 
1634 /**
1635  * struct cc_regdmn_s: User country code or regdomain
1636  * @country_code:     Country code
1637  * @reg_2g_5g_pair_id:  Regdomain pair ID (2Ghz + 5Ghz domain pair)
1638  * @sixg_superdmn_id: 6Ghz super domain id
1639  * @alpha:            Country ISO
1640  * @flags:            Regdomain flags
1641  */
1642 struct cc_regdmn_s {
1643 	union {
1644 		uint16_t country_code;
1645 		struct {
1646 			uint16_t reg_2g_5g_pair_id;
1647 			uint16_t sixg_superdmn_id;
1648 		} regdmn;
1649 		uint8_t alpha[REG_ALPHA2_LEN + 1];
1650 	} cc;
1651 	uint8_t flags;
1652 };
1653 
1654 /**
1655  * struct cur_regdmn_info: Current regulatory info
1656  * @regdmn_pair_id: Current regdomain pair ID
1657  * @dmn_id_2g: 2GHz regdomain ID
1658  * @dmn_id_5g: 5GHz regdomain ID
1659  * @ctl_2g: 2GHz CTL value
1660  * @ctl_5g: 5GHzCTL value
1661  * @dfs_region: dfs region
1662  */
1663 struct cur_regdmn_info {
1664 	uint16_t regdmn_pair_id;
1665 	uint16_t dmn_id_2g;
1666 	uint16_t dmn_id_5g;
1667 	uint8_t ctl_2g;
1668 	uint8_t ctl_5g;
1669 	uint8_t dfs_region;
1670 };
1671 
1672 /**
1673  * struct ch_avoid_freq_type
1674  * @start_freq: start freq
1675  * @end_freq: end freq
1676  * @txpower: txpower
1677  */
1678 struct ch_avoid_freq_type {
1679 	qdf_freq_t start_freq;
1680 	qdf_freq_t end_freq;
1681 	int32_t txpower;
1682 	bool is_valid_txpower;
1683 };
1684 
1685 /**
1686  * struct ch_avoid_ind_type
1687  * @ch_avoid_range_cnt: count
1688  * @avoid_freq_range: avoid freq range array
1689  * @restriction_mask: restriction mask to apply txpower
1690  */
1691 struct ch_avoid_ind_type {
1692 	uint32_t ch_avoid_range_cnt;
1693 	struct ch_avoid_freq_type avoid_freq_range[CH_AVOID_MAX_RANGE];
1694 	uint32_t restriction_mask;
1695 };
1696 
1697 /**
1698  * struct unsafe_ch_list
1699  * @chan_cnt: no.of channels
1700  * @chan_freq_list: channel frequency list
1701  */
1702 struct unsafe_ch_list {
1703 	uint16_t chan_cnt;
1704 	uint16_t chan_freq_list[NUM_CHANNELS];
1705 	int32_t txpower[NUM_CHANNELS];
1706 	bool is_valid_txpower[NUM_CHANNELS];
1707 };
1708 
1709 /**
1710  * struct avoid_freq_ind_data
1711  * @freq_list: frequency list
1712  * @chan_list: channel list
1713  */
1714 struct avoid_freq_ind_data {
1715 	struct ch_avoid_ind_type freq_list;
1716 	struct unsafe_ch_list chan_list;
1717 };
1718 
1719 /**
1720  * struct reg_sched_payload
1721  * @psoc: psoc ptr
1722  * @pdev: pdev ptr
1723  * @ch_avoid_ind: if avoidance event indicated
1724  * @avoid_info: chan avoid info if @ch_avoid_ind is true
1725  */
1726 struct reg_sched_payload {
1727 	struct wlan_objmgr_psoc *psoc;
1728 	struct wlan_objmgr_pdev *pdev;
1729 	bool ch_avoid_ind;
1730 	struct avoid_freq_ind_data avoid_info;
1731 };
1732 
1733 #define FIVEG_STARTING_FREQ        5000
1734 #define TWOG_STARTING_FREQ         2407
1735 #define TWOG_CHAN_14_IN_MHZ        2484
1736 #define TWOG_CHAN_1_IN_MHZ         2412
1737 #define TWOG_CHAN_5_IN_MHZ         2432
1738 #define TWOG_CHAN_6_IN_MHZ         2437
1739 #define TWOG_CHAN_9_IN_MHZ         2452
1740 #define TWOG_CHAN_13_IN_MHZ        2472
1741 #define FIVEG_CHAN_36_IN_MHZ       5180
1742 #define FIVEG_CHAN_177_IN_MHZ      5885
1743 #define SIXG_CHAN_2_IN_MHZ         5935
1744 #define SIXG_CHAN_1_IN_MHZ         5955
1745 #define SIXG_CHAN_233_IN_MHZ       7115
1746 
1747 #define HT40_SEC_OFFSET              20
1748 
1749 #define IEEE_2GHZ_CH1                 1
1750 #define IEEE_2GHZ_CH14               14
1751 #define IEEE_5GHZ_CH36               36
1752 #define IEEE_6GHZ_CH1                 1
1753 #define IEEE_6GHZ_CH2                 2
1754 #define IEEE_CH_SEP                   5
1755 
1756 /**
1757  * struct reg_ctl_params - reg ctl and regd info
1758  * @regd: regdomain pair
1759  * @regd_2g: 2g sub domain code
1760  * @regd_5g: 5g sub domain code
1761  * @ctl_2g: 2g ctl info
1762  * @ctl_5g: 5g ctl info
1763  */
1764 struct reg_ctl_params {
1765 	uint32_t regd;
1766 	uint16_t regd_2g;
1767 	uint16_t regd_5g;
1768 	uint8_t ctl_2g;
1769 	uint8_t ctl_5g;
1770 };
1771 
1772 /**
1773  * enum reg_phymode - Regulatory phymode
1774  * @REG_PHYMODE_INVALID: Invalid phymode
1775  * @REG_PHYMODE_11B: 802.11b phymode
1776  * @REG_PHYMODE_11G: 802.11g phymode
1777  * @REG_PHYMODE_11A: 802.11a phymode
1778  * @REG_PHYMODE_11N: 802.11n phymode
1779  * @REG_PHYMODE_11AC: 802.11ac phymode
1780  * @REG_PHYMODE_11AX: 802.11ax phymode
1781  * @REG_PHYMODE_11BE: 802.11be phymode
1782  * @REG_PHYMODE_MAX: placeholder for future phymodes
1783  */
1784 enum reg_phymode {
1785 	REG_PHYMODE_INVALID,
1786 	REG_PHYMODE_11B,
1787 	REG_PHYMODE_11G,
1788 	REG_PHYMODE_11A,
1789 	REG_PHYMODE_11N,
1790 	REG_PHYMODE_11AC,
1791 	REG_PHYMODE_11AX,
1792 #ifdef WLAN_FEATURE_11BE
1793 	REG_PHYMODE_11BE,
1794 #endif
1795 	REG_PHYMODE_MAX,
1796 };
1797 
1798 /**
1799  * struct chan_power_info - TPE containing power info per channel chunk
1800  * @chan_cfreq: channel center freq (MHz)
1801  * @tx_power: transmit power (dBm)
1802  */
1803 struct chan_power_info {
1804 	qdf_freq_t chan_cfreq;
1805 	uint8_t tx_power;
1806 };
1807 
1808 /**
1809  * struct reg_tpc_power_info - regulatory TPC power info
1810  * @is_psd_power: is PSD power or not
1811  * @eirp_power: Maximum EIRP power (dBm), valid only if power is PSD
1812  * @power_type_6g: type of power (SP/LPI/VLP)
1813  * @num_pwr_levels: number of power levels
1814  * @reg_max: Array of maximum TX power (dBm) per PSD value
1815  * @ap_constraint_power: AP constraint power (dBm)
1816  * @frequency: Array of operating frequency
1817  * @tpe: TPE values processed from TPE IE
1818  * @chan_power_info: power info to send to FW
1819  */
1820 struct reg_tpc_power_info {
1821 	bool is_psd_power;
1822 	uint8_t eirp_power;
1823 	uint8_t power_type_6g;
1824 	uint8_t num_pwr_levels;
1825 	uint8_t reg_max[MAX_NUM_PWR_LEVEL];
1826 	uint8_t ap_constraint_power;
1827 	qdf_freq_t frequency[MAX_NUM_PWR_LEVEL];
1828 	uint8_t tpe[MAX_NUM_PWR_LEVEL];
1829 	struct chan_power_info chan_power_info[MAX_NUM_PWR_LEVEL];
1830 };
1831 
1832 #ifdef FEATURE_WLAN_CH_AVOID_EXT
1833 typedef struct unsafe_ch_list avoid_ch_ext_list;
1834 /**
1835  * struct chan_5g_center_freq
1836  * @center_freq_20: center frequency of max 200Mhz
1837  * @center_freq_40: center frequency of max 40Mhz
1838  * @center_freq_80: center frequency of max 80Mhz
1839  * @center_freq_160: center frequency of max 160Mhz
1840  */
1841 struct chan_5g_center_freq {
1842 	qdf_freq_t center_freq_20;
1843 	qdf_freq_t center_freq_40;
1844 	qdf_freq_t center_freq_80;
1845 	qdf_freq_t center_freq_160;
1846 };
1847 
1848 #define INVALID_CENTER_FREQ 0
1849 /*MAX 5g channel numbers, not include dsrc*/
1850 #define MAX_5G_CHAN_NUM 28
1851 
1852 #endif
1853 
1854 /**
1855  * enum HOST_REGDMN_MODE:
1856  * @HOST_REGDMN_MODE_11A: 11a channels
1857  * @HOST_REGDMN_MODE_TURBO: 11a turbo-only channels
1858  * @HOST_REGDMN_MODE_11B: 11b channels
1859  * @HOST_REGDMN_MODE_PUREG: 11g channels (OFDM only)
1860  * @HOST_REGDMN_MODE_11G: historical
1861  * @HOST_REGDMN_MODE_108G: 11g+Turbo channels
1862  * @HOST_REGDMN_MODE_108A: 11a+Turbo channels
1863  * @HOST_REGDMN_MODE_11AC_VHT20_2G: 2GHz, VHT20
1864  * @HOST_REGDMN_MODE_XR: XR channels
1865  * @HOST_REGDMN_MODE_11A_HALF_RATE: 11a half rate channels
1866  * @HOST_REGDMN_MODE_11A_QUARTER_RATE: 11a quarter rate channels
1867  * @HOST_REGDMN_MODE_11NG_HT20: 11ng HT20 channels
1868  * @HOST_REGDMN_MODE_11NA_HT20: 11na HT20 channels
1869  * @HOST_REGDMN_MODE_11NG_HT40PLUS: 11ng HT40+ channels
1870  * @HOST_REGDMN_MODE_11NG_HT40MINUS: 11ng HT40- channels
1871  * @HOST_REGDMN_MODE_11NA_HT40PLUS: 11na HT40+ channels
1872  * @HOST_REGDMN_MODE_11NA_HT40MINUS: 11na HT40- channels
1873  * @HOST_REGDMN_MODE_11AC_VHT20: 5GHz, VHT20
1874  * @HOST_REGDMN_MODE_11AC_VHT40PLUS: 5GHz, VHT40+ channels
1875  * @HOST_REGDMN_MODE_11AC_VHT40MINUS: 5GHz, VHT40- channels
1876  * @HOST_REGDMN_MODE_11AC_VHT80: 5GHz, VHT80 channels
1877  * @HOST_REGDMN_MODE_11AC_VHT160: 5GHz, VHT160 channels
1878  * @HOST_REGDMN_MODE_11AC_VHT80_80: 5GHz, VHT80+80 channels
1879  * @HOST_REGDMN_MODE_11AXG_HE20: 11ax 2.4GHz, HE20 channels
1880  * @HOST_REGDMN_MODE_11AXA_HE20: 11ax 5GHz, HE20 channels
1881  * @HOST_REGDMN_MODE_11AXG_HE40PLUS: 11ax 2.4GHz, HE40+ channels
1882  * @HOST_REGDMN_MODE_11AXG_HE40MINUS: 11ax 2.4GHz, HE40- channels
1883  * @HOST_REGDMN_MODE_11AXA_HE40PLUS: 11ax 5GHz, HE40+ channels
1884  * @HOST_REGDMN_MODE_11AXA_HE40MINUS: 11ax 5GHz, HE40- channels
1885  * @HOST_REGDMN_MODE_11AXA_HE80: 11ax 5GHz, HE80 channels
1886  * @HOST_REGDMN_MODE_11AXA_HE160: 11ax 5GHz, HE160 channels
1887  * @HOST_REGDMN_MODE_11AXA_HE80_80: 11ax 5GHz, HE80+80 channels
1888  * @HOST_REGDMN_MODE_11BEG_EHT20: 11be 2.4GHz, EHT20 channels
1889  * @HOST_REGDMN_MODE_11BEA_EHT20: 11be 5GHz, EHT20 channels
1890  * @HOST_REGDMN_MODE_11BEG_EHT40PLUS: 11be 2.4GHz, EHT40+ channels
1891  * @HOST_REGDMN_MODE_11BEG_EHT40MINUS: 11be 2.4GHz, EHT40- channels
1892  * @HOST_REGDMN_MODE_11BEA_EHT40PLUS: 11be 5GHz, EHT40+ channels
1893  * @HOST_REGDMN_MODE_11BEA_EHT40MINUS: 11be 5GHz, EHT40- channels
1894  * @HOST_REGDMN_MODE_11BEA_EHT80: 11be 5GHz, EHT80 channels
1895  * @HOST_REGDMN_MODE_11BEA_EHT160: 11be 5GHz, EHT160 channels
1896  * @HOST_REGDMN_MODE_11BEA_EHT320: 11be 5GHz, EHT320 channels
1897  */
1898 enum {
1899 	HOST_REGDMN_MODE_11A = 0x00000001,
1900 	HOST_REGDMN_MODE_TURBO = 0x00000002,
1901 	HOST_REGDMN_MODE_11B = 0x00000004,
1902 	HOST_REGDMN_MODE_PUREG = 0x00000008,
1903 	HOST_REGDMN_MODE_11G = 0x00000008,
1904 	HOST_REGDMN_MODE_108G = 0x00000020,
1905 	HOST_REGDMN_MODE_108A = 0x00000040,
1906 	HOST_REGDMN_MODE_11AC_VHT20_2G = 0x00000080,
1907 	HOST_REGDMN_MODE_XR = 0x00000100,
1908 	HOST_REGDMN_MODE_11A_HALF_RATE = 0x00000200,
1909 	HOST_REGDMN_MODE_11A_QUARTER_RATE = 0x00000400,
1910 	HOST_REGDMN_MODE_11NG_HT20 = 0x00000800,
1911 	HOST_REGDMN_MODE_11NA_HT20 = 0x00001000,
1912 	HOST_REGDMN_MODE_11NG_HT40PLUS = 0x00002000,
1913 	HOST_REGDMN_MODE_11NG_HT40MINUS = 0x00004000,
1914 	HOST_REGDMN_MODE_11NA_HT40PLUS = 0x00008000,
1915 	HOST_REGDMN_MODE_11NA_HT40MINUS = 0x00010000,
1916 	HOST_REGDMN_MODE_11AC_VHT20 = 0x00020000,
1917 	HOST_REGDMN_MODE_11AC_VHT40PLUS = 0x00040000,
1918 	HOST_REGDMN_MODE_11AC_VHT40MINUS = 0x00080000,
1919 	HOST_REGDMN_MODE_11AC_VHT80 = 0x00100000,
1920 	HOST_REGDMN_MODE_11AC_VHT160 = 0x00200000,
1921 	HOST_REGDMN_MODE_11AC_VHT80_80 = 0x00400000,
1922 	HOST_REGDMN_MODE_11AXG_HE20 = 0x00800000,
1923 	HOST_REGDMN_MODE_11AXA_HE20 = 0x01000000,
1924 	HOST_REGDMN_MODE_11AXG_HE40PLUS = 0x02000000,
1925 	HOST_REGDMN_MODE_11AXG_HE40MINUS = 0x04000000,
1926 	HOST_REGDMN_MODE_11AXA_HE40PLUS = 0x08000000,
1927 	HOST_REGDMN_MODE_11AXA_HE40MINUS = 0x10000000,
1928 	HOST_REGDMN_MODE_11AXA_HE80 = 0x20000000,
1929 	HOST_REGDMN_MODE_11AXA_HE160 = 0x40000000,
1930 	HOST_REGDMN_MODE_11AXA_HE80_80 = 0x80000000,
1931 #ifdef WLAN_FEATURE_11BE
1932 	HOST_REGDMN_MODE_11BEG_EHT20 = 0x0000000100000000,
1933 	HOST_REGDMN_MODE_11BEA_EHT20 = 0x0000000200000000,
1934 	HOST_REGDMN_MODE_11BEG_EHT40PLUS = 0x0000000400000000,
1935 	HOST_REGDMN_MODE_11BEG_EHT40MINUS = 0x0000000800000000,
1936 	HOST_REGDMN_MODE_11BEA_EHT40PLUS = 0x0000001000000000,
1937 	HOST_REGDMN_MODE_11BEA_EHT40MINUS = 0x0000002000000000,
1938 	HOST_REGDMN_MODE_11BEA_EHT80 = 0x0000004000000000,
1939 	HOST_REGDMN_MODE_11BEA_EHT160 = 0x0000008000000000,
1940 	HOST_REGDMN_MODE_11BEA_EHT320 = 0x0000010000000000,
1941 #endif
1942 	HOST_REGDMN_MODE_ALL = 0xffffffffffffffff
1943 };
1944 
1945 #define WIRELESS_11AX_MODES  (HOST_REGDMN_MODE_11AXG_HE20 \
1946 			      | HOST_REGDMN_MODE_11AXG_HE40PLUS \
1947 			      | HOST_REGDMN_MODE_11AXG_HE40MINUS \
1948 			      | HOST_REGDMN_MODE_11AXA_HE20 \
1949 			      | HOST_REGDMN_MODE_11AXA_HE40PLUS \
1950 			      | HOST_REGDMN_MODE_11AXA_HE40MINUS \
1951 			      | HOST_REGDMN_MODE_11AXA_HE80 \
1952 			      | HOST_REGDMN_MODE_11AXA_HE160 \
1953 			      | HOST_REGDMN_MODE_11AXA_HE80_80)
1954 
1955 #ifdef WLAN_FEATURE_11BE
1956 #define WIRELESS_11BE_MODES  (HOST_REGDMN_MODE_11BEG_EHT20 \
1957 			      | HOST_REGDMN_MODE_11BEA_EHT20 \
1958 			      | HOST_REGDMN_MODE_11BEG_EHT40PLUS \
1959 			      | HOST_REGDMN_MODE_11BEG_EHT40MINUS \
1960 			      | HOST_REGDMN_MODE_11BEA_EHT40PLUS \
1961 			      | HOST_REGDMN_MODE_11BEA_EHT40MINUS \
1962 			      | HOST_REGDMN_MODE_11BEA_EHT80 \
1963 			      | HOST_REGDMN_MODE_11BEA_EHT160 \
1964 			      | HOST_REGDMN_MODE_11BEA_EHT320)
1965 #endif
1966 
1967 #define WIRELESS_11AC_MODES  (HOST_REGDMN_MODE_11AC_VHT20 \
1968 			      | HOST_REGDMN_MODE_11AC_VHT40PLUS \
1969 			      | HOST_REGDMN_MODE_11AC_VHT40MINUS \
1970 			      | HOST_REGDMN_MODE_11AC_VHT80 \
1971 			      | HOST_REGDMN_MODE_11AC_VHT160 \
1972 			      | HOST_REGDMN_MODE_11AC_VHT80_80)
1973 
1974 #define WIRELESS_11N_MODES   (HOST_REGDMN_MODE_11NG_HT20 \
1975 			      | HOST_REGDMN_MODE_11NA_HT20 \
1976 			      | HOST_REGDMN_MODE_11NG_HT40PLUS \
1977 			      | HOST_REGDMN_MODE_11NG_HT40MINUS \
1978 			      | HOST_REGDMN_MODE_11NA_HT40PLUS \
1979 			      | HOST_REGDMN_MODE_11NA_HT40MINUS)
1980 
1981 #define WIRELESS_11G_MODES   (HOST_REGDMN_MODE_PUREG \
1982 			      | HOST_REGDMN_MODE_11G \
1983 			      | HOST_REGDMN_MODE_108G)
1984 
1985 #define WIRELESS_11B_MODES   (HOST_REGDMN_MODE_11B)
1986 
1987 #define WIRELESS_11A_MODES   (HOST_REGDMN_MODE_11A \
1988 			      | HOST_REGDMN_MODE_TURBO \
1989 			      | HOST_REGDMN_MODE_108A \
1990 			      | HOST_REGDMN_MODE_11A_HALF_RATE \
1991 			      | HOST_REGDMN_MODE_11A_QUARTER_RATE)
1992 
1993 #ifdef WLAN_FEATURE_11BE
1994 #define WIRELESS_20_MODES    (HOST_REGDMN_MODE_11A \
1995 			      | HOST_REGDMN_MODE_TURBO \
1996 			      | HOST_REGDMN_MODE_11B \
1997 			      | HOST_REGDMN_MODE_PUREG \
1998 			      | HOST_REGDMN_MODE_11G \
1999 			      | HOST_REGDMN_MODE_11AC_VHT20_2G \
2000 			      | HOST_REGDMN_MODE_11NG_HT20 \
2001 			      | HOST_REGDMN_MODE_11NA_HT20 \
2002 			      | HOST_REGDMN_MODE_11AC_VHT20 \
2003 			      | HOST_REGDMN_MODE_11AXG_HE20 \
2004 			      | HOST_REGDMN_MODE_11AXA_HE20 \
2005 			      | HOST_REGDMN_MODE_11BEA_EHT20 \
2006 			      | HOST_REGDMN_MODE_11BEG_EHT20)
2007 #else
2008 #define WIRELESS_20_MODES    (HOST_REGDMN_MODE_11A \
2009 			      | HOST_REGDMN_MODE_TURBO \
2010 			      | HOST_REGDMN_MODE_11B \
2011 			      | HOST_REGDMN_MODE_PUREG \
2012 			      | HOST_REGDMN_MODE_11G \
2013 			      | HOST_REGDMN_MODE_11AC_VHT20_2G \
2014 			      | HOST_REGDMN_MODE_11NG_HT20 \
2015 			      | HOST_REGDMN_MODE_11NA_HT20 \
2016 			      | HOST_REGDMN_MODE_11AC_VHT20 \
2017 			      | HOST_REGDMN_MODE_11AXG_HE20 \
2018 			      | HOST_REGDMN_MODE_11AXA_HE20)
2019 #endif
2020 
2021 #define WIRELESS_10_MODES   (HOST_REGDMN_MODE_11A_HALF_RATE)
2022 #define WIRELESS_5_MODES    (HOST_REGDMN_MODE_11A_QUARTER_RATE)
2023 
2024 #ifdef WLAN_FEATURE_11BE
2025 #define WIRELESS_40_MODES    (HOST_REGDMN_MODE_11NG_HT40PLUS \
2026 			      | HOST_REGDMN_MODE_11NG_HT40MINUS \
2027 			      | HOST_REGDMN_MODE_11NA_HT40PLUS \
2028 			      | HOST_REGDMN_MODE_11NA_HT40MINUS \
2029 			      | HOST_REGDMN_MODE_11AC_VHT40PLUS \
2030 			      | HOST_REGDMN_MODE_11AC_VHT40MINUS \
2031 			      | HOST_REGDMN_MODE_11AXG_HE40PLUS \
2032 			      | HOST_REGDMN_MODE_11AXG_HE40MINUS \
2033 			      | HOST_REGDMN_MODE_11AXA_HE40PLUS \
2034 			      | HOST_REGDMN_MODE_11AXA_HE40MINUS \
2035 			      | HOST_REGDMN_MODE_11BEA_EHT40PLUS \
2036 			      | HOST_REGDMN_MODE_11BEA_EHT40MINUS \
2037 			      | HOST_REGDMN_MODE_11BEG_EHT40PLUS \
2038 			      | HOST_REGDMN_MODE_11BEG_EHT40MINUS)
2039 #else
2040 #define WIRELESS_40_MODES    (HOST_REGDMN_MODE_11NG_HT40PLUS \
2041 			      | HOST_REGDMN_MODE_11NG_HT40MINUS \
2042 			      | HOST_REGDMN_MODE_11NA_HT40PLUS \
2043 			      | HOST_REGDMN_MODE_11NA_HT40MINUS \
2044 			      | HOST_REGDMN_MODE_11AC_VHT40PLUS \
2045 			      | HOST_REGDMN_MODE_11AC_VHT40MINUS \
2046 			      | HOST_REGDMN_MODE_11AXG_HE40PLUS \
2047 			      | HOST_REGDMN_MODE_11AXG_HE40MINUS \
2048 			      | HOST_REGDMN_MODE_11AXA_HE40PLUS \
2049 			      | HOST_REGDMN_MODE_11AXA_HE40MINUS)
2050 #endif
2051 
2052 #ifdef WLAN_FEATURE_11BE
2053 #define WIRELESS_80_MODES    (HOST_REGDMN_MODE_11AC_VHT80 \
2054 			      | HOST_REGDMN_MODE_11AXA_HE80 \
2055 			      | HOST_REGDMN_MODE_11BEA_EHT80)
2056 #else
2057 #define WIRELESS_80_MODES    (HOST_REGDMN_MODE_11AC_VHT80 \
2058 			      | HOST_REGDMN_MODE_11AXA_HE80)
2059 #endif
2060 
2061 #ifdef WLAN_FEATURE_11BE
2062 #define WIRELESS_160_MODES   (HOST_REGDMN_MODE_11AC_VHT160 \
2063 			      | HOST_REGDMN_MODE_11AXA_HE160 \
2064 			      | HOST_REGDMN_MODE_11BEA_EHT160)
2065 #else
2066 #define WIRELESS_160_MODES   (HOST_REGDMN_MODE_11AC_VHT160 \
2067 			      | HOST_REGDMN_MODE_11AXA_HE160)
2068 #endif
2069 
2070 #define WIRELESS_80P80_MODES (HOST_REGDMN_MODE_11AC_VHT80_80 \
2071 			      | HOST_REGDMN_MODE_11AXA_HE80_80)
2072 
2073 #ifdef WLAN_FEATURE_11BE
2074 #define WIRELESS_320_MODES (HOST_REGDMN_MODE_11BEA_EHT320)
2075 #endif
2076 
2077 #ifdef WLAN_FEATURE_11BE
2078 #define WIRELESS_6G_MODES_11BE (HOST_REGDMN_MODE_11BEA_EHT20 \
2079 				| HOST_REGDMN_MODE_11BEA_EHT40PLUS \
2080 				| HOST_REGDMN_MODE_11BEA_EHT40MINUS \
2081 				| HOST_REGDMN_MODE_11BEA_EHT80 \
2082 				| HOST_REGDMN_MODE_11BEA_EHT160 \
2083 				| HOST_REGDMN_MODE_11BEA_EHT320)
2084 #else
2085 #define WIRELESS_6G_MODES_11BE 0
2086 #endif /* WLAN_FEATURE_11BE*/
2087 
2088 #ifdef WLAN_FEATURE_11BE
2089 #define WIRELESS_6G_MODES (HOST_REGDMN_MODE_11AXA_HE20 \
2090 			   | HOST_REGDMN_MODE_11AXA_HE40PLUS \
2091 			   | HOST_REGDMN_MODE_11AXA_HE40MINUS \
2092 			   | HOST_REGDMN_MODE_11AXA_HE80 \
2093 			   | HOST_REGDMN_MODE_11AXA_HE160 \
2094 			   | HOST_REGDMN_MODE_11AXA_HE80_80 \
2095 			   | HOST_REGDMN_MODE_11BEA_EHT20 \
2096 			   | HOST_REGDMN_MODE_11BEA_EHT40PLUS \
2097 			   | HOST_REGDMN_MODE_11BEA_EHT40MINUS \
2098 			   | HOST_REGDMN_MODE_11BEA_EHT80 \
2099 			   | HOST_REGDMN_MODE_11BEA_EHT160 \
2100 			   | HOST_REGDMN_MODE_11BEA_EHT320)
2101 #else
2102 #define WIRELESS_6G_MODES (HOST_REGDMN_MODE_11AXA_HE20 \
2103 			   | HOST_REGDMN_MODE_11AXA_HE40PLUS \
2104 			   | HOST_REGDMN_MODE_11AXA_HE40MINUS \
2105 			   | HOST_REGDMN_MODE_11AXA_HE80 \
2106 			   | HOST_REGDMN_MODE_11AXA_HE160 \
2107 			   | HOST_REGDMN_MODE_11AXA_HE80_80)
2108 #endif
2109 
2110 #ifdef WLAN_FEATURE_11BE
2111 #define WIRELESS_5G_MODES_11BE (HOST_REGDMN_MODE_11BEA_EHT20 \
2112 				| HOST_REGDMN_MODE_11BEA_EHT40PLUS \
2113 				| HOST_REGDMN_MODE_11BEA_EHT40MINUS \
2114 				| HOST_REGDMN_MODE_11BEA_EHT80 \
2115 				| HOST_REGDMN_MODE_11BEA_EHT160 \
2116 				| HOST_REGDMN_MODE_11BEA_EHT320)
2117 #else
2118 #define WIRELESS_5G_MODES_11BE 0
2119 #endif /* WLAN_FEATURE_11BE*/
2120 
2121 #ifdef WLAN_FEATURE_11BE
2122 #define WIRELESS_5G_MODES (HOST_REGDMN_MODE_11BEA_EHT20 \
2123 			   | HOST_REGDMN_MODE_11BEA_EHT40PLUS \
2124 			   | HOST_REGDMN_MODE_11BEA_EHT40MINUS \
2125 			   | HOST_REGDMN_MODE_11BEA_EHT80 \
2126 			   | HOST_REGDMN_MODE_11BEA_EHT160 \
2127 			   | HOST_REGDMN_MODE_11BEA_EHT320 \
2128 			   | HOST_REGDMN_MODE_11AXA_HE20 \
2129 			   | HOST_REGDMN_MODE_11AXA_HE40PLUS \
2130 			   | HOST_REGDMN_MODE_11AXA_HE40MINUS \
2131 			   | HOST_REGDMN_MODE_11AXA_HE80 \
2132 			   | HOST_REGDMN_MODE_11AXA_HE160 \
2133 			   | HOST_REGDMN_MODE_11AXA_HE80_80 \
2134 			   | HOST_REGDMN_MODE_11AC_VHT20 \
2135 			   | HOST_REGDMN_MODE_11AC_VHT40PLUS \
2136 			   | HOST_REGDMN_MODE_11AC_VHT40MINUS \
2137 			   | HOST_REGDMN_MODE_11AC_VHT80 \
2138 			   | HOST_REGDMN_MODE_11AC_VHT160 \
2139 			   | HOST_REGDMN_MODE_11AC_VHT80_80 \
2140 			   | HOST_REGDMN_MODE_11NA_HT20 \
2141 			   | HOST_REGDMN_MODE_11NA_HT40PLUS \
2142 			   | HOST_REGDMN_MODE_11NA_HT40MINUS \
2143 			   | HOST_REGDMN_MODE_11A \
2144 			   | HOST_REGDMN_MODE_TURBO \
2145 			   | HOST_REGDMN_MODE_108A \
2146 			   | HOST_REGDMN_MODE_11A_HALF_RATE \
2147 			   | HOST_REGDMN_MODE_11A_QUARTER_RATE)
2148 #else
2149 #define WIRELESS_5G_MODES (HOST_REGDMN_MODE_11AXA_HE20 \
2150 			   | HOST_REGDMN_MODE_11AXA_HE40PLUS \
2151 			   | HOST_REGDMN_MODE_11AXA_HE40MINUS \
2152 			   | HOST_REGDMN_MODE_11AXA_HE80 \
2153 			   | HOST_REGDMN_MODE_11AXA_HE160 \
2154 			   | HOST_REGDMN_MODE_11AXA_HE80_80 \
2155 			   | HOST_REGDMN_MODE_11AC_VHT20 \
2156 			   | HOST_REGDMN_MODE_11AC_VHT40PLUS \
2157 			   | HOST_REGDMN_MODE_11AC_VHT40MINUS \
2158 			   | HOST_REGDMN_MODE_11AC_VHT80 \
2159 			   | HOST_REGDMN_MODE_11AC_VHT160 \
2160 			   | HOST_REGDMN_MODE_11AC_VHT80_80 \
2161 			   | HOST_REGDMN_MODE_11NA_HT20 \
2162 			   | HOST_REGDMN_MODE_11NA_HT40PLUS \
2163 			   | HOST_REGDMN_MODE_11NA_HT40MINUS \
2164 			   | HOST_REGDMN_MODE_11A \
2165 			   | HOST_REGDMN_MODE_TURBO \
2166 			   | HOST_REGDMN_MODE_108A \
2167 			   | HOST_REGDMN_MODE_11A_HALF_RATE \
2168 			   | HOST_REGDMN_MODE_11A_QUARTER_RATE)
2169 #endif
2170 
2171 #define WIRELESS_49G_MODES (HOST_REGDMN_MODE_11A \
2172 			    | HOST_REGDMN_MODE_11A_HALF_RATE \
2173 			    | HOST_REGDMN_MODE_11A_QUARTER_RATE)
2174 #ifdef WLAN_FEATURE_11BE
2175 #define WIRELESS_2G_MODES_11BE (HOST_REGDMN_MODE_11BEG_EHT20 \
2176 				| HOST_REGDMN_MODE_11BEG_EHT40PLUS \
2177 				| HOST_REGDMN_MODE_11BEG_EHT40MINUS)
2178 #else
2179 #define WIRELESS_2G_MODES_11BE 0
2180 #endif /* WLAN_FEATURE_11BE*/
2181 
2182 #ifdef WLAN_FEATURE_11BE
2183 #define WIRELESS_2G_MODES (HOST_REGDMN_MODE_11BEG_EHT20 \
2184 			   | HOST_REGDMN_MODE_11BEG_EHT40PLUS \
2185 			   | HOST_REGDMN_MODE_11BEG_EHT40MINUS \
2186 			   | HOST_REGDMN_MODE_11AXG_HE20 \
2187 			   | HOST_REGDMN_MODE_11AXG_HE40PLUS \
2188 			   | HOST_REGDMN_MODE_11AXG_HE40MINUS \
2189 			   | HOST_REGDMN_MODE_11NG_HT20 \
2190 			   | HOST_REGDMN_MODE_11NG_HT40PLUS \
2191 			   | HOST_REGDMN_MODE_11NG_HT40MINUS \
2192 			   | HOST_REGDMN_MODE_PUREG \
2193 			   | HOST_REGDMN_MODE_11G \
2194 			   | HOST_REGDMN_MODE_108G \
2195 			   | HOST_REGDMN_MODE_11B)
2196 #else
2197 #define WIRELESS_2G_MODES (HOST_REGDMN_MODE_11AXG_HE20 \
2198 			   | HOST_REGDMN_MODE_11AXG_HE40PLUS \
2199 			   | HOST_REGDMN_MODE_11AXG_HE40MINUS \
2200 			   | HOST_REGDMN_MODE_11NG_HT20 \
2201 			   | HOST_REGDMN_MODE_11NG_HT40PLUS \
2202 			   | HOST_REGDMN_MODE_11NG_HT40MINUS \
2203 			   | HOST_REGDMN_MODE_PUREG \
2204 			   | HOST_REGDMN_MODE_11G \
2205 			   | HOST_REGDMN_MODE_108G \
2206 			   | HOST_REGDMN_MODE_11B)
2207 #endif
2208 
2209 #ifdef CONFIG_AFC_SUPPORT
2210 /* enum reg_afc_cmd_type - Type of AFC command sent to FW
2211  * @REG_AFC_CMD_SERV_RESP_READY : Server response is ready
2212  * @REG_AFC_CMD_RESET_AFC: Indicate the target to reset AFC
2213  */
2214 enum reg_afc_cmd_type {
2215 	REG_AFC_CMD_SERV_RESP_READY = 1,
2216 	REG_AFC_CMD_RESET_AFC = 2,
2217 };
2218 
2219 /* enum reg_afc_serv_resp_format - Indicate the format in which afc_serv_format
2220  * is written in FW memory
2221  * @REG_AFC_SERV_RESP_FORMAT_JSON - Server response in JSON format
2222  * @REG_AFC_SERV_RESP_FORMAT_BINARY - Server response in BINARY format
2223  */
2224 enum reg_afc_serv_resp_format {
2225 	REG_AFC_SERV_RESP_FORMAT_JSON = 0,
2226 	REG_AFC_SERV_RESP_FORMAT_BINARY = 1,
2227 };
2228 
2229 /**
2230  * struct reg_afc_resp_rx_ind_info - regulatory AFC indication info
2231  * @cmd_type: Type of AFC command send to FW
2232  * @serv_resp_format: AFC server response format
2233  */
2234 struct reg_afc_resp_rx_ind_info {
2235 	enum reg_afc_cmd_type cmd_type;
2236 	enum reg_afc_serv_resp_format serv_resp_format;
2237 };
2238 
2239 /**
2240  * afc_req_rx_evt_handler() - Function prototype of AFC request received event
2241  * handler
2242  * @pdev: Pointer to pdev
2243  * @afc_par_req: Pointer to AFC partial request
2244  * @arg: Pointer to void (opaque) argument object
2245  *
2246  * Return: void
2247  */
2248 typedef void (*afc_req_rx_evt_handler)(struct wlan_objmgr_pdev *pdev,
2249 				       struct wlan_afc_host_partial_request *afc_par_req,
2250 				       void *arg);
2251 
2252 /**
2253  * afc_power_tx_evt_handler() - Function prototype of AFC power event sent
2254  * handler
2255  * @pdev: Pointer to pdev
2256  * @power_info: Pointer to AFC power event data
2257  * @arg: Pointer to void (opaque) argument object
2258  *
2259  * Return: void
2260  */
2261 typedef void
2262 (*afc_power_tx_evt_handler)(struct wlan_objmgr_pdev *pdev,
2263 			    struct reg_fw_afc_power_event *power_info,
2264 			    void *arg);
2265 #endif
2266 
2267 /**
2268  * reg_is_chan_enum_invalid() - Checks if the channel enum is invalid or not.
2269  * @chan_enum: Input channel enum.
2270  *
2271  * Return: true if channel enum is invalid else false.
2272  */
2273 static inline bool reg_is_chan_enum_invalid(enum channel_enum chan_enum)
2274 {
2275 	return chan_enum >= INVALID_CHANNEL;
2276 }
2277 #endif
2278