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