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