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