1 /* 2 * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. 3 * 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /** 21 * DOC: This file has the DFS dispatcher API which is exposed to outside of DFS 22 * component. 23 */ 24 25 #ifndef _WLAN_DFS_UTILS_API_H_ 26 #define _WLAN_DFS_UTILS_API_H_ 27 28 #include "wlan_dfs_ucfg_api.h" 29 #include "wlan_reg_services_api.h" 30 #include <wlan_objmgr_vdev_obj.h> 31 32 /* Add channel to nol */ 33 #define DFS_NOL_SET 1 34 35 /* Remove channel from nol */ 36 #define DFS_NOL_RESET 0 37 38 /* Mark nol-history flag for the channel */ 39 #define DFS_NOL_HISTORY_SET 1 40 41 /* Clear nol-history flag from the channel */ 42 #define DFS_NOL_HISTORY_RESET 0 43 44 /* Max nol channels */ 45 #define DFS_MAX_NOL_CHANNEL 80 46 47 /* WLAN 2.4GHz start freq */ 48 #define DFS_24_GHZ_BASE_FREQ (2407) 49 50 /* WLAN 5GHz start freq */ 51 #define DFS_5_GHZ_BASE_FREQ (5000) 52 53 /* WLAN 2.4 GHz channel number 6 */ 54 #define DFS_24_GHZ_CHANNEL_6 (6) 55 56 /* WLAN 2.4 GHz channel number 14 */ 57 #define DFS_24_GHZ_CHANNEL_14 (14) 58 59 /* WLAN 2.4 GHz channel number 15 */ 60 #define DFS_24_GHZ_CHANNEL_15 (15) 61 62 /* WLAN 2.4 GHz channel number 27 */ 63 #define DFS_24_GHZ_CHANNEL_27 (27) 64 65 /* WLAN 5GHz channel number 170 */ 66 #define DFS_5_GHZ_CHANNEL_170 (170) 67 68 /* WLAN 5MHz channel spacing */ 69 #define DFS_CHAN_SPACING_5MHZ (5) 70 71 /* WLAN 20Hz channel spacing */ 72 #define DFS_CHAN_SPACING_20MHZ (20) 73 74 /* WLAN 2.4GHz channel number 14 freq */ 75 #define DFS_CHAN_14_FREQ (2484) 76 77 /* WLAN 2.4GHz channel number 15 freq */ 78 #define DFS_CHAN_15_FREQ (2512) 79 80 /* WLAN 5GHz channel number 170 freq */ 81 #define DFS_CHAN_170_FREQ (5852) 82 83 84 85 extern struct dfs_to_mlme global_dfs_to_mlme; 86 87 /** 88 * utils_dfs_cac_valid_reset() - Cancels the dfs_cac_valid_timer timer. 89 * @pdev: Pointer to DFS pdev object. 90 * @prevchan_ieee: Prevchan number. 91 * @prevchan_flags: Prevchan flags. 92 * 93 * Wrapper function for dfs_cac_valid_reset(). This function called from 94 * outside of DFS component. 95 */ 96 #ifdef CONFIG_CHAN_NUM_API 97 QDF_STATUS utils_dfs_cac_valid_reset(struct wlan_objmgr_pdev *pdev, 98 uint8_t prevchan_ieee, 99 uint32_t prevchan_flags); 100 #endif 101 102 /** 103 * utils_dfs_cac_valid_reset_for_freq() - Cancels the dfs_cac_valid_timer timer. 104 * @pdev: Pointer to DFS pdev object. 105 * @prevchan_freq: Prevchan frequency. 106 * @prevchan_flags: Prevchan flags. 107 * 108 * Wrapper function for dfs_cac_valid_reset_for_freq(). This function called 109 * from outside of DFS component. 110 */ 111 #ifdef CONFIG_CHAN_FREQ_API 112 QDF_STATUS utils_dfs_cac_valid_reset_for_freq(struct wlan_objmgr_pdev *pdev, 113 uint16_t prevchan_freq, 114 uint32_t prevchan_flags); 115 #endif 116 117 /** 118 * utils_dfs_reset() - Reset DFS members. 119 * @pdev: Pointer to DFS pdev object. 120 */ 121 QDF_STATUS utils_dfs_reset(struct wlan_objmgr_pdev *pdev); 122 123 /** 124 * utils_dfs_is_freq_in_nol() - check if given channel in nol list 125 * @pdev: Pointer to DFS pdev object 126 * @freq: channel frequency 127 * 128 * check if given channel in nol list. 129 * 130 * Return: true if channel in nol, false else 131 */ 132 bool utils_dfs_is_freq_in_nol(struct wlan_objmgr_pdev *pdev, uint32_t freq); 133 134 /** 135 * utils_dfs_reset_precaclists() - Clears and initializes precac_list. 136 * @pdev: Pointer to DFS pdev object. 137 * 138 * Wrapper function for dfs_reset_precaclists(). This function called from 139 * outside of DFS component. 140 */ 141 QDF_STATUS utils_dfs_reset_precaclists(struct wlan_objmgr_pdev *pdev); 142 143 /** 144 * utils_dfs_unmark_precac_nol() - Clears precac channel marked as NOL. 145 * @pdev: Pointer to DFS pdev object. 146 * @chan: channel to be unmarked as NOL. 147 * 148 * Return void. 149 */ 150 #ifdef CONFIG_CHAN_NUM_API 151 void utils_dfs_unmark_precac_nol(struct wlan_objmgr_pdev *pdev, uint8_t chan); 152 #endif 153 154 /** 155 * utils_dfs_unmark_precac_nol_for_freq() - Clears precac channel marked as NOL. 156 * @pdev: Pointer to DFS pdev object. 157 * @chan_freq: channel freq to be unmarked as NOL. 158 * 159 * Return void. 160 */ 161 #ifdef CONFIG_CHAN_FREQ_API 162 void utils_dfs_unmark_precac_nol_for_freq(struct wlan_objmgr_pdev *pdev, 163 uint16_t chan_freq); 164 #endif 165 166 /** 167 * utils_dfs_cancel_precac_timer() - Cancel the precac timer. 168 * @pdev: Pointer to DFS pdev object. 169 * 170 * wrapper function for dfs_cancel_precac_timer(). this function called from 171 * outside of dfs component. 172 */ 173 QDF_STATUS utils_dfs_cancel_precac_timer(struct wlan_objmgr_pdev *pdev); 174 175 /** 176 * utils_dfs_start_precac_timer() - Start the precac timer. 177 * @pdev: Pointer to DFS pdev object. 178 * 179 * Wrapper function for dfs_start_precac_timer(). This function called from 180 * outside of dfs component. 181 * 182 * Return: 183 * * QDF_STATUS_E_FAILURE: Failed to start timer. 184 * * QDF_STATUS_SUCCESS: Timer started successfully. 185 */ 186 QDF_STATUS utils_dfs_start_precac_timer(struct wlan_objmgr_pdev *pdev); 187 188 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT 189 /** 190 * utils_dfs_precac_decide_pref_chan() - Choose preferred channel 191 * @pdev: Pointer to DFS pdev object. 192 * @ch_ieee: Pointer to channel number. 193 * @mode: Configured PHY mode. 194 * 195 * Wrapper function for dfs_decide_precac_preferred_chan(). This 196 * function called from outside of dfs component. 197 * 198 * Return: True if intermediate channel needs to configure. False otherwise. 199 */ 200 #ifdef CONFIG_CHAN_NUM_API 201 bool 202 utils_dfs_precac_decide_pref_chan(struct wlan_objmgr_pdev *pdev, 203 uint8_t *ch_ieee, 204 enum wlan_phymode mode); 205 #endif 206 207 /** 208 * utils_dfs_precac_decide_pref_chan() - Choose preferred channel 209 * @pdev: Pointer to DFS pdev object. 210 * @ch_freq: Pointer to channel frequency. 211 * @mode: Configured PHY mode. 212 * 213 * Wrapper function for dfs_decide_precac_preferred_chan(). This 214 * function called from outside of dfs component. 215 * 216 * Return: True if intermediate channel needs to configure. False otherwise. 217 */ 218 #ifdef CONFIG_CHAN_FREQ_API 219 bool 220 utils_dfs_precac_decide_pref_chan_for_freq(struct wlan_objmgr_pdev *pdev, 221 uint16_t *ch_freq, 222 enum wlan_phymode mode); 223 #endif 224 #endif 225 226 /** 227 * utils_dfs_cancel_cac_timer() - Cancels the CAC timer. 228 * @pdev: Pointer to DFS pdev object. 229 * 230 * wrapper function for dfs_cancel_cac_timer(). this 231 * function called from outside of dfs component. 232 */ 233 QDF_STATUS utils_dfs_cancel_cac_timer(struct wlan_objmgr_pdev *pdev); 234 235 /** 236 * utils_dfs_start_cac_timer() - Starts the CAC timer. 237 * @pdev: Pointer to DFS pdev object. 238 * 239 * wrapper function for dfs_start_cac_timer(). this 240 * function called from outside of dfs component. 241 */ 242 QDF_STATUS utils_dfs_start_cac_timer(struct wlan_objmgr_pdev *pdev); 243 244 /** 245 * utils_dfs_cac_stop() - Clear the AP CAC timer. 246 * @pdev: Pointer to DFS pdev object. 247 * 248 * wrapper function for dfs_cac_stop(). this 249 * function called from outside of dfs component. 250 */ 251 QDF_STATUS utils_dfs_cac_stop(struct wlan_objmgr_pdev *pdev); 252 253 /** 254 * utils_dfs_stacac_stop() - Clear the STA CAC timer. 255 * @pdev: Pointer to DFS pdev object. 256 * 257 * wrapper function for dfs_stacac_stop(). this 258 * function called from outside of dfs component. 259 */ 260 QDF_STATUS utils_dfs_stacac_stop(struct wlan_objmgr_pdev *pdev); 261 262 /** 263 * utils_dfs_get_usenol() - Returns use_nol flag. 264 * @pdev: Pointer to DFS pdev object. 265 * @usenol: Pointer to usenol value. 266 * 267 * wrapper function for dfs_get_usenol(). this 268 * function called from outside of dfs component. 269 */ 270 QDF_STATUS utils_dfs_get_usenol(struct wlan_objmgr_pdev *pdev, 271 uint16_t *usenol); 272 273 /** 274 * utils_dfs_radar_disable() - Disables the radar. 275 * @pdev: Pointer to DFS pdev object. 276 * 277 * wrapper function for dfs_radar_disable(). this 278 * function called from outside of dfs component. 279 */ 280 QDF_STATUS utils_dfs_radar_disable(struct wlan_objmgr_pdev *pdev); 281 282 /** 283 * utils_dfs_set_update_nol_flag() - Sets update_nol flag. 284 * @pdev: Pointer to DFS pdev object. 285 * @val: update_nol flag. 286 * 287 * wrapper function for dfs_set_update_nol_flag(). this 288 * function called from outside of dfs component. 289 */ 290 QDF_STATUS utils_dfs_set_update_nol_flag(struct wlan_objmgr_pdev *pdev, 291 bool val); 292 293 /** 294 * utils_dfs_get_update_nol_flag() - Returns update_nol flag. 295 * @pdev: Pointer to DFS pdev object. 296 * @nol_flag: Fill nol_flag in this variable. 297 * 298 * wrapper function for dfs_get_update_nol_flag(). this 299 * function called from outside of dfs component. 300 */ 301 QDF_STATUS utils_dfs_get_update_nol_flag(struct wlan_objmgr_pdev *pdev, 302 bool *nol_flag); 303 304 /** 305 * utils_dfs_get_dfs_use_nol() - Get usenol. 306 * @pdev: Pointer to DFS pdev object. 307 * @dfs_use_nol: Pointer to dfs_use_nol. 308 * 309 * wrapper function for dfs_get_dfs_use_nol(). this 310 * function called from outside of dfs component. 311 */ 312 QDF_STATUS utils_dfs_get_dfs_use_nol(struct wlan_objmgr_pdev *pdev, 313 int *dfs_use_nol); 314 315 /** 316 * utils_dfs_get_nol_timeout() - Get NOL timeout. 317 * @pdev: Pointer to DFS pdev object. 318 * @dfs_nol_timeout: Pointer to dfs_nol_timeout. 319 * 320 * wrapper function for dfs_get_nol_timeout(). this 321 * function called from outside of dfs component. 322 */ 323 QDF_STATUS utils_dfs_get_nol_timeout(struct wlan_objmgr_pdev *pdev, 324 int *dfs_nol_timeout); 325 326 /** 327 * utils_dfs_nol_addchan() - Add channel to NOL. 328 * @pdev: Pointer to DFS pdev object. 329 * @chan: channel t o add NOL. 330 * @dfs_nol_timeout: NOL timeout. 331 * 332 * wrapper function for dfs_nol_addchan(). this 333 * function called from outside of dfs component. 334 */ 335 QDF_STATUS utils_dfs_nol_addchan(struct wlan_objmgr_pdev *pdev, 336 uint16_t freq, 337 uint32_t dfs_nol_timeout); 338 339 /** 340 * utils_dfs_nol_update() - NOL update 341 * @pdev: Pointer to DFS pdev object. 342 * 343 * wrapper function for dfs_nol_update(). this 344 * function called from outside of dfs component. 345 */ 346 QDF_STATUS utils_dfs_nol_update(struct wlan_objmgr_pdev *pdev); 347 348 /** 349 * utils_dfs_second_segment_radar_disable() - Disables the second segment radar. 350 * @pdev: Pointer to DFS pdev object. 351 * 352 * This is called when AP detects the radar, to (potentially) disable 353 * the radar code. 354 */ 355 QDF_STATUS utils_dfs_second_segment_radar_disable( 356 struct wlan_objmgr_pdev *pdev); 357 358 /** 359 * utils_dfs_fetch_nol_ie_info() - Fills the arguments with NOL information 360 * needed for sending RCSA. 361 * pdev: Pointer to DFS pdev object. 362 * nol_ie_bandwidth: Minimum DFS subchannel Bandwidth. 363 * nol_ie_startfreq: Radar affected channel list start subchannel's centre 364 * frequency. 365 * nol_ie_bitmap: Bitmap of radar affected subchannels. 366 */ 367 QDF_STATUS utils_dfs_fetch_nol_ie_info(struct wlan_objmgr_pdev *pdev, 368 uint8_t *nol_ie_bandwidth, 369 uint16_t *nol_ie_startfreq, 370 uint8_t *nol_ie_bitmap); 371 372 /** 373 * utils_dfs_set_rcsa_flags() - Set flags that are required for sending 374 * RCSA and NOL IE. 375 * pdev: Pointer to DFS pdev object. 376 * is_rcsa_ie_sent: Boolean to check if RCSA IE should be sent or not. 377 * is_nol_ie_sent: Boolean to check if NOL IE should be sent or not. 378 */ 379 380 QDF_STATUS utils_dfs_set_rcsa_flags(struct wlan_objmgr_pdev *pdev, 381 bool is_rcsa_ie_sent, 382 bool is_nol_ie_sent); 383 384 /** 385 * utils_dfs_get_rcsa_flags() - Get flags that are required for sending 386 * RCSA and NOL IE. 387 * pdev: Pointer to DFS pdev object. 388 * is_rcsa_ie_sent: Boolean to check if RCSA IE should be sent or not. 389 * is_nol_ie_sent: Boolean to check if NOL IE should be sent or not. 390 */ 391 392 QDF_STATUS utils_dfs_get_rcsa_flags(struct wlan_objmgr_pdev *pdev, 393 bool *is_rcsa_ie_sent, 394 bool *is_nol_ie_sent); 395 396 /** 397 * utils_dfs_process_nol_ie_bitmap() - Update NOL with external radar 398 * information. 399 * pdev: Pointer to DFS pdev object. 400 * nol_ie_bandwidth: Minimum DFS subchannel Bandwidth. 401 * nol_ie_startfreq: Radar affected channel list start channel's 402 * centre frequency. 403 * nol_ie_bitmap: Bitmap of radar affected subchannels. 404 * 405 * Return: True if NOL IE should be propagated, else false. 406 */ 407 bool utils_dfs_process_nol_ie_bitmap(struct wlan_objmgr_pdev *pdev, 408 uint8_t nol_ie_bandwidth, 409 uint16_t nol_ie_startfreq, 410 uint8_t nol_ie_bitmap); 411 412 /** 413 * utils_dfs_bw_reduce() - Set bw reduce. 414 * @pdev: Pointer to DFS pdev object. 415 * @bw_reduce: Fill bw_reduce value in this variable. 416 * 417 * Return: QDF_STATUS 418 */ 419 QDF_STATUS utils_dfs_bw_reduce(struct wlan_objmgr_pdev *pdev, 420 bool bw_reduce); 421 422 /** 423 * utils_dfs_is_bw_reduce() - Get bw reduce. 424 * @pdev: Pointer to DFS pdev object. 425 * @bw_reduce: Pointer to get bw_reduce value. 426 * 427 * Return: QDF_STATUS 428 */ 429 QDF_STATUS utils_dfs_is_bw_reduce(struct wlan_objmgr_pdev *pdev, 430 bool *bw_reduce); 431 /** 432 * utils_dfs_set_cac_timer_running() - Sets the cac timer running. 433 * @pdev: Pointer to DFS pdev object. 434 * @val: Set this value to dfs_cac_timer_running variable. 435 */ 436 QDF_STATUS utils_dfs_set_cac_timer_running(struct wlan_objmgr_pdev *pdev, 437 int val); 438 439 /** 440 * utils_dfs_get_nol_chfreq_and_chwidth() - Sets the cac timer running. 441 * @pdev: Pointer to DFS pdev object. 442 * @nollist: Pointer to NOL channel entry. 443 * @nol_chfreq: Pointer to save channel frequency. 444 * @nol_chwidth: Pointer to save channel width. 445 * @index: Index into nol list. 446 */ 447 QDF_STATUS utils_dfs_get_nol_chfreq_and_chwidth(struct wlan_objmgr_pdev *pdev, 448 void *nollist, 449 uint32_t *nol_chfreq, 450 uint32_t *nol_chwidth, 451 int index); 452 453 /** 454 * utils_dfs_get_random_channel() - Get random channel. 455 * @pdev: Pointer to DFS pdev object. 456 * @flags: random channel selection flags. 457 * @ch_params: current channel params. 458 * @hw_mode: current operating mode. 459 * @target_chan: Pointer to target_chan. 460 * @acs_info: acs range info. 461 * 462 * wrapper function for get_random_chan(). this 463 * function called from outside of dfs component. 464 * 465 * Return: QDF_STATUS 466 */ 467 #ifdef CONFIG_CHAN_NUM_API 468 QDF_STATUS utils_dfs_get_random_channel(struct wlan_objmgr_pdev *pdev, 469 uint16_t flags, struct ch_params *ch_params, 470 uint32_t *hw_mode, uint8_t *target_chan, 471 struct dfs_acs_info *acs_info); 472 #endif 473 474 /** 475 * utils_dfs_get_random_channel() - Get random channel. 476 * @pdev: Pointer to DFS pdev object. 477 * @flags: random channel selection flags. 478 * @ch_params: current channel params. 479 * @hw_mode: current operating mode. 480 * @target_chan: Pointer to target_chan freq. 481 * @acs_info: acs range info. 482 * 483 * wrapper function for get_random_chan(). this 484 * function called from outside of dfs component. 485 * 486 * Return: QDF_STATUS 487 */ 488 #ifdef CONFIG_CHAN_FREQ_API 489 QDF_STATUS 490 utils_dfs_get_random_channel_for_freq(struct wlan_objmgr_pdev *pdev, 491 uint16_t flags, 492 struct ch_params *ch_params, 493 uint32_t *hw_mode, uint16_t *target_chan, 494 struct dfs_acs_info *acs_info); 495 #endif 496 497 /** 498 * utils_dfs_get_vdev_random_channel() - Get random channel for vdev 499 * @pdev: Pointer to DFS pdev object. 500 * @vdev: vdev of the request 501 * @flags: random channel selection flags. 502 * @ch_params: current channel params. 503 * @hw_mode: current operating mode. 504 * @target_chan: Pointer to target_chan. 505 * @acs_info: acs range info. 506 * 507 * Get random channel based on vdev interface type. If the vdev is null, 508 * the function will get random channel by SAP interface type. 509 * 510 * Return: QDF_STATUS 511 */ 512 #ifdef CONFIG_CHAN_NUM_API 513 QDF_STATUS utils_dfs_get_vdev_random_channel( 514 struct wlan_objmgr_pdev *pdev, struct wlan_objmgr_vdev *vdev, 515 uint16_t flags, struct ch_params *ch_params, uint32_t *hw_mode, 516 uint8_t *target_chan, struct dfs_acs_info *acs_info); 517 #endif 518 519 /** 520 * utils_dfs_get_vdev_random_channel() - Get random channel for vdev 521 * @pdev: Pointer to DFS pdev object. 522 * @vdev: vdev of the request 523 * @flags: random channel selection flags. 524 * @ch_params: current channel params. 525 * @hw_mode: current operating mode. 526 * @target_chan: Pointer to target_chan_freq. 527 * @acs_info: acs range info. 528 * 529 * Get random channel based on vdev interface type. If the vdev is null, 530 * the function will get random channel by SAP interface type. 531 * 532 * Return: QDF_STATUS 533 */ 534 535 #ifdef CONFIG_CHAN_FREQ_API 536 QDF_STATUS utils_dfs_get_vdev_random_channel_for_freq( 537 struct wlan_objmgr_pdev *pdev, struct wlan_objmgr_vdev *vdev, 538 uint16_t flags, struct ch_params *ch_params, uint32_t *hw_mode, 539 uint16_t *target_chan_freq, struct dfs_acs_info *acs_info); 540 #endif 541 542 /** 543 * utils_dfs_bw_reduced_channel() - Get BW reduced channel. 544 * @pdev: Pointer to DFS pdev object. 545 * @ch_params: current channel params. 546 * @hw_mode: current operating mode. 547 * @target_chan: Pointer to target_chan. 548 * 549 * wrapper function for get bw_reduced_channel. this 550 * function called from outside of dfs component. 551 * 552 * Return: QDF_STATUS 553 */ 554 #ifdef CONFIG_CHAN_NUM_API 555 QDF_STATUS utils_dfs_bw_reduced_channel(struct wlan_objmgr_pdev *pdev, 556 struct ch_params *ch_params, 557 uint32_t *hw_mode, 558 uint8_t *target_chan); 559 #endif 560 561 /** 562 * utils_dfs_bw_reduced_channel_for_freq() - Get BW reduced channel. 563 * @pdev: Pointer to DFS pdev object. 564 * @ch_params: current channel params. 565 * @hw_mode: current operating mode. 566 * @target_chan: Pointer to target_chan freq. 567 * 568 * wrapper function for get bw_reduced_channel. this 569 * function called from outside of dfs component. 570 * 571 * Return: QDF_STATUS 572 */ 573 #ifdef CONFIG_CHAN_FREQ_API 574 QDF_STATUS utils_dfs_bw_reduced_channel_for_freq(struct wlan_objmgr_pdev *pdev, 575 struct ch_params *ch_params, 576 uint32_t *hw_mode, 577 uint16_t *target_chan_freq); 578 #endif 579 580 /** 581 * utils_dfs_init_nol() - Initialize nol from platform driver. 582 * @pdev: pdev handler. 583 * 584 * Initialize nol from platform driver. 585 * 586 * Return: None 587 */ 588 #ifdef QCA_DFS_NOL_PLATFORM_DRV_SUPPORT 589 void utils_dfs_init_nol(struct wlan_objmgr_pdev *pdev); 590 #else 591 static inline void utils_dfs_init_nol(struct wlan_objmgr_pdev *pdev) 592 { 593 } 594 #endif 595 /** 596 * utils_dfs_save_nol() - save nol list to platform driver. 597 * @pdev: pdev handler. 598 * 599 * Save nol list to platform driver. 600 * 601 * Return: None 602 */ 603 void utils_dfs_save_nol(struct wlan_objmgr_pdev *pdev); 604 605 /** 606 * utils_dfs_print_nol_channels() - log nol channels. 607 * @pdev: pdev handler. 608 * 609 * log nol channels. 610 * 611 * Return: None 612 */ 613 #ifdef DFS_COMPONENT_ENABLE 614 void utils_dfs_print_nol_channels(struct wlan_objmgr_pdev *pdev); 615 #else 616 static inline void utils_dfs_print_nol_channels(struct wlan_objmgr_pdev *pdev) 617 { 618 } 619 #endif 620 621 /** 622 * utils_dfs_clear_nol_channels() - clear nol list. 623 * @pdev: pdev handler. 624 * 625 * log nol channels. 626 * 627 * Return: None 628 */ 629 void utils_dfs_clear_nol_channels(struct wlan_objmgr_pdev *pdev); 630 631 /** 632 * utils_is_dfs_chan_for_freq() - is channel dfs. 633 * @pdev: pdev handler. 634 * @chan_freq: Channel frequency in MHZ. 635 * 636 * is channel dfs. 637 * 638 * Return: True if channel dfs, else false. 639 */ 640 #ifdef CONFIG_CHAN_FREQ_API 641 static inline bool utils_is_dfs_chan_for_freq(struct wlan_objmgr_pdev *pdev, 642 uint32_t chan_freq) 643 { 644 return wlan_reg_is_dfs_for_freq(pdev, chan_freq); 645 } 646 #endif 647 648 /** 649 * utils_is_dfs_ch() - is channel dfs. 650 * @pdev: pdev handler. 651 * 652 * is channel dfs. 653 * 654 * Return: True if channel dfs, else false. 655 */ 656 #ifdef CONFIG_CHAN_NUM_API 657 static inline bool utils_is_dfs_ch(struct wlan_objmgr_pdev *pdev, uint32_t chan) 658 { 659 return wlan_reg_is_dfs_ch(pdev, chan); 660 } 661 #endif 662 663 /** 664 * utils_is_dfs_cfreq2_ch() - is channel dfs cfreq2. 665 * @pdev: pdev handler. 666 * 667 * is channel dfs. 668 * 669 * Return: True if channel dfs cfreq2, else false. 670 */ 671 #if defined(WLAN_DFS_FULL_OFFLOAD) && defined(QCA_DFS_NOL_OFFLOAD) 672 bool utils_is_dfs_cfreq2_ch(struct wlan_objmgr_pdev *pdev); 673 #else 674 static inline 675 bool utils_is_dfs_cfreq2_ch(struct wlan_objmgr_pdev *pdev) 676 { 677 return false; 678 } 679 #endif 680 681 /** 682 * utils_dfs_reg_update_nol_ch() - set nol channel 683 * 684 * @pdev: pdev ptr 685 * @ch_list: channel list to be returned 686 * @num_ch: number of channels 687 * @nol_ch: nol flag 688 * 689 * Return: void 690 */ 691 #ifdef CONFIG_CHAN_NUM_API 692 void utils_dfs_reg_update_nol_ch(struct wlan_objmgr_pdev *pdev, 693 uint8_t *ch_list, 694 uint8_t num_ch, 695 bool nol_ch); 696 #endif 697 698 /** 699 * utils_dfs_reg_update_nol_chan_for_freq() - set nol channel 700 * 701 * @pdev: pdev ptr 702 * @ch_list: freq channel list to be returned 703 * @num_ch: number of channels 704 * @nol_ch: nol flag 705 * 706 * Return: void 707 */ 708 #ifdef CONFIG_CHAN_FREQ_API 709 void utils_dfs_reg_update_nol_chan_for_freq(struct wlan_objmgr_pdev *pdev, 710 uint16_t *ch_list, 711 uint8_t num_ch, 712 bool nol_ch); 713 #endif 714 /** 715 * utils_dfs_freq_to_chan () - convert channel freq to channel number 716 * @freq: frequency 717 * 718 * Return: channel number 719 */ 720 uint8_t utils_dfs_freq_to_chan(uint32_t freq); 721 722 /** 723 * utils_dfs_chan_to_freq () - convert channel number to frequency 724 * @chan: channel number 725 * 726 * Return: frequency 727 */ 728 #ifdef DFS_COMPONENT_ENABLE 729 uint32_t utils_dfs_chan_to_freq(uint8_t chan); 730 #else 731 static inline uint32_t utils_dfs_chan_to_freq(uint8_t chan) 732 { 733 return 0; 734 } 735 #endif 736 /** 737 * utils_dfs_update_cur_chan_flags() - Update DFS channel flag and flagext. 738 * @pdev: Pointer to DFS pdev object. 739 * @flags: New channel flags 740 * @flagext: New Extended flags 741 * 742 * Return: QDF_STATUS 743 */ 744 QDF_STATUS utils_dfs_update_cur_chan_flags(struct wlan_objmgr_pdev *pdev, 745 uint64_t flags, 746 uint16_t flagext); 747 748 #ifdef QCA_MCL_DFS_SUPPORT 749 /** 750 * utils_dfs_mark_leaking_ch() - to mark channel leaking in to nol 751 * @pdev: Pointer to pdev structure. 752 * @ch_width: channel width 753 * @temp_ch_lst_sz: the target channel list 754 * @temp_ch_lst: the target channel list 755 * 756 * This function removes the channels from temp channel list that 757 * (if selected as target channel) will cause leakage in one of 758 * the NOL channels 759 * 760 * Return: QDF_STATUS 761 */ 762 #ifdef CONFIG_CHAN_NUM_API 763 QDF_STATUS utils_dfs_mark_leaking_ch(struct wlan_objmgr_pdev *pdev, 764 enum phy_ch_width ch_width, 765 uint8_t temp_ch_lst_sz, 766 uint8_t *temp_ch_lst); 767 #endif 768 /** 769 * utils_dfs_mark_leaking_chan_for_freq() - to mark channel leaking in to nol 770 * @pdev: Pointer to pdev structure. 771 * @ch_width: channel width 772 * @temp_ch_lst_sz: the target channel list 773 * @temp_ch_lst: the target frequency list 774 * 775 * This function removes the channels from temp channel list that 776 * (if selected as target channel) will cause leakage in one of 777 * the NOL channels 778 * 779 * Return: QDF_STATUS 780 */ 781 #ifdef CONFIG_CHAN_FREQ_API 782 QDF_STATUS utils_dfs_mark_leaking_chan_for_freq(struct wlan_objmgr_pdev *pdev, 783 enum phy_ch_width ch_width, 784 uint8_t temp_ch_lst_sz, 785 uint16_t *temp_ch_lst); 786 #endif 787 #else 788 #ifdef CONFIG_CHAN_NUM_API 789 static inline QDF_STATUS utils_dfs_mark_leaking_ch 790 (struct wlan_objmgr_pdev *pdev, 791 enum phy_ch_width ch_width, 792 uint8_t temp_ch_lst_sz, 793 uint8_t *temp_ch_lst) 794 { 795 return QDF_STATUS_SUCCESS; 796 } 797 #endif 798 #ifdef CONFIG_CHAN_FREQ_API 799 static inline QDF_STATUS utils_dfs_mark_leaking_chan_for_freq 800 (struct wlan_objmgr_pdev *pdev, 801 enum phy_ch_width ch_width, 802 uint8_t temp_ch_lst_sz, 803 uint16_t *temp_ch_lst) 804 { 805 return QDF_STATUS_SUCCESS; 806 } 807 #endif 808 #endif 809 /** 810 * utils_get_dfsdomain() - Get DFS domain. 811 * @pdev: Pointer to PDEV structure. 812 * 813 * Return: DFS domain. 814 */ 815 int utils_get_dfsdomain(struct wlan_objmgr_pdev *pdev); 816 817 /** 818 * utils_dfs_get_cur_rd() - Get current regdomain. 819 * @pdev: pdev ptr 820 * 821 * Return: Regdomain pair id. 822 */ 823 uint16_t utils_dfs_get_cur_rd(struct wlan_objmgr_pdev *pdev); 824 825 /** 826 * utils_dfs_is_spoof_check_failed() - get spoof check status. 827 * @pdev: pdev ptr 828 * @is_spoof_check_failed: pointer containing the status. 829 * 830 * Return: QDF_STATUS. 831 */ 832 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) 833 QDF_STATUS utils_dfs_is_spoof_check_failed(struct wlan_objmgr_pdev *pdev, 834 bool *is_spoof_check_failed); 835 #else 836 static inline 837 QDF_STATUS utils_dfs_is_spoof_check_failed(struct wlan_objmgr_pdev *pdev, 838 bool *is_spoof_check_failed) 839 { 840 return QDF_STATUS_SUCCESS; 841 } 842 #endif 843 844 /** 845 * dfs_get_num_chans() - Get the number of channels supported by the regulatory. 846 * 847 * Return: Number of supported channels. 848 */ 849 int dfs_get_num_chans(void); 850 851 /** 852 * utils_dfs_get_chan_list() - Get channel list from regdb. 853 * @pdev: Pointer to DFS pdev object. 854 * @clist: Pointer to current channel list 855 * @num_chan: number of channels in the current channel list. 856 */ 857 void utils_dfs_get_chan_list(struct wlan_objmgr_pdev *pdev, 858 void *clist, 859 uint32_t *num_chan); 860 861 /** 862 * utils_dfs_get_nol_history_chan_list() - Get nol_history channels from regdb 863 * component. 864 * @pdev: Pointer to pdev structure. 865 * @clist: Pointer to channel list. 866 * @num_chan: number of channels. 867 */ 868 void utils_dfs_get_nol_history_chan_list(struct wlan_objmgr_pdev *pdev, 869 void *clist, uint32_t *num_chan); 870 871 /** 872 * utils_dfs_reg_update_nol_history_ch() - set nol history channel 873 * 874 * @pdev: pdev ptr 875 * @ch_list: channel list to be returned 876 * @num_ch: number of channels 877 * @nol_history_ch: nol history flag 878 * 879 * Return: void 880 */ 881 #ifdef CONFIG_CHAN_NUM_API 882 void utils_dfs_reg_update_nol_history_ch(struct wlan_objmgr_pdev *pdev, 883 uint8_t *ch_list, 884 uint8_t num_ch, 885 bool nol_history_ch); 886 #endif 887 888 /** 889 * utils_dfs_reg_update_nol_history_chan_for_freq() - set nol history channel 890 * 891 * @pdev: pdev ptr 892 * @ch_list: freq channel list to be returned 893 * @num_ch: number of channels 894 * @nol_history_ch: nol history flag 895 * 896 * Return: void 897 */ 898 #ifdef CONFIG_CHAN_FREQ_API 899 void utils_dfs_reg_update_nol_history_chan_for_freq(struct wlan_objmgr_pdev *, 900 uint16_t *freq_list, 901 uint8_t num_ch, 902 bool nol_history_ch); 903 #endif 904 905 /** 906 * utils_dfs_is_cac_required() - Check if CAC is required on the cur_chan. 907 * @pdev: pdev ptr 908 * @cur_chan: Pointer to current channel of wlan_channel structure. 909 * @prev_chan: Pointer to previous channel of wlan_channel structure. 910 * @continue_current_cac: If AP can start CAC then this variable indicates 911 * whether to continue with the current CAC or restart the CAC. This variable 912 * is valid only if this function returns true. 913 * 914 * Return: true if AP requires CAC or can continue current CAC, else false. 915 */ 916 bool utils_dfs_is_cac_required(struct wlan_objmgr_pdev *pdev, 917 struct wlan_channel *cur_chan, 918 struct wlan_channel *prev_chan, 919 bool *continue_current_cac); 920 921 /** 922 * utils_dfs_is_cac_required_on_dfs_curchan() - Check if CAC is required on the 923 * dfs_curchan. 924 * @pdev: pdev ptr 925 * @continue_current_cac: If AP can start CAC then this variable indicates 926 * whether to continue with the current CAC or restart the CAC. This variable 927 * is valid only if this function returns true. 928 * 929 * This API checks if the dfs_curchan is a subset of the dfs_prevchan. 930 * dfs_curchan and dfs_prevchan are updated after start response by 931 * dfs_set_current_channel(). 932 * 933 * Return: true if AP requires CAC or can continue current CAC, else false. 934 */ 935 bool 936 utils_dfs_is_cac_required_on_dfs_curchan(struct wlan_objmgr_pdev *pdev, 937 bool *continue_current_cac); 938 939 /** utils_dfs_is_precac_done() - Check if precac has been done in chosen channel 940 * @pdev: Pointer to DFS pdev object. 941 * @wlan_chan: Pointer to wlan channel object that can be accessed by other 942 * components. 943 * Wrapper function for dfs_is_precac_done(). This API is called from outside 944 * the dfs component. 945 * 946 * Return: 947 * * True :If precac is done on channel. 948 * * False:If precac is not done on channel. 949 */ 950 bool utils_dfs_is_precac_done(struct wlan_objmgr_pdev *pdev, 951 struct wlan_channel *wlan_chan); 952 /** 953 * utils_dfs_get_disable_radar_marking() - Retrieve the value of disable radar. 954 * marking. 955 * @pdev: Pointer to DFS pdev object. 956 * @dis_radar_marking: pointer to retrieve the value of disable_radar_marking. 957 */ 958 #if defined(WLAN_DFS_FULL_OFFLOAD) && defined(QCA_DFS_NOL_OFFLOAD) 959 QDF_STATUS utils_dfs_get_disable_radar_marking(struct wlan_objmgr_pdev *pdev, 960 bool *disable_radar_marking); 961 #else 962 static inline 963 QDF_STATUS utils_dfs_get_disable_radar_marking(struct wlan_objmgr_pdev *pdev, 964 bool *disable_radar_marking) 965 { 966 return QDF_STATUS_SUCCESS; 967 } 968 #endif 969 970 /** 971 * utils_dfs_deliver_event() - Deliver DFS event to userspace. 972 * @pdev: Pointer to DFS pdev object 973 * @chan: channel radar hit on 974 * @event: event being sent 975 */ 976 void utils_dfs_deliver_event(struct wlan_objmgr_pdev *pdev, uint16_t freq, 977 enum WLAN_DFS_EVENTS event); 978 979 /** 980 * utils_dfs_reset_dfs_prevchan() - Reset DFS previous channel structure. 981 * @pdev: Pointer to DFS pdev object. 982 * 983 * Return: None. 984 */ 985 void utils_dfs_reset_dfs_prevchan(struct wlan_objmgr_pdev *pdev); 986 #endif /* _WLAN_DFS_UTILS_API_H_ */ 987