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