xref: /wlan-dirver/qca-wifi-host-cmn/umac/regulatory/dispatcher/inc/reg_services_public_struct.h (revision dae10a5fbc53d54c53c4ba24fa018ad8b1e7c008)
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 };
552 
553 /**
554  * struct reg_dmn_op_class_map_t: operating class
555  * @op_class: operating class number
556  * @ch_spacing: channel spacing
557  * @offset: offset
558  * @channels: channel set
559  */
560 struct reg_dmn_op_class_map_t {
561 	uint8_t op_class;
562 	uint8_t ch_spacing;
563 	enum offset_t offset;
564 	uint8_t channels[REG_MAX_CHANNELS_PER_OPERATING_CLASS];
565 };
566 
567 /**
568  * struct reg_dmn_supp_op_classes: operating classes
569  * @num_classes: number of classes
570  * @classes: classes
571  */
572 struct reg_dmn_supp_op_classes {
573 	uint8_t num_classes;
574 	uint8_t classes[REG_MAX_SUPP_OPER_CLASSES];
575 };
576 
577 /**
578  * struct reg_start_11d_scan_req: start 11d scan request
579  * @vdev_id: vdev id
580  * @scan_period_msec: scan duration in milli-seconds
581  * @start_interval_msec: offset duration to start the scan in milli-seconds
582  */
583 struct reg_start_11d_scan_req {
584 	uint8_t vdev_id;
585 	uint32_t scan_period_msec;
586 	uint32_t start_interval_msec;
587 };
588 
589 /**
590  * struct reg_stop_11d_scan_req: stop 11d scan request
591  * @vdev_id: vdev id
592  */
593 struct reg_stop_11d_scan_req {
594 	uint8_t vdev_id;
595 };
596 
597 /**
598  * struct reg_11d_new_country: regulatory 11d new coutry code
599  * @alpha2: new 11d alpha2
600  */
601 struct reg_11d_new_country {
602 	uint8_t alpha2[REG_ALPHA2_LEN + 1];
603 };
604 
605 /**
606  * enum country_src: country source
607  * @SOURCE_QUERY: source query
608  * @SOURCE_CORE: source regulatory core
609  * @SOURCE_DRIVER: source driver
610  * @SOURCE_USERSPACE: source userspace
611  * @SOURCE_11D: source 11D
612  */
613 enum country_src {
614 	SOURCE_UNKNOWN,
615 	SOURCE_QUERY,
616 	SOURCE_CORE,
617 	SOURCE_DRIVER,
618 	SOURCE_USERSPACE,
619 	SOURCE_11D
620 };
621 
622 /**
623  * struct regulatory_channel
624  * @center_freq: center frequency
625  * @chan_num: channel number
626  * @state: channel state
627  * @chan_flags: channel flags
628  * @tx_power: TX powers
629  * @min_bw: min bandwidth
630  * @max_bw: max bandwidth
631  * @nol_chan: whether channel is nol
632  */
633 struct regulatory_channel {
634 	uint32_t center_freq;
635 	uint32_t chan_num;
636 	enum channel_state state;
637 	uint32_t chan_flags;
638 	uint32_t tx_power;
639 	uint16_t min_bw;
640 	uint16_t max_bw;
641 	uint8_t ant_gain;
642 	bool nol_chan;
643 };
644 
645 
646 /**
647  * struct regulatory: regulatory information
648  * @reg_domain: regulatory domain pair
649  * @eeprom_rd_ext: eeprom value
650  * @country_code: current country in integer
651  * @alpha2: current alpha2
652  * @def_country: default country alpha2
653  * @def_region: DFS region
654  * @ctl_2g: 2G CTL value
655  * @ctl_5g: 5G CTL value
656  * @reg_pair: pointer to regulatory pair
657  * @cc_src: country code src
658  * @reg_flags: kernel regulatory flags
659  */
660 struct regulatory {
661 	uint32_t reg_domain;
662 	uint32_t eeprom_rd_ext;
663 	uint16_t country_code;
664 	uint8_t alpha2[REG_ALPHA2_LEN + 1];
665 	uint8_t ctl_2g;
666 	uint8_t ctl_5g;
667 	const void *regpair;
668 	enum country_src cc_src;
669 	uint32_t reg_flags;
670 };
671 
672 /**
673  * struct chan_map
674  * @center_freq: center freq in mhz
675  * @chan_num: channel number
676  * @min_bw: min bw
677  * @max_bw: max bw
678  */
679 struct chan_map {
680 	uint32_t center_freq;
681 	uint32_t chan_num;
682 	uint16_t min_bw;
683 	uint16_t max_bw;
684 };
685 
686 /**
687  * struct bonded_channel
688  * @start_ch: start channel
689  * @end_ch: end channel
690  */
691 struct bonded_channel {
692 	uint16_t start_ch;
693 	uint16_t end_ch;
694 };
695 
696 struct set_country {
697 	uint8_t country[REG_ALPHA2_LEN + 1];
698 	uint8_t pdev_id;
699 };
700 /**
701  * enum ht_sec_ch_offset
702  * @NO_SEC_CH: no secondary
703  * @LOW_PRIMARY_CH: low primary
704  * @HIGH_PRIMARY_CH: high primary
705  */
706 enum ht_sec_ch_offset {
707 	NO_SEC_CH = 0,
708 	LOW_PRIMARY_CH = 1,
709 	HIGH_PRIMARY_CH = 3,
710 };
711 
712 enum cc_setting_code {
713 	REG_SET_CC_STATUS_PASS = 0,
714 	REG_CURRENT_ALPHA2_NOT_FOUND = 1,
715 	REG_INIT_ALPHA2_NOT_FOUND = 2,
716 	REG_SET_CC_CHANGE_NOT_ALLOWED = 3,
717 	REG_SET_CC_STATUS_NO_MEMORY = 4,
718 	REG_SET_CC_STATUS_FAIL = 5,
719 };
720 
721 /**
722  * struct cur_reg_rule
723  * @start_freq: start frequency
724  * @end_freq: end frequency
725  * @max_bw: maximum bandwidth
726  * @reg_power: regulatory power
727  * @ant_gain: antenna gain
728  * @flags: regulatory flags
729  */
730 struct cur_reg_rule {
731 	uint16_t start_freq;
732 	uint16_t end_freq;
733 	uint16_t max_bw;
734 	uint8_t reg_power;
735 	uint8_t ant_gain;
736 	uint16_t flags;
737 };
738 
739 /**
740  * struct cur_regulatory_info
741  * @psoc: psoc ptr
742  * @status_code: status value
743  * @num_phy: number of phy
744  * @phy_id: phy id
745  * @reg_dmn_pair: reg domain pair
746  * @ctry_code: country code
747  * @alpha2: country alpha2
748  * @offload_enabled: offload enabled
749  * @dfs_reg: dfs region
750  * @phybitmap: phy bit map
751  * @min_bw_2g: minimum 2G bw
752  * @max_bw_2g: maximum 2G bw
753  * @min_bw_5g: minimum 5G bw
754  * @max_bw_5g: maximum 5G bw
755  * @num_2g_reg_rules: number 2G reg rules
756  * @num_5g_reg_rules: number 5G reg rules
757  * @reg_rules_2g_ptr: ptr to 2G reg rules
758  * @reg_rules_5g_ptr: ptr to 5G reg rules
759  */
760 struct cur_regulatory_info {
761 	struct wlan_objmgr_psoc *psoc;
762 	enum cc_setting_code status_code;
763 	uint8_t num_phy;
764 	uint8_t phy_id;
765 	uint16_t reg_dmn_pair;
766 	uint16_t ctry_code;
767 	uint8_t alpha2[REG_ALPHA2_LEN + 1];
768 	bool offload_enabled;
769 	enum dfs_reg dfs_region;
770 	uint32_t phybitmap;
771 	uint32_t min_bw_2g;
772 	uint32_t max_bw_2g;
773 	uint32_t min_bw_5g;
774 	uint32_t max_bw_5g;
775 	uint32_t num_2g_reg_rules;
776 	uint32_t num_5g_reg_rules;
777 	struct cur_reg_rule *reg_rules_2g_ptr;
778 	struct cur_reg_rule *reg_rules_5g_ptr;
779 };
780 
781 /**
782  * struct reg_rule_info
783  * @alpha2: alpha2 of reg rules
784  * @dfs_region: dfs region
785  * @num_of_reg_rules: number of reg rules
786  * @reg_rules: regulatory rules array
787  */
788 struct reg_rule_info {
789 	uint8_t alpha2[REG_ALPHA2_LEN + 1];
790 	enum dfs_reg dfs_region;
791 	uint8_t num_of_reg_rules;
792 	struct cur_reg_rule reg_rules[MAX_REG_RULES];
793 };
794 
795 /**
796  * enum band_info
797  * @BAND_ALL:all bands
798  * @BAND_2G: 2G band
799  * @BAND_5G: 5G band
800  * @BAND_UNKNOWN: Unsupported band
801  */
802 enum band_info {
803 	BAND_ALL,
804 	BAND_2G,
805 	BAND_5G,
806 	BAND_UNKNOWN
807 };
808 
809 /**
810  * enum restart_beaconing_on_ch_avoid_rule: control the beaconing entity to
811  * move away from active LTE channels
812  * @CH_AVOID_RULE_DO_NOT_RESTART: Do not move from active LTE
813  *                              channels
814  * @CH_AVOID_RULE_RESTART: Move from active LTE channels
815  * @CH_AVOID_RULE_RESTART_24G_ONLY: move from 2.4G active LTE
816  *                                channels only
817  */
818 enum restart_beaconing_on_ch_avoid_rule {
819 	CH_AVOID_RULE_DO_NOT_RESTART,
820 	CH_AVOID_RULE_RESTART,
821 	CH_AVOID_RULE_RESTART_24G_ONLY,
822 };
823 
824 /**
825  * struct reg_config_vars
826  * @enable_11d_support: enable 11d support
827  * @scan_11d_interval: 11d scan interval in ms
828  * @userspace_ctry_priority: user priority
829  * @band_capability: band capability
830  * @dfs_disable: dfs disabled
831  * @indoor_channel_support: indoor channel support
832  * @force_ssc_disable_indoor_channel: Disable indoor channel on sap start
833  * @restart_beaconing: control the beaconing entity to move
834  * away from active LTE channels
835  * @enable_srd_chan_in_master_mode: SRD channel support in master mode
836  * @enable_11d_in_world_mode: enable 11d in world mode
837  */
838 struct reg_config_vars {
839 	uint32_t enable_11d_support;
840 	uint32_t scan_11d_interval;
841 	uint32_t userspace_ctry_priority;
842 	enum band_info band_capability;
843 	uint32_t dfs_enabled;
844 	uint32_t indoor_chan_enabled;
845 	uint32_t force_ssc_disable_indoor_channel;
846 	enum restart_beaconing_on_ch_avoid_rule restart_beaconing;
847 	bool enable_srd_chan_in_master_mode;
848 	bool enable_11d_in_world_mode;
849 };
850 
851 /**
852  * struct reg_freq_range
853  * @low_freq: low frequency
854  * @high_freq: high frequency
855  */
856 struct reg_freq_range {
857 	uint32_t low_freq;
858 	uint32_t high_freq;
859 };
860 
861 /**
862  * struct reg_sched_payload
863  * @psoc: psoc ptr
864  * @pdev: pdev ptr
865  */
866 struct reg_sched_payload {
867 	struct wlan_objmgr_psoc *psoc;
868 	struct wlan_objmgr_pdev *pdev;
869 };
870 
871 /**
872  * enum direction
873  * @NORTHBOUND: northbound
874  * @SOUTHBOUND: southbound
875  */
876 enum direction {
877 	NORTHBOUND,
878 	SOUTHBOUND,
879 };
880 
881 /**
882  * struct mas_chan_params
883  * @dfs_region: dfs region
884  * @phybitmap: phybitmap
885  * @mas_chan_list: master chan list
886  * @default_country: default country
887  * @current_country: current country
888  * @def_region_domain: default reg domain
889  * @def_country_code: default country code
890  * @reg_dmn_pair: reg domain pair
891  * @ctry_code: country code
892  * @reg_rules: regulatory rules
893  */
894 struct mas_chan_params {
895 	enum dfs_reg dfs_region;
896 	uint32_t phybitmap;
897 	struct regulatory_channel mas_chan_list[NUM_CHANNELS];
898 	char default_country[REG_ALPHA2_LEN + 1];
899 	char current_country[REG_ALPHA2_LEN + 1];
900 	uint16_t def_region_domain;
901 	uint16_t def_country_code;
902 	uint16_t reg_dmn_pair;
903 	uint16_t ctry_code;
904 	struct reg_rule_info reg_rules;
905 };
906 
907 /**
908  * enum cc_regdmn_flag: Regdomain flags
909  * @INVALID:       Invalid flag
910  * @CC_IS_SET:     Country code is set
911  * @REGDMN_IS_SET: Regdomain ID is set
912  * @ALPHA_IS_SET:  Country ISO is set
913  */
914 enum cc_regdmn_flag {
915 	INVALID_CC,
916 	CC_IS_SET,
917 	REGDMN_IS_SET,
918 	ALPHA_IS_SET,
919 };
920 
921 /**
922  * struct cc_regdmn_s: User country code or regdomain
923  * @country_code: Country code
924  * @regdmn_id:    Regdomain pair ID
925  * @alpha:        Country ISO
926  * @flags:        Regdomain flags
927  */
928 struct cc_regdmn_s {
929 	union {
930 		uint16_t country_code;
931 		uint16_t regdmn_id;
932 		uint8_t alpha[REG_ALPHA2_LEN + 1];
933 	} cc;
934 	uint8_t flags;
935 };
936 
937 /**
938  * struct cur_regdmn_info: Current regulatory info
939  * @regdmn_pair_id: Current regdomain pair ID
940  * @dmn_id_2g: 2GHz regdomain ID
941  * @dmn_id_5g: 5GHz regdomain ID
942  * @ctl_2g: 2GHz CTL value
943  * @ctl_5g: 5GHzCTL value
944  * @dfs_region: dfs region
945  */
946 struct cur_regdmn_info {
947 	uint16_t regdmn_pair_id;
948 	uint16_t dmn_id_2g;
949 	uint16_t dmn_id_5g;
950 	uint8_t ctl_2g;
951 	uint8_t ctl_5g;
952 	uint8_t dfs_region;
953 };
954 
955 /**
956  * struct ch_avoid_freq_type
957  * @start_freq: start freq
958  * @end_freq: end freq
959  */
960 struct ch_avoid_freq_type {
961 	uint32_t start_freq;
962 	uint32_t end_freq;
963 };
964 
965 /**
966  * struct ch_avoid_ind_type
967  * @ch_avoid_range_cnt: count
968  * @avoid_freq_range: avoid freq range array
969  */
970 struct ch_avoid_ind_type {
971 	uint32_t ch_avoid_range_cnt;
972 	struct ch_avoid_freq_type avoid_freq_range[CH_AVOID_MAX_RANGE];
973 };
974 
975 /**
976  * struct unsafe_ch_list
977  * @ch_cnt: no.of channels
978  * @ch_list: channel list
979  */
980 struct unsafe_ch_list {
981 	uint16_t ch_cnt;
982 	uint16_t ch_list[NUM_CHANNELS];
983 };
984 
985 /**
986  * struct avoid_freq_ind_data
987  * @freq_list: frequency list
988  * @chan_list: channel list
989  */
990 struct avoid_freq_ind_data {
991 	struct ch_avoid_ind_type freq_list;
992 	struct unsafe_ch_list chan_list;
993 };
994 
995 #endif
996