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