xref: /wlan-dirver/qca-wifi-host-cmn/umac/regulatory/dispatcher/inc/reg_services_public_struct.h (revision bea437e2293c3d4fb1b5704fcf633aedac996962)
1 /*
2  * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19  /**
20  * DOC: reg_services_public_struct.h
21  * This file contains regulatory data structures
22  */
23 
24 #ifndef __REG_SERVICES_PUBLIC_STRUCT_H_
25 #define __REG_SERVICES_PUBLIC_STRUCT_H_
26 
27 #define REG_SBS_SEPARATION_THRESHOLD 100
28 
29 #ifdef CONFIG_BAND_6GHZ
30 #define REG_MAX_CHANNELS_PER_OPERATING_CLASS  70
31 #else
32 #define REG_MAX_CHANNELS_PER_OPERATING_CLASS  25
33 #endif
34 
35 #define REG_MAX_SUPP_OPER_CLASSES 32
36 #define REG_MAX_CHAN_CHANGE_CBKS 30
37 #define MAX_STA_VDEV_CNT 4
38 #define INVALID_VDEV_ID 0xFF
39 #define INVALID_CHANNEL_NUM 0x0
40 #define CH_AVOID_MAX_RANGE   4
41 #define REG_ALPHA2_LEN 2
42 #define MAX_REG_RULES 10
43 
44 #define REGULATORY_CHAN_DISABLED     BIT(0)
45 #define REGULATORY_CHAN_NO_IR        BIT(1)
46 #define REGULATORY_CHAN_RADAR        BIT(3)
47 #define REGULATORY_CHAN_NO_OFDM      BIT(6)
48 #define REGULATORY_CHAN_INDOOR_ONLY  BIT(9)
49 #define REGULATORY_CHAN_AFC          BIT(13)
50 
51 #define REGULATORY_CHAN_NO_HT40      BIT(4)
52 #define REGULATORY_CHAN_NO_80MHZ     BIT(7)
53 #define REGULATORY_CHAN_NO_160MHZ    BIT(8)
54 #define REGULATORY_CHAN_NO_20MHZ     BIT(11)
55 #define REGULATORY_CHAN_NO_10MHZ     BIT(12)
56 
57 #define REGULATORY_PHYMODE_NO11A     BIT(0)
58 #define REGULATORY_PHYMODE_NO11B     BIT(1)
59 #define REGULATORY_PHYMODE_NO11G     BIT(2)
60 #define REGULATORY_CHAN_NO11N        BIT(3)
61 #define REGULATORY_PHYMODE_NO11AC    BIT(4)
62 #define REGULATORY_PHYMODE_NO11AX    BIT(5)
63 
64 /**
65  * enum dfs_reg - DFS region
66  * @DFS_UNINIT_REGION: un-initialized region
67  * @DFS_FCC_REGION: FCC region
68  * @DFS_ETSI_REGION: ETSI region
69  * @DFS_MKK_REGION: MKK region
70  * @DFS_CN_REGION: China region
71  * @DFS_KR_REGION: Korea region
72  * @DFS_MKK_REGION: MKKN region
73  * that supports updated W53 RADAR pattern
74  * detection.
75  * @DFS_UNDEF_REGION: Undefined region
76  */
77 
78 enum dfs_reg {
79 	DFS_UNINIT_REGION = 0,
80 	DFS_FCC_REGION = 1,
81 	DFS_ETSI_REGION = 2,
82 	DFS_MKK_REGION = 3,
83 	DFS_CN_REGION = 4,
84 	DFS_KR_REGION = 5,
85 	DFS_MKKN_REGION = 6,
86 	DFS_UNDEF_REGION = 0xFFFF,
87 };
88 
89 /** enum op_class_table_num
90  * OP_CLASS_US- Class corresponds to US
91  * OP_CLASS_EU- Class corresponds to EU
92  * OP_CLASS_JAPAN- Class corresponds to JAPAN
93  * OP_CLASS_GLOBAL- Class corresponds to GLOBAL
94  */
95 enum op_class_table_num {
96 	OP_CLASS_US = 1,
97 	OP_CLASS_EU,
98 	OP_CLASS_JAPAN,
99 	OP_CLASS_GLOBAL
100 };
101 
102 /**
103  * enum channel_enum - channel enumeration
104  * @CHAN_ENUM_2412: channel with freq 2412
105  * @CHAN_ENUM_2417: channel with freq 2417
106  * @CHAN_ENUM_2422: channel with freq 2422
107  * @CHAN_ENUM_2427: channel with freq 2427
108  * @CHAN_ENUM_2432: channel with freq 2432
109  * @CHAN_ENUM_2437: channel with freq 2437
110  * @CHAN_ENUM_2442: channel with freq 2442
111  * @CHAN_ENUM_2447: channel with freq 2447
112  * @CHAN_ENUM_2452: channel with freq 2452
113  * @CHAN_ENUM_2457: channel with freq 2457
114  * @CHAN_ENUM_2462: channel with freq 2462
115  * @CHAN_ENUM_2467: channel with freq 2467
116  * @CHAN_ENUM_2472: channel with freq 2472
117  * @CHAN_ENUM_2484: channel with freq 2484
118  * @CHAN_ENUM_4912: channel with freq 4912
119  * @CHAN_ENUM_4915: channel with freq 4915
120  * @CHAN_ENUM_4917: channel with freq 4917
121  * @CHAN_ENUM_4920: channel with freq 4920
122  * @CHAN_ENUM_4922: channel with freq 4922
123  * @CHAN_ENUM_4925: channel with freq 4925
124  * @CHAN_ENUM_4927: channel with freq 4927
125  * @CHAN_ENUM_4932: channel with freq 4932
126  * @CHAN_ENUM_4935: channel with freq 4935
127  * @CHAN_ENUM_4937: channel with freq 4937
128  * @CHAN_ENUM_4940: channel with freq 4940
129  * @CHAN_ENUM_4942: channel with freq 4942
130  * @CHAN_ENUM_4945: channel with freq 4945
131  * @CHAN_ENUM_4947: channel with freq 4947
132  * @CHAN_ENUM_4950: channel with freq 4950
133  * @CHAN_ENUM_4952: channel with freq 4952
134  * @CHAN_ENUM_4955: channel with freq 4955
135  * @CHAN_ENUM_4957: channel with freq 4957
136  * @CHAN_ENUM_4960: channel with freq 4960
137  * @CHAN_ENUM_4962: channel with freq 4962
138  * @CHAN_ENUM_4965: channel with freq 4965
139  * @CHAN_ENUM_4967: channel with freq 4967
140  * @CHAN_ENUM_4970: channel with freq 4970
141  * @CHAN_ENUM_4972: channel with freq 4972
142  * @CHAN_ENUM_4975: channel with freq 4975
143  * @CHAN_ENUM_4977: channel with freq 4977
144  * @CHAN_ENUM_4980: channel with freq 4980
145  * @CHAN_ENUM_4982: channel with freq 4982
146  * @CHAN_ENUM_4985: channel with freq 4985
147  * @CHAN_ENUM_4987: channel with freq 4987
148  * @CHAN_ENUM_5032: channel with freq 5032
149  * @CHAN_ENUM_5035: channel with freq 5035
150  * @CHAN_ENUM_5037: channel with freq 5037
151  * @CHAN_ENUM_5040: channel with freq 5040
152  * @CHAN_ENUM_5042: channel with freq 5042
153  * @CHAN_ENUM_5045: channel with freq 5045
154  * @CHAN_ENUM_5047: channel with freq 5047
155  * @CHAN_ENUM_5052: channel with freq 5052
156  * @CHAN_ENUM_5055: channel with freq 5055
157  * @CHAN_ENUM_5057: channel with freq 5057
158  * @CHAN_ENUM_5060: channel with freq 5060
159  * @CHAN_ENUM_5080: channel with freq 5080
160  * @CHAN_ENUM_5180: channel with freq 5180
161  * @CHAN_ENUM_5200: channel with freq 5200
162  * @CHAN_ENUM_5220: channel with freq 5220
163  * @CHAN_ENUM_5240: channel with freq 5240
164  * @CHAN_ENUM_5260: channel with freq 5260
165  * @CHAN_ENUM_5280: channel with freq 5280
166  * @CHAN_ENUM_5300: channel with freq 5300
167  * @CHAN_ENUM_5320: channel with freq 5320
168  * @CHAN_ENUM_5500: channel with freq 5500
169  * @CHAN_ENUM_5520: channel with freq 5520
170  * @CHAN_ENUM_5540: channel with freq 5540
171  * @CHAN_ENUM_5560: channel with freq 5560
172  * @CHAN_ENUM_5580: channel with freq 5580
173  * @CHAN_ENUM_5600: channel with freq 5600
174  * @CHAN_ENUM_5620: channel with freq 5620
175  * @CHAN_ENUM_5640: channel with freq 5640
176  * @CHAN_ENUM_5660: channel with freq 5660
177  * @CHAN_ENUM_5680: channel with freq 5680
178  * @CHAN_ENUM_5700: channel with freq 5700
179  * @CHAN_ENUM_5720: channel with freq 5720
180  * @CHAN_ENUM_5745: channel with freq 5745
181  * @CHAN_ENUM_5765: channel with freq 5765
182  * @CHAN_ENUM_5785: channel with freq 5785
183  * @CHAN_ENUM_5805: channel with freq 5805
184  * @CHAN_ENUM_5825: channel with freq 5825
185  * @CHAN_ENUM_5845: channel with freq 5845
186  * @CHAN_ENUM_5850: channel with freq 5850
187  * @CHAN_ENUM_5855: channel with freq 5855
188  * @CHAN_ENUM_5860: channel with freq 5860
189  * @CHAN_ENUM_5865: channel with freq 5865
190  * @CHAN_ENUM_5870: channel with freq 5870
191  * @CHAN_ENUM_5875: channel with freq 5875
192  * @CHAN_ENUM_5880: channel with freq 5880
193  * @CHAN_ENUM_5885: channel with freq 5885
194  * @CHAN_ENUM_5890: channel with freq 5890
195  * @CHAN_ENUM_5895: channel with freq 5895
196  * @CHAN_ENUM_5900: channel with freq 5900
197  * @CHAN_ENUM_5905: channel with freq 5905
198  * @CHAN_ENUM_5910: channel with freq 5910
199  * @CHAN_ENUM_5915: channel with freq 5915
200  * @CHAN_ENUM_5920: channel with freq 5920
201  * @CHAN_ENUM_5945: channel with freq 5945
202  * @CHAN_ENUM_5965: channel with freq 5965
203  * @CHAN_ENUM_5985: channel with freq 5985
204  * @CHAN_ENUM_6005: channel with freq 6005
205  * @CHAN_ENUM_6025: channel with freq 6025
206  * @CHAN_ENUM_6045: channel with freq 6045
207  * @CHAN_ENUM_6065: channel with freq 6065
208  * @CHAN_ENUM_6085: channel with freq 6085
209  * @CHAN_ENUM_6105: channel with freq 6105
210  * @CHAN_ENUM_6125: channel with freq 6125
211  * @CHAN_ENUM_6145: channel with freq 6145
212  * @CHAN_ENUM_6165: channel with freq 6165
213  * @CHAN_ENUM_6185: channel with freq 6185
214  * @CHAN_ENUM_6205: channel with freq 6205
215  * @CHAN_ENUM_6225: channel with freq 6225
216  * @CHAN_ENUM_6245: channel with freq 6245
217  * @CHAN_ENUM_6265: channel with freq 6265
218  * @CHAN_ENUM_6285: channel with freq 6285
219  * @CHAN_ENUM_6305: channel with freq 6305
220  * @CHAN_ENUM_6325: channel with freq 6325
221  * @CHAN_ENUM_6345: channel with freq 6345
222  * @CHAN_ENUM_6365: channel with freq 6365
223  * @CHAN_ENUM_6385: channel with freq 6385
224  * @CHAN_ENUM_6405: channel with freq 6405
225  * @CHAN_ENUM_6425: channel with freq 6425
226  * @CHAN_ENUM_6445: channel with freq 6445
227  * @CHAN_ENUM_6465: channel with freq 6465
228  * @CHAN_ENUM_6485: channel with freq 6485
229  * @CHAN_ENUM_6505: channel with freq 6505
230  * @CHAN_ENUM_6525: channel with freq 6525
231  * @CHAN_ENUM_6545: channel with freq 6545
232  * @CHAN_ENUM_6565: channel with freq 6565
233  * @CHAN_ENUM_6585: channel with freq 6585
234  * @CHAN_ENUM_6605: channel with freq 6605
235  * @CHAN_ENUM_6625: channel with freq 6625
236  * @CHAN_ENUM_6645: channel with freq 6645
237  * @CHAN_ENUM_6665: channel with freq 6665
238  * @CHAN_ENUM_6685: channel with freq 6685
239  * @CHAN_ENUM_6705: channel with freq 6705
240  * @CHAN_ENUM_6725: channel with freq 6725
241  * @CHAN_ENUM_6745: channel with freq 6745
242  * @CHAN_ENUM_6765: channel with freq 6765
243  * @CHAN_ENUM_6785: channel with freq 6785
244  * @CHAN_ENUM_6805: channel with freq 6805
245  * @CHAN_ENUM_6825: channel with freq 6825
246  * @CHAN_ENUM_6845: channel with freq 6845
247  * @CHAN_ENUM_6865: channel with freq 6865
248  * @CHAN_ENUM_6885: channel with freq 6885
249  * @CHAN_ENUM_6905: channel with freq 6905
250  * @CHAN_ENUM_6925: channel with freq 6925
251  * @CHAN_ENUM_6945: channel with freq 6945
252  * @CHAN_ENUM_6965: channel with freq 6965
253  * @CHAN_ENUM_6985: channel with freq 6985
254  * @CHAN_ENUM_7005: channel with freq 7005
255  * @CHAN_ENUM_7025: channel with freq 7025
256  * @CHAN_ENUM_7045: channel with freq 7045
257  * @CHAN_ENUM_7065: channel with freq 7065
258  * @CHAN_ENUM_7085: channel with freq 7085
259  * @CHAN_ENUM_7105: channel with freq 7105
260  */
261 enum channel_enum {
262 	CHAN_ENUM_2412,
263 	CHAN_ENUM_2417,
264 	CHAN_ENUM_2422,
265 	CHAN_ENUM_2427,
266 	CHAN_ENUM_2432,
267 	CHAN_ENUM_2437,
268 	CHAN_ENUM_2442,
269 	CHAN_ENUM_2447,
270 	CHAN_ENUM_2452,
271 	CHAN_ENUM_2457,
272 	CHAN_ENUM_2462,
273 	CHAN_ENUM_2467,
274 	CHAN_ENUM_2472,
275 	CHAN_ENUM_2484,
276 
277 	CHAN_ENUM_4912,
278 	CHAN_ENUM_4915,
279 	CHAN_ENUM_4917,
280 	CHAN_ENUM_4920,
281 	CHAN_ENUM_4922,
282 	CHAN_ENUM_4925,
283 	CHAN_ENUM_4927,
284 	CHAN_ENUM_4932,
285 	CHAN_ENUM_4935,
286 	CHAN_ENUM_4937,
287 	CHAN_ENUM_4940,
288 	CHAN_ENUM_4942,
289 	CHAN_ENUM_4945,
290 	CHAN_ENUM_4947,
291 	CHAN_ENUM_4950,
292 	CHAN_ENUM_4952,
293 	CHAN_ENUM_4955,
294 	CHAN_ENUM_4957,
295 	CHAN_ENUM_4960,
296 	CHAN_ENUM_4962,
297 	CHAN_ENUM_4965,
298 	CHAN_ENUM_4967,
299 	CHAN_ENUM_4970,
300 	CHAN_ENUM_4972,
301 	CHAN_ENUM_4975,
302 	CHAN_ENUM_4977,
303 	CHAN_ENUM_4980,
304 	CHAN_ENUM_4982,
305 	CHAN_ENUM_4985,
306 	CHAN_ENUM_4987,
307 	CHAN_ENUM_5032,
308 	CHAN_ENUM_5035,
309 	CHAN_ENUM_5037,
310 	CHAN_ENUM_5040,
311 	CHAN_ENUM_5042,
312 	CHAN_ENUM_5045,
313 	CHAN_ENUM_5047,
314 	CHAN_ENUM_5052,
315 	CHAN_ENUM_5055,
316 	CHAN_ENUM_5057,
317 	CHAN_ENUM_5060,
318 	CHAN_ENUM_5080,
319 
320 	CHAN_ENUM_5180,
321 	CHAN_ENUM_5200,
322 	CHAN_ENUM_5220,
323 	CHAN_ENUM_5240,
324 	CHAN_ENUM_5260,
325 	CHAN_ENUM_5280,
326 	CHAN_ENUM_5300,
327 	CHAN_ENUM_5320,
328 	CHAN_ENUM_5500,
329 	CHAN_ENUM_5520,
330 	CHAN_ENUM_5540,
331 	CHAN_ENUM_5560,
332 	CHAN_ENUM_5580,
333 	CHAN_ENUM_5600,
334 	CHAN_ENUM_5620,
335 	CHAN_ENUM_5640,
336 	CHAN_ENUM_5660,
337 	CHAN_ENUM_5680,
338 	CHAN_ENUM_5700,
339 	CHAN_ENUM_5720,
340 	CHAN_ENUM_5745,
341 	CHAN_ENUM_5765,
342 	CHAN_ENUM_5785,
343 	CHAN_ENUM_5805,
344 	CHAN_ENUM_5825,
345 	CHAN_ENUM_5845,
346 
347 	CHAN_ENUM_5850,
348 	CHAN_ENUM_5855,
349 	CHAN_ENUM_5860,
350 	CHAN_ENUM_5865,
351 	CHAN_ENUM_5870,
352 	CHAN_ENUM_5875,
353 	CHAN_ENUM_5880,
354 	CHAN_ENUM_5885,
355 	CHAN_ENUM_5890,
356 	CHAN_ENUM_5895,
357 	CHAN_ENUM_5900,
358 	CHAN_ENUM_5905,
359 	CHAN_ENUM_5910,
360 	CHAN_ENUM_5915,
361 	CHAN_ENUM_5920,
362 #ifdef CONFIG_BAND_6GHZ
363 	CHAN_ENUM_5945,
364 	CHAN_ENUM_5965,
365 	CHAN_ENUM_5985,
366 	CHAN_ENUM_6005,
367 	CHAN_ENUM_6025,
368 	CHAN_ENUM_6045,
369 	CHAN_ENUM_6065,
370 	CHAN_ENUM_6085,
371 	CHAN_ENUM_6105,
372 	CHAN_ENUM_6125,
373 	CHAN_ENUM_6145,
374 	CHAN_ENUM_6165,
375 	CHAN_ENUM_6185,
376 	CHAN_ENUM_6205,
377 	CHAN_ENUM_6225,
378 	CHAN_ENUM_6245,
379 	CHAN_ENUM_6265,
380 	CHAN_ENUM_6285,
381 	CHAN_ENUM_6305,
382 	CHAN_ENUM_6325,
383 	CHAN_ENUM_6345,
384 	CHAN_ENUM_6365,
385 	CHAN_ENUM_6385,
386 	CHAN_ENUM_6405,
387 	CHAN_ENUM_6425,
388 	CHAN_ENUM_6445,
389 	CHAN_ENUM_6465,
390 	CHAN_ENUM_6485,
391 	CHAN_ENUM_6505,
392 	CHAN_ENUM_6525,
393 	CHAN_ENUM_6545,
394 	CHAN_ENUM_6565,
395 	CHAN_ENUM_6585,
396 	CHAN_ENUM_6605,
397 	CHAN_ENUM_6625,
398 	CHAN_ENUM_6645,
399 	CHAN_ENUM_6665,
400 	CHAN_ENUM_6685,
401 	CHAN_ENUM_6705,
402 	CHAN_ENUM_6725,
403 	CHAN_ENUM_6745,
404 	CHAN_ENUM_6765,
405 	CHAN_ENUM_6785,
406 	CHAN_ENUM_6805,
407 	CHAN_ENUM_6825,
408 	CHAN_ENUM_6845,
409 	CHAN_ENUM_6865,
410 	CHAN_ENUM_6885,
411 	CHAN_ENUM_6905,
412 	CHAN_ENUM_6925,
413 	CHAN_ENUM_6945,
414 	CHAN_ENUM_6965,
415 	CHAN_ENUM_6985,
416 	CHAN_ENUM_7005,
417 	CHAN_ENUM_7025,
418 	CHAN_ENUM_7045,
419 	CHAN_ENUM_7065,
420 	CHAN_ENUM_7085,
421 	CHAN_ENUM_7105,
422 #endif /* CONFIG_BAND_6GHZ */
423 
424 	NUM_CHANNELS,
425 
426 	MIN_24GHZ_CHANNEL = CHAN_ENUM_2412,
427 	MAX_24GHZ_CHANNEL = CHAN_ENUM_2484,
428 	NUM_24GHZ_CHANNELS = (MAX_24GHZ_CHANNEL - MIN_24GHZ_CHANNEL + 1),
429 
430 	MIN_49GHZ_CHANNEL = CHAN_ENUM_4912,
431 	MAX_49GHZ_CHANNEL = CHAN_ENUM_5080,
432 	NUM_49GHZ_CHANNELS = (MAX_49GHZ_CHANNEL - MIN_49GHZ_CHANNEL + 1),
433 
434 	MIN_5GHZ_CHANNEL = CHAN_ENUM_5180,
435 	MAX_5GHZ_CHANNEL = CHAN_ENUM_5920,
436 	NUM_5GHZ_CHANNELS = (MAX_5GHZ_CHANNEL - MIN_5GHZ_CHANNEL + 1),
437 
438 	MIN_DSRC_CHANNEL = CHAN_ENUM_5850,
439 	MAX_DSRC_CHANNEL = CHAN_ENUM_5920,
440 	NUM_DSRC_CHANNELS = (MAX_DSRC_CHANNEL - MIN_DSRC_CHANNEL + 1),
441 
442 	INVALID_CHANNEL = 0xBAD,
443 
444 #ifdef DISABLE_UNII_SHARED_BANDS
445 	MIN_UNII_1_BAND_CHANNEL = CHAN_ENUM_5180,
446 	MAX_UNII_1_BAND_CHANNEL = CHAN_ENUM_5240,
447 	NUM_UNII_1_BAND_CHANNELS = (MAX_UNII_1_BAND_CHANNEL -
448 				    MIN_UNII_1_BAND_CHANNEL + 1),
449 
450 	MIN_UNII_2A_BAND_CHANNEL = CHAN_ENUM_5260,
451 	MAX_UNII_2A_BAND_CHANNEL = CHAN_ENUM_5320,
452 	NUM_UNII_2A_BAND_CHANNELS = (MAX_UNII_2A_BAND_CHANNEL -
453 				     MIN_UNII_2A_BAND_CHANNEL + 1),
454 #endif
455 
456 #ifdef CONFIG_BAND_6GHZ
457 	MIN_6GHZ_CHANNEL = CHAN_ENUM_5945,
458 	MAX_6GHZ_CHANNEL = CHAN_ENUM_7105,
459 	NUM_6GHZ_CHANNELS = (MAX_6GHZ_CHANNEL - MIN_6GHZ_CHANNEL + 1),
460 #else
461 	MIN_6GHZ_CHANNEL = INVALID_CHANNEL,
462 	MAX_6GHZ_CHANNEL = INVALID_CHANNEL,
463 	NUM_6GHZ_CHANNELS = 0,
464 #endif /* CONFIG_BAND_6GHZ */
465 };
466 
467 /**
468  * enum channel_state - channel state
469  * @CHANNEL_STATE_DISABLE: disabled state
470  * @CHANNEL_STATE_PASSIVE: passive state
471  * @CHANNEL_STATE_DFS: dfs state
472  * @CHANNEL_STATE_ENABLE: enabled state
473  * @CHANNEL_STATE_INVALID: invalid state
474  */
475 enum channel_state {
476 	CHANNEL_STATE_DISABLE,
477 	CHANNEL_STATE_PASSIVE,
478 	CHANNEL_STATE_DFS,
479 	CHANNEL_STATE_ENABLE,
480 	CHANNEL_STATE_INVALID,
481 };
482 
483 /**
484  * enum reg_domain: reg domain
485  * @REGDOMAIN_FCC: FCC domain
486  * @REGDOMAIN_ETSI: ETSI domain
487  * @REGDOMAIN_JAPAN: JAPAN domain
488  * @REGDOMAIN_WORLD: WORLD domain
489  * @REGDOMAIN_COUNT: Max domain
490  */
491 typedef enum {
492 	REGDOMAIN_FCC,
493 	REGDOMAIN_ETSI,
494 	REGDOMAIN_JAPAN,
495 	REGDOMAIN_WORLD,
496 	REGDOMAIN_COUNT
497 } v_REGDOMAIN_t;
498 
499 /**
500  * enum ctl_value - CTL value
501  * @CTL_FCC: CTL FCC
502  * @CTL_MKK: CTL MKK
503  * @CTL_ETSI: CTL ETSI
504  * @CTL_KOR: CTL KOR
505  * @CTL_CHN: CTL CHINA
506  * @CTL_USER_DEF: CTL USER_DEF
507  * @CTL_NONE: CTL NONE
508  */
509 enum ctl_value {
510 	CTL_FCC = 0x10,
511 	CTL_ETSI = 0x30,
512 	CTL_MKK = 0x40,
513 	CTL_KOR = 0x50,
514 	CTL_CHN = 0x60,
515 	CTL_USER_DEF = 0x70,
516 	CTL_NONE = 0xff
517 };
518 
519 /**
520  * struct ch_params
521  * @ch_width: channel width
522  * @sec_ch_offset: secondary channel offset
523  * @center_freq_seg0: channel number for segment 0
524  * @center_freq_seg1: channel number segment 1
525  * @mhz_freq_seg0: Center frequency for segment 0
526  * @mhz_freq_seg1: Center frequency for segment 1
527  */
528 struct ch_params {
529 	enum phy_ch_width ch_width;
530 	uint8_t sec_ch_offset;
531 	qdf_freq_t center_freq_seg0;
532 	qdf_freq_t center_freq_seg1;
533 	qdf_freq_t mhz_freq_seg0;
534 	qdf_freq_t mhz_freq_seg1;
535 };
536 
537 /**
538  * struct channel_power
539  * @center_freq: Channel Center Frequency
540  * @chan_num: channel number
541  * @tx_power: TX power
542  */
543 struct channel_power {
544 	qdf_freq_t center_freq;
545 	uint8_t chan_num;
546 	uint32_t tx_power;
547 };
548 
549 /**
550  * enum offset_t: channel offset
551  * @BW20: 20 mhz channel
552  * @BW40_LOW_PRIMARY: lower channel in 40 mhz
553  * @BW40_HIGH_PRIMARY: higher channel in 40 mhz
554  * @BW80: 80 mhz channel
555  * @BWALL: unknown bandwidth
556  */
557 enum offset_t {
558 	BW20 = 0,
559 	BW40_LOW_PRIMARY = 1,
560 	BW40_HIGH_PRIMARY = 3,
561 	BW80,
562 	BWALL,
563 	BW_INVALID = 0xFF
564 };
565 
566 /**
567  * enum behav_limit - behavior limit
568  * @BEHAV_NONE: none
569  * @BEHAV_BW40_LOW_PRIMARY: BW40 low primary
570  * @BEHAV_BW40_HIGH_PRIMARY: BW40 high primary
571  * @BEHAV_BW80_PLUS: BW 80 plus
572  * @BEHAV_INVALID: invalid behavior
573  */
574 enum behav_limit {
575 	BEHAV_NONE,
576 	BEHAV_BW40_LOW_PRIMARY,
577 	BEHAV_BW40_HIGH_PRIMARY,
578 	BEHAV_BW80_PLUS,
579 	BEHAV_INVALID = 0xFF
580 };
581 
582 /**
583  * struct reg_dmn_op_class_map_t: operating class
584  * @op_class: operating class number
585  * @chan_spacing: channel spacing
586  * @offset: offset
587  * @behav_limit: OR of bitmaps of enum behav_limit
588  * @start_freq: starting frequency
589  * @channels: channel set
590  */
591 struct reg_dmn_op_class_map_t {
592 	uint8_t op_class;
593 	uint8_t chan_spacing;
594 	enum offset_t offset;
595 	uint16_t behav_limit;
596 	qdf_freq_t start_freq;
597 	uint8_t channels[REG_MAX_CHANNELS_PER_OPERATING_CLASS];
598 };
599 
600 /**
601  * struct reg_dmn_supp_op_classes: operating classes
602  * @num_classes: number of classes
603  * @classes: classes
604  */
605 struct reg_dmn_supp_op_classes {
606 	uint8_t num_classes;
607 	uint8_t classes[REG_MAX_SUPP_OPER_CLASSES];
608 };
609 
610 /**
611  * struct reg_start_11d_scan_req: start 11d scan request
612  * @vdev_id: vdev id
613  * @scan_period_msec: scan duration in milli-seconds
614  * @start_interval_msec: offset duration to start the scan in milli-seconds
615  */
616 struct reg_start_11d_scan_req {
617 	uint8_t vdev_id;
618 	uint32_t scan_period_msec;
619 	uint32_t start_interval_msec;
620 };
621 
622 /**
623  * struct reg_stop_11d_scan_req: stop 11d scan request
624  * @vdev_id: vdev id
625  */
626 struct reg_stop_11d_scan_req {
627 	uint8_t vdev_id;
628 };
629 
630 /**
631  * struct reg_11d_new_country: regulatory 11d new coutry code
632  * @alpha2: new 11d alpha2
633  */
634 struct reg_11d_new_country {
635 	uint8_t alpha2[REG_ALPHA2_LEN + 1];
636 };
637 
638 /**
639  * enum country_src: country source
640  * @SOURCE_QUERY: source query
641  * @SOURCE_CORE: source regulatory core
642  * @SOURCE_DRIVER: source driver
643  * @SOURCE_USERSPACE: source userspace
644  * @SOURCE_11D: source 11D
645  */
646 enum country_src {
647 	SOURCE_UNKNOWN,
648 	SOURCE_QUERY,
649 	SOURCE_CORE,
650 	SOURCE_DRIVER,
651 	SOURCE_USERSPACE,
652 	SOURCE_11D
653 };
654 
655 /**
656  * struct regulatory_channel
657  * @center_freq: center frequency
658  * @chan_num: channel number
659  * @state: channel state
660  * @chan_flags: channel flags
661  * @tx_power: TX powers
662  * @min_bw: min bandwidth
663  * @max_bw: max bandwidth
664  * @nol_chan: whether channel is nol
665  * @nol_history: Set NOL-History when STA vap detects RADAR.
666  */
667 struct regulatory_channel {
668 	qdf_freq_t center_freq;
669 	uint8_t chan_num;
670 	enum channel_state state;
671 	uint32_t chan_flags;
672 	uint32_t tx_power;
673 	uint16_t min_bw;
674 	uint16_t max_bw;
675 	uint8_t ant_gain;
676 	bool nol_chan;
677 	bool nol_history;
678 };
679 
680 /**
681  * struct regulatory: regulatory information
682  * @reg_domain: regulatory domain pair
683  * @eeprom_rd_ext: eeprom value
684  * @country_code: current country in integer
685  * @alpha2: current alpha2
686  * @def_country: default country alpha2
687  * @def_region: DFS region
688  * @ctl_2g: 2G CTL value
689  * @ctl_5g: 5G CTL value
690  * @reg_pair: pointer to regulatory pair
691  * @cc_src: country code src
692  * @reg_flags: kernel regulatory flags
693  */
694 struct regulatory {
695 	uint32_t reg_domain;
696 	uint32_t eeprom_rd_ext;
697 	uint16_t country_code;
698 	uint8_t alpha2[REG_ALPHA2_LEN + 1];
699 	uint8_t ctl_2g;
700 	uint8_t ctl_5g;
701 	const void *regpair;
702 	enum country_src cc_src;
703 	uint32_t reg_flags;
704 };
705 
706 /**
707  * struct chan_map
708  * @center_freq: center freq in mhz
709  * @chan_num: channel number
710  * @min_bw: min bw
711  * @max_bw: max bw
712  */
713 struct chan_map {
714 	qdf_freq_t center_freq;
715 	uint8_t chan_num;
716 	uint16_t min_bw;
717 	uint16_t max_bw;
718 };
719 
720 /**
721  * struct bonded_channel
722  * @start_ch: start channel
723  * @end_ch: end channel
724  */
725 struct bonded_channel {
726 	uint8_t start_ch;
727 	uint8_t end_ch;
728 };
729 
730 /**
731  * struct bonded_channel_freq
732  * @start_freq: start channel frequency
733  * @end_freq: end channel frequency
734  */
735 struct bonded_channel_freq {
736 	uint16_t start_freq;
737 	uint16_t end_freq;
738 };
739 
740 struct set_country {
741 	uint8_t country[REG_ALPHA2_LEN + 1];
742 	uint8_t pdev_id;
743 };
744 /**
745  * enum ht_sec_ch_offset
746  * @NO_SEC_CH: no secondary
747  * @LOW_PRIMARY_CH: low primary
748  * @HIGH_PRIMARY_CH: high primary
749  */
750 enum ht_sec_ch_offset {
751 	NO_SEC_CH = 0,
752 	LOW_PRIMARY_CH = 1,
753 	HIGH_PRIMARY_CH = 3,
754 };
755 
756 enum cc_setting_code {
757 	REG_SET_CC_STATUS_PASS = 0,
758 	REG_CURRENT_ALPHA2_NOT_FOUND = 1,
759 	REG_INIT_ALPHA2_NOT_FOUND = 2,
760 	REG_SET_CC_CHANGE_NOT_ALLOWED = 3,
761 	REG_SET_CC_STATUS_NO_MEMORY = 4,
762 	REG_SET_CC_STATUS_FAIL = 5,
763 };
764 
765 /**
766  * struct cur_reg_rule
767  * @start_freq: start frequency
768  * @end_freq: end frequency
769  * @max_bw: maximum bandwidth
770  * @reg_power: regulatory power
771  * @ant_gain: antenna gain
772  * @flags: regulatory flags
773  */
774 struct cur_reg_rule {
775 	uint16_t start_freq;
776 	uint16_t end_freq;
777 	uint16_t max_bw;
778 	uint8_t reg_power;
779 	uint8_t ant_gain;
780 	uint16_t flags;
781 };
782 
783 /**
784  * struct cur_regulatory_info
785  * @psoc: psoc ptr
786  * @status_code: status value
787  * @num_phy: number of phy
788  * @phy_id: phy id
789  * @reg_dmn_pair: reg domain pair
790  * @ctry_code: country code
791  * @alpha2: country alpha2
792  * @offload_enabled: offload enabled
793  * @dfs_reg: dfs region
794  * @phybitmap: phy bit map
795  * @min_bw_2g: minimum 2G bw
796  * @max_bw_2g: maximum 2G bw
797  * @min_bw_5g: minimum 5G bw
798  * @max_bw_5g: maximum 5G bw
799  * @num_2g_reg_rules: number 2G reg rules
800  * @num_5g_reg_rules: number 5G  and 6G reg rules
801  * @reg_rules_2g_ptr: ptr to 2G reg rules
802  * @reg_rules_5g_ptr: ptr to 5G reg rules
803  */
804 struct cur_regulatory_info {
805 	struct wlan_objmgr_psoc *psoc;
806 	enum cc_setting_code status_code;
807 	uint8_t num_phy;
808 	uint8_t phy_id;
809 	uint16_t reg_dmn_pair;
810 	uint16_t ctry_code;
811 	uint8_t alpha2[REG_ALPHA2_LEN + 1];
812 	bool offload_enabled;
813 	enum dfs_reg dfs_region;
814 	uint32_t phybitmap;
815 	uint32_t min_bw_2g;
816 	uint32_t max_bw_2g;
817 	uint32_t min_bw_5g;
818 	uint32_t max_bw_5g;
819 	uint32_t num_2g_reg_rules;
820 	uint32_t num_5g_reg_rules;
821 	struct cur_reg_rule *reg_rules_2g_ptr;
822 	struct cur_reg_rule *reg_rules_5g_ptr;
823 };
824 
825 /**
826  * struct reg_rule_info
827  * @alpha2: alpha2 of reg rules
828  * @dfs_region: dfs region
829  * @num_of_reg_rules: number of reg rules
830  * @reg_rules: regulatory rules array
831  */
832 struct reg_rule_info {
833 	uint8_t alpha2[REG_ALPHA2_LEN + 1];
834 	enum dfs_reg dfs_region;
835 	uint8_t num_of_reg_rules;
836 	struct cur_reg_rule reg_rules[MAX_REG_RULES];
837 };
838 
839 /**
840  * enum reg_reg_wifi_band
841  * @REG_BAND_2G: 2G band
842  * @REG_BAND_5G: 5G band
843  * @REG_BAND_6G: 6G band
844  * @REG_BAND_UNKNOWN: Unsupported band
845  */
846 enum reg_wifi_band {
847 	REG_BAND_2G,
848 	REG_BAND_5G,
849 	REG_BAND_6G,
850 	REG_BAND_UNKNOWN
851 };
852 
853 #ifdef DISABLE_UNII_SHARED_BANDS
854 /**
855  * enum reg_unii_band
856  * @REG_UNII_BAND_1: Disable UNII-1 band channels
857  * @REG_UNII_BAND_2A: Disable UNII-2A band channels
858  */
859 enum reg_unii_band {
860 	REG_UNII_BAND_1 = 0x0,
861 	REG_UNII_BAND_2A = 0x1,
862 };
863 #endif
864 
865 #define REG_BAND_MASK_ALL (BIT(REG_BAND_2G) | BIT(REG_BAND_5G) \
866 			  | BIT(REG_BAND_6G))
867 
868 /* Avoid the use of band_info as it does not support 6GHz band. Use
869  * reg_wifi_band, as it supports the 6GHz band
870  */
871 /**
872  * enum band_info
873  * @BAND_ALL:all bands
874  * @BAND_2G: 2G band
875  * @BAND_5G: 5G band
876  * @BAND_UNKNOWN: Unsupported band
877  */
878 enum band_info {
879 	BAND_ALL,
880 	BAND_2G,
881 	BAND_5G,
882 	BAND_UNKNOWN
883 };
884 
885 /**
886  * enum restart_beaconing_on_ch_avoid_rule: control the beaconing entity to
887  * move away from active LTE channels
888  * @CH_AVOID_RULE_DO_NOT_RESTART: Do not move from active LTE
889  *                              channels
890  * @CH_AVOID_RULE_RESTART: Move from active LTE channels
891  * @CH_AVOID_RULE_RESTART_24G_ONLY: move from 2.4G active LTE
892  *                                channels only
893  */
894 enum restart_beaconing_on_ch_avoid_rule {
895 	CH_AVOID_RULE_DO_NOT_RESTART,
896 	CH_AVOID_RULE_RESTART,
897 	CH_AVOID_RULE_RESTART_24G_ONLY,
898 };
899 
900 /**
901  * struct reg_config_vars
902  * @enable_11d_support: enable 11d support
903  * @scan_11d_interval: 11d scan interval in ms
904  * @userspace_ctry_priority: user priority
905  * @band_capability: band capability
906  * @dfs_disable: dfs disabled
907  * @indoor_channel_support: indoor channel support
908  * @force_ssc_disable_indoor_channel: Disable indoor channel on sap start
909  * @restart_beaconing: control the beaconing entity to move
910  * away from active LTE channels
911  * @enable_srd_chan_in_master_mode: SRD channel support in master mode
912  * @enable_11d_in_world_mode: enable 11d in world mode
913  */
914 struct reg_config_vars {
915 	uint32_t enable_11d_support;
916 	uint32_t scan_11d_interval;
917 	uint32_t userspace_ctry_priority;
918 	enum band_info band_capability;
919 	uint32_t dfs_enabled;
920 	uint32_t indoor_chan_enabled;
921 	uint32_t force_ssc_disable_indoor_channel;
922 	enum restart_beaconing_on_ch_avoid_rule restart_beaconing;
923 	bool enable_srd_chan_in_master_mode;
924 	bool enable_11d_in_world_mode;
925 };
926 
927 /**
928  * struct reg_freq_range
929  * @low_freq: low frequency
930  * @high_freq: high frequency
931  */
932 struct reg_freq_range {
933 	uint32_t low_freq;
934 	uint32_t high_freq;
935 };
936 
937 /**
938  * struct reg_sched_payload
939  * @psoc: psoc ptr
940  * @pdev: pdev ptr
941  */
942 struct reg_sched_payload {
943 	struct wlan_objmgr_psoc *psoc;
944 	struct wlan_objmgr_pdev *pdev;
945 };
946 
947 /**
948  * enum direction
949  * @NORTHBOUND: northbound
950  * @SOUTHBOUND: southbound
951  */
952 enum direction {
953 	NORTHBOUND,
954 	SOUTHBOUND,
955 };
956 
957 /**
958  * struct mas_chan_params
959  * @dfs_region: dfs region
960  * @phybitmap: phybitmap
961  * @mas_chan_list: master chan list
962  * @default_country: default country
963  * @current_country: current country
964  * @def_region_domain: default reg domain
965  * @def_country_code: default country code
966  * @reg_dmn_pair: reg domain pair
967  * @ctry_code: country code
968  * @reg_rules: regulatory rules
969  */
970 struct mas_chan_params {
971 	enum dfs_reg dfs_region;
972 	uint32_t phybitmap;
973 	struct regulatory_channel mas_chan_list[NUM_CHANNELS];
974 	char default_country[REG_ALPHA2_LEN + 1];
975 	char current_country[REG_ALPHA2_LEN + 1];
976 	uint16_t def_region_domain;
977 	uint16_t def_country_code;
978 	uint16_t reg_dmn_pair;
979 	uint16_t ctry_code;
980 	struct reg_rule_info reg_rules;
981 };
982 
983 /**
984  * enum cc_regdmn_flag: Regdomain flags
985  * @INVALID:       Invalid flag
986  * @CC_IS_SET:     Country code is set
987  * @REGDMN_IS_SET: Regdomain ID is set
988  * @ALPHA_IS_SET:  Country ISO is set
989  */
990 enum cc_regdmn_flag {
991 	INVALID_CC,
992 	CC_IS_SET,
993 	REGDMN_IS_SET,
994 	ALPHA_IS_SET,
995 };
996 
997 /**
998  * struct cc_regdmn_s: User country code or regdomain
999  * @country_code: Country code
1000  * @regdmn_id:    Regdomain pair ID
1001  * @alpha:        Country ISO
1002  * @flags:        Regdomain flags
1003  */
1004 struct cc_regdmn_s {
1005 	union {
1006 		uint16_t country_code;
1007 		uint16_t regdmn_id;
1008 		uint8_t alpha[REG_ALPHA2_LEN + 1];
1009 	} cc;
1010 	uint8_t flags;
1011 };
1012 
1013 /**
1014  * struct cur_regdmn_info: Current regulatory info
1015  * @regdmn_pair_id: Current regdomain pair ID
1016  * @dmn_id_2g: 2GHz regdomain ID
1017  * @dmn_id_5g: 5GHz regdomain ID
1018  * @ctl_2g: 2GHz CTL value
1019  * @ctl_5g: 5GHzCTL value
1020  * @dfs_region: dfs region
1021  */
1022 struct cur_regdmn_info {
1023 	uint16_t regdmn_pair_id;
1024 	uint16_t dmn_id_2g;
1025 	uint16_t dmn_id_5g;
1026 	uint8_t ctl_2g;
1027 	uint8_t ctl_5g;
1028 	uint8_t dfs_region;
1029 };
1030 
1031 /**
1032  * struct ch_avoid_freq_type
1033  * @start_freq: start freq
1034  * @end_freq: end freq
1035  */
1036 struct ch_avoid_freq_type {
1037 	qdf_freq_t start_freq;
1038 	qdf_freq_t end_freq;
1039 };
1040 
1041 /**
1042  * struct ch_avoid_ind_type
1043  * @ch_avoid_range_cnt: count
1044  * @avoid_freq_range: avoid freq range array
1045  */
1046 struct ch_avoid_ind_type {
1047 	uint32_t ch_avoid_range_cnt;
1048 	struct ch_avoid_freq_type avoid_freq_range[CH_AVOID_MAX_RANGE];
1049 };
1050 
1051 /**
1052  * struct unsafe_ch_list
1053  * @chan_cnt: no.of channels
1054  * @chan_freq_list: channel frequency list
1055  */
1056 struct unsafe_ch_list {
1057 	uint16_t chan_cnt;
1058 	uint16_t chan_freq_list[NUM_CHANNELS];
1059 };
1060 
1061 /**
1062  * struct avoid_freq_ind_data
1063  * @freq_list: frequency list
1064  * @chan_list: channel list
1065  */
1066 struct avoid_freq_ind_data {
1067 	struct ch_avoid_ind_type freq_list;
1068 	struct unsafe_ch_list chan_list;
1069 };
1070 
1071 #define FIVEG_STARTING_FREQ     5000
1072 #define TWOG_STARTING_FREQ      2407
1073 #define TWOG_CHAN_14_IN_MHZ     2484
1074 #define TWOG_CHAN_1_IN_MHZ      2412
1075 #define TWOG_CHAN_5_IN_MHZ      2432
1076 #define TWOG_CHAN_6_IN_MHZ      2437
1077 #define TWOG_CHAN_13_IN_MHZ     2472
1078 
1079 /**
1080  * struct reg_ctl_params - reg ctl and regd info
1081  * @regd: regdomain pair
1082  * @regd_2g: 2g sub domain code
1083  * @regd_5g: 5g sub domain code
1084  * @ctl_2g: 2g ctl info
1085  * @ctl_5g: 5g ctl info
1086  */
1087 struct reg_ctl_params {
1088 	uint32_t regd;
1089 	uint16_t regd_2g;
1090 	uint16_t regd_5g;
1091 	uint8_t ctl_2g;
1092 	uint8_t ctl_5g;
1093 };
1094 
1095 #endif
1096