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