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