1 /* 2 * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. 4 * Copyright (c) 2007-2008 Sam Leffler, Errno Consulting 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 */ 27 28 /** 29 * DOC: This file has Zero CAC DFS APIs. 30 */ 31 32 #ifndef _DFS_ZERO_CAC_H_ 33 #define _DFS_ZERO_CAC_H_ 34 35 #include "dfs.h" 36 #include <wlan_dfs_tgt_api.h> 37 38 #define OCAC_SUCCESS 0 39 #define OCAC_RESET 1 40 #define OCAC_CANCEL 2 41 42 #ifdef WLAN_FEATURE_11BE 43 #define TREE_DEPTH_320 5 44 #define TREE_DEPTH_MAX TREE_DEPTH_320 45 #else 46 #define TREE_DEPTH_MAX TREE_DEPTH_160 47 #endif 48 49 #define TREE_DEPTH_160 4 50 #define TREE_DEPTH_80 3 51 #define TREE_DEPTH_40 2 52 #define TREE_DEPTH_20 1 53 #define N_SUBCHANS_FOR_80BW 4 54 #define N_SUBCHANS_FOR_160BW 8 55 56 #define INITIAL_20_CHAN_OFFSET -6 57 #define INITIAL_40_CHAN_OFFSET -4 58 #define INITIAL_80_CHAN_OFFSET 0 59 60 #define NEXT_20_CHAN_OFFSET 4 61 #define NEXT_40_CHAN_OFFSET 8 62 #define NEXT_80_CHAN_OFFSET 16 63 64 #define DFS_CHWIDTH_20_VAL 20 65 #define DFS_CHWIDTH_40_VAL 40 66 #define DFS_CHWIDTH_80_VAL 80 67 #define DFS_CHWIDTH_160_VAL 160 68 #define DFS_CHWIDTH_165_VAL 165 69 #define DFS_CHWIDTH_240_VAL 240 70 #define DFS_CHWIDTH_320_VAL 320 71 72 #define WEATHER_CHAN_START 120 73 #define WEATHER_CHAN_END 128 74 75 /* PreCAC timeout durations in ms. */ 76 #define MIN_PRECAC_DURATION (6 * 60 * 1000) /* 6 mins */ 77 #define MIN_WEATHER_PRECAC_DURATION (60 * 60 * 1000) /* 1 hour */ 78 #define MAX_PRECAC_DURATION (4 * 60 * 60 * 1000) /* 4 hours */ 79 #define MAX_WEATHER_PRECAC_DURATION (24 * 60 * 60 * 1000) /* 24 hours */ 80 #define MIN_RCAC_DURATION (62 * 1000) /* 62 seconds */ 81 #define MAX_RCAC_DURATION 0xffffffff 82 83 #define PCAC_DFS_INDEX_ZERO 0 84 #define PCAC_TIMER_NOT_RUNNING 0 85 #define PRECAC_NOT_STARTED 0 86 87 /* While building precac tree, the center of the 165MHz channel or the 88 * restricted 80p80 channel(which includes channels 132, 136, 140, 144, 89 * 149, 153, 157 and 161) is assumed to be 146(center channel) or 90 * 5730(center frequency). 91 */ 92 #define RESTRICTED_80P80_CHAN_CENTER_FREQ 5730 93 #define RESTRICTED_80P80_LEFT_80_CENTER_CHAN 138 94 #define RESTRICTED_80P80_RIGHT_80_CENTER_CHAN 155 95 #define RESTRICTED_80P80_LEFT_80_CENTER_FREQ 5690 96 #define RESTRICTED_80P80_RIGHT_80_CENTER_FREQ 5775 97 98 /* While building the precac tree with 320 MHz root, the center of the 99 * right side 160 MHz channel(which includes real IEEE channels 132, 136, 100 * 140, 144 and pseudo IEEE channels 148, 152, 156, 160) 101 */ 102 #define CENTER_OF_320_MHZ 5650 103 #define CENTER_OF_PSEUDO_160 5730 104 #define LAST_20_CENTER_OF_FIRST_160 5320 105 #define FIRST_20_CENTER_OF_LAST_80 5745 106 107 /* Depth of the tree of a given bandwidth. */ 108 #define DEPTH_320_ROOT 0 109 #define DEPTH_160_ROOT 1 110 #define DEPTH_80_ROOT 2 111 #define DEPTH_40_ROOT 3 112 #define DEPTH_20_ROOT 4 113 114 #ifdef QCA_DFS_BW_EXPAND 115 /* Column of the phymode_decoupler array */ 116 enum phymode_decoupler_col { 117 CH_WIDTH_COL = 1 118 }; 119 #endif /* QCA_DFS_BW_EXPAND */ 120 121 /** 122 * struct precac_tree_node - Individual tree node structure for every node in 123 * the precac forest maintained. 124 * @left_child: Pointer to the left child of the node. 125 * @right_child: Pointer to the right child of the node. 126 * @ch_ieee: Center channel ieee value. 127 * @ch_freq: Center channel frequency value (BSTree node key value). 128 * @n_caced_subchs: Number of CACed subchannels of the ch_ieee. 129 * @n_nol_subchs: Number of subchannels of the ch_ieee in NOL. 130 * @n_valid_subchs: Number of subchannels of the ch_ieee available (as per 131 * the country's channel list). 132 * @bandwidth: Bandwidth of the ch_ieee (in the current node). 133 * @depth: Depth of the precac tree node. 134 */ 135 struct precac_tree_node { 136 struct precac_tree_node *left_child; 137 struct precac_tree_node *right_child; 138 uint8_t ch_ieee; 139 uint8_t n_caced_subchs; 140 uint8_t n_nol_subchs; 141 uint8_t n_valid_subchs; 142 uint8_t depth; 143 uint16_t bandwidth; 144 uint16_t ch_freq; 145 }; 146 147 /** 148 * enum precac_chan_state - Enum for PreCAC state of a channel. 149 * @PRECAC_ERR: Invalid preCAC state. 150 * @PRECAC_REQUIRED: preCAC need to be done on the channel. 151 * @PRECAC_NOW: preCAC is running on the channel. 152 * @PRECAC_DONE: preCAC is done and channel is clear. 153 * @PRECAC_NOL: preCAC is done and radar is detected. 154 */ 155 enum precac_chan_state { 156 PRECAC_ERR = -1, 157 PRECAC_REQUIRED, 158 PRECAC_NOW, 159 PRECAC_DONE, 160 PRECAC_NOL, 161 }; 162 163 /** 164 * struct dfs_precac_entry - PreCAC entry. 165 * @pe_list: PreCAC entry. 166 * @vht80_ch_ieee: VHT80 centre channel IEEE value. 167 * @vht80_ch_freq: VHT80 centre channel frequency value. 168 * @center_ch_ieee: Center channel IEEE value of given bandwidth 20/40/80/ 169 * 160. For 165MHz channel, the value is 146. 170 * @center_ch_freq: Center frequency of given bandwidth 20/40/80/160. For 171 * 165MHz channel, the value is 5730. 172 * @bw: Bandwidth of the precac entry. 173 * @dfs: Pointer to wlan_dfs structure. 174 * @tree_root: Tree root node with 80MHz channel key. 175 * @non_dfs_subch_count: Number of non DFS subchannels in the entry. 176 */ 177 struct dfs_precac_entry { 178 TAILQ_ENTRY(dfs_precac_entry) pe_list; 179 uint8_t vht80_ch_ieee; 180 uint16_t vht80_ch_freq; 181 uint8_t center_ch_ieee; 182 uint16_t center_ch_freq; 183 uint16_t bw; 184 struct wlan_dfs *dfs; 185 struct precac_tree_node *tree_root; 186 uint8_t non_dfs_subch_count; 187 }; 188 189 /** 190 * dfs_zero_cac_timer_init() - Initialize zero-cac timers 191 * @dfs_soc_obj: Pointer to DFS SOC object structure. 192 */ 193 #if defined(ATH_SUPPORT_ZERO_CAC_DFS) && !defined(MOBILE_DFS_SUPPORT) 194 void dfs_zero_cac_timer_init(struct dfs_soc_priv_obj *dfs_soc_obj); 195 #else 196 static inline void 197 dfs_zero_cac_timer_init(struct dfs_soc_priv_obj *dfs_soc_obj) 198 { 199 } 200 #endif 201 /** 202 * dfs_print_precaclists() - Print precac list. 203 * @dfs: Pointer to wlan_dfs structure. 204 */ 205 #if !defined(MOBILE_DFS_SUPPORT) 206 void dfs_print_precaclists(struct wlan_dfs *dfs); 207 #else 208 static inline void dfs_print_precaclists(struct wlan_dfs *dfs) 209 { 210 } 211 #endif 212 213 /** 214 * dfs_reset_precac_lists() - Resets the precac lists. 215 * @dfs: Pointer to wlan_dfs structure. 216 */ 217 #if !defined(MOBILE_DFS_SUPPORT) 218 void dfs_reset_precac_lists(struct wlan_dfs *dfs); 219 #else 220 static inline void dfs_reset_precac_lists(struct wlan_dfs *dfs) 221 { 222 } 223 #endif 224 225 /** 226 * dfs_reset_precaclists() - Clears and initializes precac_list. 227 * @dfs: Pointer to wlan_dfs structure. 228 */ 229 #if !defined(MOBILE_DFS_SUPPORT) 230 void dfs_reset_precaclists(struct wlan_dfs *dfs); 231 #else 232 static inline void dfs_reset_precaclists(struct wlan_dfs *dfs) 233 { 234 } 235 #endif 236 237 /** 238 * dfs_deinit_precac_list() - Clears the precac list. 239 * @dfs: Pointer to wlan_dfs dtructure. 240 */ 241 void dfs_deinit_precac_list(struct wlan_dfs *dfs); 242 243 /** 244 * dfs_zero_cac_detach() - Free zero_cac memory. 245 * @dfs: Pointer to wlan_dfs dtructure. 246 */ 247 #if !defined(MOBILE_DFS_SUPPORT) 248 void dfs_zero_cac_detach(struct wlan_dfs *dfs); 249 #else 250 static inline void dfs_zero_cac_detach(struct wlan_dfs *dfs) 251 { 252 } 253 #endif 254 255 /** 256 * dfs_init_precac_list() - Init precac list. 257 * @dfs: Pointer to wlan_dfs dtructure. 258 */ 259 void dfs_init_precac_list(struct wlan_dfs *dfs); 260 261 #if !defined(MOBILE_DFS_SUPPORT) 262 /** 263 * dfs_start_precac_timer_for_freq() - Start precac timer. 264 * @dfs: Pointer to wlan_dfs structure. 265 * @precac_chan_freq: Frequency to start precac timer. 266 */ 267 #ifdef CONFIG_CHAN_FREQ_API 268 void dfs_start_precac_timer_for_freq(struct wlan_dfs *dfs, 269 uint16_t precac_chan_freq); 270 #endif 271 #else 272 #ifdef CONFIG_CHAN_FREQ_API 273 static inline 274 void dfs_start_precac_timer_for_freq(struct wlan_dfs *dfs, 275 uint16_t precac_chan_freq) 276 { 277 } 278 #endif 279 #endif 280 281 /** 282 * dfs_cancel_precac_timer() - Cancel the precac timer. 283 * @dfs: Pointer to wlan_dfs structure. 284 */ 285 #if !defined(MOBILE_DFS_SUPPORT) 286 void dfs_cancel_precac_timer(struct wlan_dfs *dfs); 287 #else 288 static inline void dfs_cancel_precac_timer(struct wlan_dfs *dfs) 289 { 290 } 291 #endif 292 293 /** 294 * dfs_zero_cac_attach() - Initialize dfs zerocac variables. 295 * @dfs: Pointer to DFS structure. 296 */ 297 #if !defined(MOBILE_DFS_SUPPORT) 298 void dfs_zero_cac_attach(struct wlan_dfs *dfs); 299 #else 300 static inline void dfs_zero_cac_attach(struct wlan_dfs *dfs) 301 { 302 } 303 #endif 304 305 /** 306 * dfs_zero_cac_reset() - Reset Zero cac DFS variables. 307 * @dfs: Pointer to wlan_dfs structure. 308 */ 309 #if !defined(MOBILE_DFS_SUPPORT) 310 void dfs_zero_cac_reset(struct wlan_dfs *dfs); 311 #else 312 static inline void dfs_zero_cac_reset(struct wlan_dfs *dfs) 313 { 314 } 315 #endif 316 317 /** 318 * dfs_zero_cac_timer_detach() - Free Zero cac DFS variables. 319 * @dfs_soc_obj: Pointer to dfs_soc_priv_obj structure. 320 */ 321 #if defined(ATH_SUPPORT_ZERO_CAC_DFS) && !defined(MOBILE_DFS_SUPPORT) 322 void dfs_zero_cac_timer_detach(struct dfs_soc_priv_obj *dfs_soc_obj); 323 #else 324 static inline void 325 dfs_zero_cac_timer_detach(struct dfs_soc_priv_obj *dfs_soc_obj) 326 { 327 } 328 #endif 329 330 /** 331 * dfs_is_precac_done() - Is precac done. 332 * @dfs: Pointer to wlan_dfs structure. 333 * @chan: Pointer to dfs_channel for which preCAC done is checked. 334 * 335 * Return: 336 * * True: If precac is done on channel. 337 * * False: If precac is not done on channel. 338 */ 339 #if !defined(MOBILE_DFS_SUPPORT) 340 bool dfs_is_precac_done(struct wlan_dfs *dfs, struct dfs_channel *chan); 341 #else 342 static inline bool dfs_is_precac_done(struct wlan_dfs *dfs, 343 struct dfs_channel *chan) 344 { 345 return false; 346 } 347 #endif 348 349 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT 350 /** 351 * dfs_decide_precac_preferred_chan_for_freq() - Choose operating channel among 352 * configured DFS channel and 353 * intermediate channel based on 354 * precac status of configured 355 * DFS channel. 356 * @dfs: Pointer to wlan_dfs structure. 357 * @pref_chan: Configured DFS channel frequency 358 * @mode: Configured PHY mode. 359 * 360 * Return: True if intermediate channel needs to configure. False otherwise. 361 */ 362 363 #ifdef CONFIG_CHAN_FREQ_API 364 bool 365 dfs_decide_precac_preferred_chan_for_freq(struct wlan_dfs *dfs, 366 uint16_t *pref_chan_freq, 367 enum wlan_phymode mode); 368 #endif 369 #else 370 #ifdef CONFIG_CHAN_FREQ_API 371 static inline void 372 dfs_decide_precac_preferred_chan_for_freq(struct wlan_dfs *dfs, 373 uint8_t *pref_chan, 374 enum wlan_phymode mode) 375 { 376 } 377 #endif 378 #endif 379 380 /** 381 * dfs_get_ieeechan_for_precac_for_freq() - Get chan of required bandwidth from 382 * precac_list. 383 * @dfs: Pointer to wlan_dfs structure. 384 * @exclude_pri_chan_freq: Primary channel freq to be excluded for preCAC. 385 * @exclude_sec_chan_freq: Secondary channel freq to be excluded for preCAC. 386 * @bandwidth: Bandwidth of requested channel. 387 */ 388 #ifdef CONFIG_CHAN_FREQ_API 389 uint16_t dfs_get_ieeechan_for_precac_for_freq(struct wlan_dfs *dfs, 390 uint16_t exclude_pri_chan_freq, 391 uint16_t exclude_sec_chan_freq, 392 uint8_t bandwidth); 393 #endif 394 395 /** 396 * dfs_override_precac_timeout() - Override the default precac timeout. 397 * @dfs: Pointer to wlan_dfs structure. 398 * @precac_timeout: Precac timeout value. 399 */ 400 #if !defined(MOBILE_DFS_SUPPORT) 401 int dfs_override_precac_timeout(struct wlan_dfs *dfs, 402 int precac_timeout); 403 #else 404 static inline int dfs_override_precac_timeout(struct wlan_dfs *dfs, 405 int precac_timeout) 406 { 407 return 0; 408 } 409 #endif 410 411 /** 412 * dfs_get_override_precac_timeout() - Get precac timeout. 413 * @dfs: Pointer wlan_dfs structure. 414 * @precac_timeout: Get precac timeout value in this variable. 415 */ 416 #if !defined(MOBILE_DFS_SUPPORT) 417 int dfs_get_override_precac_timeout(struct wlan_dfs *dfs, 418 int *precac_timeout); 419 #else 420 static inline int dfs_get_override_precac_timeout(struct wlan_dfs *dfs, 421 int *precac_timeout) 422 { 423 return 0; 424 } 425 #endif 426 427 #if defined(QCA_SUPPORT_AGILE_DFS) 428 /** 429 * dfs_find_pdev_for_agile_precac() - Find pdev to select channel for precac. 430 * @pdev: Pointer to wlan_objmgr_pdev structure. 431 * @cur_agile_dfs_index: current agile dfs index 432 */ 433 void dfs_find_pdev_for_agile_precac(struct wlan_objmgr_pdev *pdev, 434 uint8_t *cur_agile_dfs_index); 435 436 /** 437 * dfs_prepare_agile_precac_chan() - Send Agile set request for given pdev. 438 * @dfs: Pointer to wlan_dfs structure. 439 * @is_chan_found: True if a channel is available for PreCAC, false otherwise. 440 */ 441 void dfs_prepare_agile_precac_chan(struct wlan_dfs *dfs, bool *is_chan_found); 442 443 /** 444 * dfs_process_ocac_complete() - Process Off-Channel CAC complete indication. 445 * @pdev :Pointer to wlan_objmgr_pdev structure. 446 * @ocac_status: Off channel CAC complete status 447 * @center_freq1 : For 20/40/80/160Mhz, it is the center of the corresponding 448 * band. For 80P80/165MHz, it is the center of the left 80MHz. 449 * @center_freq2 : It is valid and non-zero only for 80P80/165MHz. It indicates 450 * the Center Frequency of the right 80MHz segment. 451 * @chwidth : Width of the channel for which OCAC completion is received. 452 */ 453 void dfs_process_ocac_complete(struct wlan_objmgr_pdev *pdev, 454 uint32_t ocac_status, 455 uint32_t center_freq1, 456 uint32_t center_freq2, 457 enum phy_ch_width chwidth); 458 459 /** 460 * dfs_set_agilecac_chan_for_freq() - Find chan freq for agile CAC. 461 * @dfs: Pointer to wlan_dfs structure. 462 * @chan_freq: Pointer to channel freq for agile set request. 463 * @pri_chan_freq: Current primary IEEE channel freq. 464 * @sec_chan_freq: Current secondary IEEE channel freq (in HT80_80 mode). 465 * 466 * Find an IEEE channel freq for agileCAC which is not the current operating 467 * channels (indicated by pri_chan_freq, sec_chan_freq). 468 */ 469 #ifdef CONFIG_CHAN_FREQ_API 470 void dfs_set_agilecac_chan_for_freq(struct wlan_dfs *dfs, 471 uint16_t *chan_freq, 472 uint16_t pri_chan_freq, 473 uint16_t sec_chan_freq); 474 #endif 475 476 /** 477 * dfs_agile_precac_start() - Start agile precac. 478 * @dfs: Pointer to wlan_dfs structure. 479 */ 480 void dfs_agile_precac_start(struct wlan_dfs *dfs); 481 482 /** 483 * dfs_start_agile_precac_timer() - Start precac timer for the given channel. 484 * @dfs: Pointer to wlan_dfs structure. 485 * @ocac_status: Status of the off channel CAC. 486 * @adfs_param: Agile DFS CAC parameters. 487 * 488 * Start the precac timer with proper timeout values based on the channel to 489 * be preCACed. The preCAC channel number and chwidth information is present 490 * in the adfs_param argument. Once the timer is started, update the timeout 491 * fields in adfs_param. 492 */ 493 void dfs_start_agile_precac_timer(struct wlan_dfs *dfs, 494 uint8_t ocac_status, 495 struct dfs_agile_cac_params *adfs_param); 496 497 /** 498 * dfs_set_fw_adfs_support() - Set FW aDFS support in dfs object. 499 * @dfs: Pointer to wlan_dfs structure. 500 * @fw_adfs_support_160: aDFS enabled when pdev is on 160/80P80MHz. 501 * @fw_adfs_support_non_160: aDFS enabled when pdev is on 20/40/80MHz. 502 * 503 * Return: void. 504 */ 505 void dfs_set_fw_adfs_support(struct wlan_dfs *dfs, 506 bool fw_adfs_support_160, 507 bool fw_adfs_support_non_160); 508 #else 509 static inline void dfs_find_pdev_for_agile_precac(struct wlan_objmgr_pdev *pdev, 510 uint8_t *cur_agile_dfs_index) 511 { 512 } 513 514 static inline void dfs_prepare_agile_precac_chan(struct wlan_dfs *dfs, 515 bool *is_chan_found) 516 { 517 } 518 519 static inline void 520 dfs_process_ocac_complete(struct wlan_objmgr_pdev *pdev, 521 uint32_t ocac_status, 522 uint32_t center_freq1, 523 uint32_t center_freq2, 524 enum phy_ch_width chwidth) 525 { 526 } 527 528 #ifdef CONFIG_CHAN_FREQ_API 529 static inline void 530 dfs_set_agilecac_chan_for_freq(struct wlan_dfs *dfs, 531 uint16_t *chan_freq, 532 uint16_t pri_chan_freq, 533 uint16_t sec_chan_freq) 534 { 535 } 536 #endif 537 538 static inline void dfs_agile_precac_start(struct wlan_dfs *dfs) 539 { 540 } 541 542 static inline void 543 dfs_start_agile_precac_timer(struct wlan_dfs *dfs, 544 uint8_t ocac_status, 545 struct dfs_agile_cac_params *adfs_param) 546 { 547 } 548 549 static inline void 550 dfs_set_fw_adfs_support(struct wlan_dfs *dfs, 551 bool fw_adfs_support_160, 552 bool fw_adfs_support_non_160) 553 { 554 } 555 #endif 556 557 #if defined(QCA_SUPPORT_AGILE_DFS) || defined(ATH_SUPPORT_ZERO_CAC_DFS) 558 /** 559 * dfs_agile_soc_obj_init() - Initialize soc obj for agile precac. 560 * @dfs: Pointer to wlan_dfs structure. 561 * @precac_chan: Start thr precac timer in this channel. 562 * @ocac_status: Status of the off channel CAC. 563 */ 564 void dfs_agile_soc_obj_init(struct wlan_dfs *dfs, 565 struct wlan_objmgr_psoc *psoc); 566 #else 567 static inline void dfs_agile_soc_obj_init(struct wlan_dfs *dfs, 568 struct wlan_objmgr_psoc *psoc) 569 { 570 } 571 #endif 572 573 /** 574 * dfs_set_precac_enable() - Set precac enable flag. 575 * @dfs: Pointer to wlan_dfs structure. 576 * @value: input value for dfs_legacy_precac_ucfg flag. 577 */ 578 #if !defined(MOBILE_DFS_SUPPORT) 579 void dfs_set_precac_enable(struct wlan_dfs *dfs, 580 uint32_t value); 581 #else 582 static inline void dfs_set_precac_enable(struct wlan_dfs *dfs, 583 uint32_t value) 584 { 585 } 586 #endif 587 588 /** 589 * dfs_is_agile_precac_enabled() - Check if agile preCAC is enabled for the DFS. 590 * @dfs: Pointer to the wlan_dfs object. 591 * 592 * Return: True if agile DFS is enabled, else false. 593 * 594 * For agile preCAC to be enabled, 595 * 1. User configuration should be set. 596 * 2. Target should support aDFS. 597 */ 598 #ifdef QCA_SUPPORT_AGILE_DFS 599 bool dfs_is_agile_precac_enabled(struct wlan_dfs *dfs); 600 #else 601 static inline bool dfs_is_agile_precac_enabled(struct wlan_dfs *dfs) 602 { 603 return false; 604 } 605 #endif 606 607 /** 608 * dfs_is_precac_domain() - Check if current DFS domain supports preCAC. 609 * @dfs: Pointer to the wlan_dfs object. 610 * 611 * Return: True if current DFS domain supports preCAC, else false. 612 * 613 * preCAC is currently supported in, 614 * 1. ETSI domain. 615 * 616 */ 617 #if defined(QCA_SUPPORT_AGILE_DFS) || defined(ATH_SUPPORT_ZERO_CAC_DFS) 618 bool dfs_is_precac_domain(struct wlan_dfs *dfs); 619 #else 620 static inline bool dfs_is_precac_domain(struct wlan_dfs *dfs) 621 { 622 return false; 623 } 624 #endif 625 626 /** 627 * dfs_is_rcac_domain() - Check if current DFS domain supports agile RCAC. 628 * @dfs: Pointer to the wlan_dfs object. 629 * 630 * Return: True if current DFS domain supports RCAC, else false. 631 * 632 * preCAC is currently supported in, 633 * 1. FCC domain. 634 * 2. MKK domain. 635 * 3. MKKN domain. 636 * 637 */ 638 #if defined(QCA_SUPPORT_ADFS_RCAC) 639 bool dfs_is_rcac_domain(struct wlan_dfs *dfs); 640 #else 641 static inline bool dfs_is_rcac_domain(struct wlan_dfs *dfs) 642 { 643 return false; 644 } 645 #endif 646 647 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT 648 /** 649 * dfs_set_precac_intermediate_chan() - Set intermediate chan to be used while 650 * doing precac. 651 * @dfs: Pointer to wlan_dfs structure. 652 * @value: input value for dfs_legacy_precac_ucfg flag. 653 * 654 * Return: 655 * * 0 - Successfully set intermediate channel. 656 * * -EINVAL - Invalid channel. 657 */ 658 int32_t dfs_set_precac_intermediate_chan(struct wlan_dfs *dfs, 659 uint32_t value); 660 #else 661 static inline int32_t dfs_set_precac_intermediate_chan(struct wlan_dfs *dfs, 662 uint32_t value) 663 { 664 return 0; 665 } 666 #endif 667 668 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT 669 /** 670 * dfs_get_precac_intermediate_chan() - Get configured precac 671 * intermediate channel. 672 * @dfs: Pointer to wlan_dfs structure. 673 * 674 * Return: Configured intermediate channel number. 675 */ 676 uint32_t dfs_get_precac_intermediate_chan(struct wlan_dfs *dfs); 677 #else 678 static inline uint32_t dfs_get_intermediate_chan(struct wlan_dfs *dfs) 679 { 680 return 0; 681 } 682 #endif 683 684 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT 685 686 /** 687 * dfs_get_precac_chan_state_for_freq() - Get precac status of a given channel. 688 * @dfs: Pointer to wlan_dfs structure. 689 * @precac_chan: Channel freq for which precac state need to be checked. 690 */ 691 692 #ifdef CONFIG_CHAN_FREQ_API 693 enum precac_chan_state 694 dfs_get_precac_chan_state_for_freq(struct wlan_dfs *dfs, 695 uint16_t precac_chan_freq); 696 #endif 697 698 #else 699 #ifdef CONFIG_CHAN_FREQ_API 700 static inline enum precac_chan_state 701 dfs_get_precac_chan_state_for_freq(struct wlan_dfs *dfs, 702 uint16_t precac_chan_freq) 703 { 704 return PRECAC_REQUIRED; 705 } 706 #endif 707 #endif 708 709 /** 710 * dfs_zero_cac_reset() - Reset Zero cac DFS variables. 711 * @dfs: Pointer to wlan_dfs structure. 712 */ 713 void dfs_zero_cac_reset(struct wlan_dfs *dfs); 714 715 /** 716 * dfs_reinit_precac_lists() - Reinit DFS preCAC lists. 717 * @src_dfs: Source DFS from which the preCAC list is copied. 718 * @dest_dfs: Destination DFS to which the preCAC list is copied. 719 * @low_5g_freq: Low 5G frequency value of the destination DFS. 720 * @high_5g_freq: High 5G frequency value of the destination DFS. 721 * 722 * Copy all the preCAC list entries from the source DFS to the destination DFS 723 * which fall within the frequency range of low_5g_freq and high_5g_freq. 724 * 725 * Return: None (void). 726 */ 727 #if !defined(MOBILE_DFS_SUPPORT) 728 void dfs_reinit_precac_lists(struct wlan_dfs *src_dfs, 729 struct wlan_dfs *dest_dfs, 730 uint16_t low_5g_freq, 731 uint16_t high_5g_freq); 732 #else 733 static inline void dfs_reinit_precac_lists(struct wlan_dfs *src_dfs, 734 struct wlan_dfs *dest_dfs, 735 uint16_t low_5g_freq, 736 uint16_t high_5g_freq) 737 { 738 } 739 #endif 740 741 /** 742 * dfs_is_precac_done_on_ht20_40_80_160_165_chan_for_freq() - Is precac done on 743 * a VHT20/40/80/160/165 channel. 744 *@dfs: Pointer to wlan_dfs structure. 745 *@chan: Channel frequency 746 * 747 * Return: 748 * * True: If CAC is done on channel. 749 * * False: If CAC is not done on channel. 750 */ 751 #ifdef CONFIG_CHAN_FREQ_API 752 bool 753 dfs_is_precac_done_on_ht20_40_80_160_165_chan_for_freq(struct wlan_dfs *dfs, 754 uint16_t chan_freq); 755 #endif 756 757 /** 758 * dfs_is_precac_done_on_ht8080_chan() - Is precac done on VHT80+80 channel 759 * channel other than the restricted 760 * 80+80 channel. 761 * @dfs: Pointer to wlan_dfs structure. 762 * @chan: Pointer to dfs_channel for which preCAC done is checked. 763 * 764 * Return: 765 * * True: If CAC is done on channel. 766 * * False: If CAC is not done on channel. 767 */ 768 bool dfs_is_precac_done_on_ht8080_chan(struct wlan_dfs *dfs, 769 struct dfs_channel *chan); 770 771 #if !defined(MOBILE_DFS_SUPPORT) 772 #ifdef CONFIG_CHAN_FREQ_API 773 /** 774 * dfs_find_curchwidth_and_center_chan_for_freq() - Find the channel width 775 * enum, primary and secondary 776 * center channel value of 777 * the current channel. 778 * @dfs: Pointer to wlan_dfs structure. 779 * @chwidth: Channel width enum of current channel. 780 * @primary_chan_freq: Primary IEEE channel freq. 781 * @secondary_chan_freq: Secondary IEEE channel freq (in HT80_80 mode). 782 */ 783 void 784 dfs_find_curchwidth_and_center_chan_for_freq(struct wlan_dfs *dfs, 785 enum phy_ch_width *chwidth, 786 uint16_t *primary_chan_freq, 787 uint16_t *secondary_chan_freq); 788 #endif 789 790 #ifdef CONFIG_CHAN_FREQ_API 791 /** 792 * dfs_mark_precac_done_for_freq() - Mark the channel as preCAC done. 793 * @dfs: Pointer to wlan_dfs structure. 794 * @pri_chan_freq: Primary channel IEEE freq. 795 * @sec_chan_freq: Secondary channel IEEE freq(only in HT80_80 mode). 796 * @chan_width: Channel width enum. 797 */ 798 void dfs_mark_precac_done_for_freq(struct wlan_dfs *dfs, 799 uint16_t pri_chan_freq, 800 uint16_t sec_chan_freq, 801 enum phy_ch_width chan_width); 802 #endif 803 804 /** 805 * dfs_mark_precac_nol_for_freq() - Mark the precac channel as radar. 806 * @dfs: Pointer to wlan_dfs structure. 807 * @is_radar_found_on_secondary_seg: Radar found on secondary seg for Cascade. 808 * @detector_id: detector id which found RADAR in HW. 809 * @freq_list: Array of radar found frequencies. 810 * @num_channels: Number of radar found subchannels. 811 */ 812 #ifdef CONFIG_CHAN_FREQ_API 813 void dfs_mark_precac_nol_for_freq(struct wlan_dfs *dfs, 814 uint8_t is_radar_found_on_secondary_seg, 815 uint8_t detector_id, 816 uint16_t *freq_list, 817 uint8_t num_channels); 818 #endif 819 820 /** 821 * dfs_unmark_precac_nol_for_freq() - Unmark the precac channel as radar. 822 * @dfs: Pointer to wlan_dfs structure. 823 * @channel: channel freq marked as radar. 824 */ 825 #ifdef CONFIG_CHAN_FREQ_API 826 void dfs_unmark_precac_nol_for_freq(struct wlan_dfs *dfs, uint16_t chan_freq); 827 #endif 828 829 #else 830 831 #ifdef CONFIG_CHAN_FREQ_API 832 static inline void 833 dfs_find_curchwidth_and_center_chan_for_freq(struct wlan_dfs *dfs, 834 enum phy_ch_width *chwidth, 835 uint16_t *primary_chan_freq, 836 uint16_t *secondary_chan_freq) 837 { 838 } 839 #endif 840 841 #ifdef CONFIG_CHAN_FREQ_API 842 static inline void dfs_mark_precac_done_for_freq(struct wlan_dfs *dfs, 843 uint16_t pri_chan_freq, 844 uint16_t sec_chan_freq, 845 enum phy_ch_width chan_width) 846 { 847 } 848 #endif 849 850 #ifdef CONFIG_CHAN_FREQ_API 851 static inline void 852 dfs_mark_precac_nol_for_freq(struct wlan_dfs *dfs, 853 uint8_t is_radar_found_on_secondary_seg, 854 uint8_t detector_id, 855 uint16_t *freq, 856 uint8_t num_channels) 857 { 858 } 859 #endif 860 861 #ifdef CONFIG_CHAN_FREQ_API 862 static inline void dfs_unmark_precac_nol_for_freq(struct wlan_dfs *dfs, 863 uint16_t chan_freq) 864 { 865 } 866 #endif 867 #endif 868 869 /** 870 * dfs_is_precac_timer_running() - Check whether precac timer is running. 871 * @dfs: Pointer to wlan_dfs structure. 872 */ 873 #if !defined(MOBILE_DFS_SUPPORT) 874 bool dfs_is_precac_timer_running(struct wlan_dfs *dfs); 875 #else 876 static inline bool dfs_is_precac_timer_running(struct wlan_dfs *dfs) 877 { 878 return false; 879 } 880 #endif 881 882 #ifdef CONFIG_CHAN_FREQ_API 883 #define VHT160_FREQ_DIFF 80 884 885 #define INITIAL_20_CHAN_FREQ_OFFSET -70 886 #define INITIAL_40_CHAN_FREQ_OFFSET -60 887 #define INITIAL_80_CHAN_FREQ_OFFSET -40 888 #define INITIAL_160_CHAN_FREQ_OFFSET 0 889 890 #define NEXT_20_CHAN_FREQ_OFFSET 20 891 #define NEXT_40_CHAN_FREQ_OFFSET 40 892 #define NEXT_80_CHAN_FREQ_OFFSET 80 893 #define NEXT_160_CHAN_FREQ_OFFSET 160 894 #define NEXT_320_CHAN_FREQ_OFFSET 320 895 896 #define WEATHER_CHAN_START_FREQ 5600 897 #define WEATHER_CHAN_END_FREQ 5640 898 899 #endif 900 901 /** 902 * dfs_set_rcac_enable() - Set rcac enable flag. 903 * @dfs: Pointer to wlan_dfs structure. 904 * @rcac_en: input value to configure rolling cac feature. 905 */ 906 #ifdef QCA_SUPPORT_ADFS_RCAC 907 QDF_STATUS dfs_set_rcac_enable(struct wlan_dfs *dfs, 908 bool rcac_en); 909 #else 910 static inline QDF_STATUS 911 dfs_set_rcac_enable(struct wlan_dfs *dfs, 912 bool rcac_en) 913 { 914 return QDF_STATUS_SUCCESS; 915 } 916 #endif 917 918 /** 919 * dfs_get_rcac_enable() - Get rcac enable flag. 920 * @dfs: Pointer to wlan_dfs structure. 921 * @rcac_en: Variable to hold the current rcac config. 922 */ 923 #ifdef QCA_SUPPORT_ADFS_RCAC 924 QDF_STATUS dfs_get_rcac_enable(struct wlan_dfs *dfs, 925 bool *rcac_en); 926 #else 927 static inline QDF_STATUS 928 dfs_get_rcac_enable(struct wlan_dfs *dfs, 929 bool *rcac_en) 930 { 931 return QDF_STATUS_SUCCESS; 932 } 933 #endif 934 935 /** 936 * dfs_set_rcac_freq() - Set user configured rolling CAC frequency. 937 * @dfs: Pointer to wlan_dfs structure. 938 * @rcac_freq: User preferred rolling cac frequency. 939 */ 940 #ifdef QCA_SUPPORT_ADFS_RCAC 941 QDF_STATUS dfs_set_rcac_freq(struct wlan_dfs *dfs, 942 qdf_freq_t rcac_freq); 943 #else 944 static inline QDF_STATUS 945 dfs_set_rcac_freq(struct wlan_dfs *dfs, 946 qdf_freq_t rcac_freq) 947 { 948 return QDF_STATUS_SUCCESS; 949 } 950 #endif 951 952 /** 953 * dfs_get_rcac_freq() - Get user configured rolling CAC frequency. 954 * @dfs: Pointer to wlan_dfs structure. 955 * @rcac_freq: Variable to store the user preferred rolling cac frequency. 956 */ 957 #ifdef QCA_SUPPORT_ADFS_RCAC 958 QDF_STATUS dfs_get_rcac_freq(struct wlan_dfs *dfs, 959 qdf_freq_t *rcac_freq); 960 #else 961 static inline QDF_STATUS 962 dfs_get_rcac_freq(struct wlan_dfs *dfs, 963 qdf_freq_t *rcac_freq) 964 { 965 return QDF_STATUS_SUCCESS; 966 } 967 #endif 968 969 /** 970 * dfs_rcac_timer_init() - Initialize rolling cac timer. 971 * @dfs_soc_obj: Pointer to DFS SOC object structure. 972 */ 973 #ifdef QCA_SUPPORT_ADFS_RCAC 974 void dfs_rcac_timer_init(struct dfs_soc_priv_obj *dfs_soc_obj); 975 #else 976 static inline void 977 dfs_rcac_timer_init(struct dfs_soc_priv_obj *dfs_soc_obj) 978 { 979 } 980 #endif 981 982 /** 983 * dfs_rcac_timer_deinit() - Free rolling cac timer object. 984 * @dfs_soc_obj: Pointer to dfs_soc_priv_obj structure. 985 */ 986 #ifdef QCA_SUPPORT_ADFS_RCAC 987 void dfs_rcac_timer_deinit(struct dfs_soc_priv_obj *dfs_soc_obj); 988 #else 989 static inline void 990 dfs_rcac_timer_deinit(struct dfs_soc_priv_obj *dfs_soc_obj) 991 { 992 } 993 #endif 994 995 #ifdef QCA_SUPPORT_AGILE_DFS 996 #define DFS_AGILE_SM_SPIN_LOCK(_soc_obj) \ 997 qdf_spin_lock_bh(&((_soc_obj)->dfs_agile_sm_lock)) 998 #define DFS_AGILE_SM_SPIN_UNLOCK(_soc_obj) \ 999 qdf_spin_unlock_bh(&((_soc_obj)->dfs_agile_sm_lock)) 1000 1001 /** 1002 * dfs_agile_sm_deliver_evt() - Deliver the event to AGILE SM. 1003 * @dfs_soc_obj: Pointer to DFS soc object that holds the SM handle. 1004 * @event: Event ID. 1005 * @event_data_len: Length of event data. 1006 * @event_data: pointer to event data. 1007 * 1008 * Return: Success if event is handled, else failure. 1009 */ 1010 QDF_STATUS dfs_agile_sm_deliver_evt(struct dfs_soc_priv_obj *dfs_soc_obj, 1011 enum dfs_agile_sm_evt event, 1012 uint16_t event_data_len, 1013 void *event_data); 1014 1015 /** 1016 * dfs_agile_sm_create() - Create the AGILE state machine. 1017 * @dfs_soc_obj: Pointer to dfs_soc object that holds the SM handle. 1018 * 1019 * Return: QDF_STATUS_SUCCESS if successful, else failure status. 1020 */ 1021 QDF_STATUS dfs_agile_sm_create(struct dfs_soc_priv_obj *dfs_soc_obj); 1022 1023 /** 1024 * dfs_agile_sm_destroy() - Destroy the AGILE state machine. 1025 * @dfs_soc_obj: Pointer to dfs_soc object that holds the SM handle. 1026 * 1027 * Return: QDF_STATUS_SUCCESS if successful, else failure status. 1028 */ 1029 QDF_STATUS dfs_agile_sm_destroy(struct dfs_soc_priv_obj *dfs_soc_obj); 1030 1031 /** 1032 * dfs_is_agile_cac_enabled() - Determine if Agile PreCAC/RCAC is enabled. 1033 * @dfs: Pointer to struct wlan_dfs. 1034 * 1035 * Return: True if either Agile PreCAC/RCAC is enabled, false otherwise. 1036 */ 1037 bool dfs_is_agile_cac_enabled(struct wlan_dfs *dfs); 1038 1039 #else 1040 1041 static inline 1042 QDF_STATUS dfs_agile_sm_deliver_evt(struct dfs_soc_priv_obj *dfs_soc_obj, 1043 enum dfs_agile_sm_evt event, 1044 uint16_t event_data_len, 1045 void *event_data) 1046 { 1047 return QDF_STATUS_SUCCESS; 1048 } 1049 1050 static inline 1051 QDF_STATUS dfs_agile_sm_create(struct dfs_soc_priv_obj *dfs_soc_obj) 1052 { 1053 return QDF_STATUS_SUCCESS; 1054 } 1055 1056 static inline 1057 QDF_STATUS dfs_agile_sm_destroy(struct dfs_soc_priv_obj *dfs_soc_obj) 1058 { 1059 return QDF_STATUS_SUCCESS; 1060 } 1061 1062 static inline bool dfs_is_agile_cac_enabled(struct wlan_dfs *dfs) 1063 { 1064 return false; 1065 } 1066 #endif /* QCA_SUPPORT_AGILE_DFS */ 1067 1068 #ifdef QCA_SUPPORT_ADFS_RCAC 1069 /** 1070 * dfs_is_agile_rcac_enabled() - Determine if Rolling CAC is enabled or not. 1071 * @dfs: Pointer to struct wlan_dfs. 1072 * 1073 * Following are the conditions needed to assertain that rolling CAC 1074 * is enabled: 1075 * 1. DFS domain of the PDEV must be FCC or MKK. 1076 * 2. User has enabled Rolling CAC configuration. 1077 * 3. FW capability to support ADFS. Only non-160 capability is checked here. 1078 * If we happen to choose the next RCAC channel as 160/80-80, 1079 * 'dfs_fw_adfs_support_160' is also verified. 1080 * 1081 * 1082 * Return: True if RCAC support is enabled, false otherwise. 1083 */ 1084 bool dfs_is_agile_rcac_enabled(struct wlan_dfs *dfs); 1085 1086 /** 1087 * dfs_prepare_agile_rcac_channel() - Prepare agile RCAC channel. 1088 * @dfs: Pointer to struct wlan_dfs. 1089 * @is_rcac_chan_available: Flag to indicate if a valid RCAC channel is 1090 * found. 1091 */ 1092 void dfs_prepare_agile_rcac_channel(struct wlan_dfs *dfs, 1093 bool *is_rcac_chan_available); 1094 /** 1095 * dfs_start_agile_rcac_timer() - Start Agile RCAC timer. 1096 * @dfs: Pointer to struct wlan_dfs. 1097 * 1098 */ 1099 void dfs_start_agile_rcac_timer(struct wlan_dfs *dfs); 1100 1101 /** 1102 * dfs_stop_agile_rcac_timer() - Stop Agile RCAC timer. 1103 * @dfs: Pointer to struct wlan_dfs. 1104 * 1105 */ 1106 void dfs_stop_agile_rcac_timer(struct wlan_dfs *dfs); 1107 #else 1108 static inline bool dfs_is_agile_rcac_enabled(struct wlan_dfs *dfs) 1109 { 1110 return false; 1111 } 1112 1113 static inline void 1114 dfs_prepare_agile_rcac_channel(struct wlan_dfs *dfs, 1115 bool *is_rcac_chan_available) 1116 { 1117 } 1118 1119 static inline void dfs_start_agile_rcac_timer(struct wlan_dfs *dfs) 1120 { 1121 } 1122 1123 static inline void dfs_stop_agile_rcac_timer(struct wlan_dfs *dfs) 1124 { 1125 } 1126 #endif /* QCA_SUPPORT_ADFS_RCAC */ 1127 1128 #if defined(QCA_SUPPORT_AGILE_DFS) || defined(ATH_SUPPORT_ZERO_CAC_DFS) || \ 1129 defined(QCA_SUPPORT_ADFS_RCAC) 1130 /** 1131 * dfs_process_radar_ind_on_agile_chan() - Process radar indication event on 1132 * agile channel. 1133 * @dfs: Pointer to wlan_dfs structure. 1134 * @radar_found: Pointer to radar_found_info structure. 1135 * 1136 * Return: QDF_STATUS 1137 */ 1138 QDF_STATUS 1139 dfs_process_radar_ind_on_agile_chan(struct wlan_dfs *dfs, 1140 struct radar_found_info *radar_found); 1141 #else 1142 static inline QDF_STATUS 1143 dfs_process_radar_ind_on_agile_chan(struct wlan_dfs *dfs, 1144 struct radar_found_info *radar_found) 1145 { 1146 return QDF_STATUS_E_FAILURE; 1147 } 1148 #endif 1149 1150 #ifdef ATH_SUPPORT_ZERO_CAC_DFS 1151 /** 1152 * dfs_precac_status_for_channel() - Find the preCAC status of the given 1153 * channel. 1154 * 1155 * @dfs: Pointer to wlan_dfs dfs. 1156 * @deschan: DFS channel to check preCAC status. 1157 * 1158 * Return: 1159 * DFS_NO_PRECAC_COMPLETED_CHANS - 0 preCAC completed channels. 1160 * DFS_PRECAC_COMPLETED_CHAN - Given channel is preCAC completed. 1161 * DFS_PRECAC_REQUIRED_CHAN - Given channel requires preCAC. 1162 */ 1163 enum precac_status_for_chan 1164 dfs_precac_status_for_channel(struct wlan_dfs *dfs, 1165 struct dfs_channel *deschan); 1166 #else 1167 static inline enum precac_status_for_chan 1168 dfs_precac_status_for_channel(struct wlan_dfs *dfs, 1169 struct dfs_channel *deschan) 1170 { 1171 return DFS_INVALID_PRECAC_STATUS; 1172 } 1173 #endif 1174 1175 #if (defined(QCA_SUPPORT_AGILE_DFS) || defined(QCA_SUPPORT_ADFS_RCAC)) && \ 1176 defined(WLAN_DFS_TRUE_160MHZ_SUPPORT) && defined(WLAN_DFS_FULL_OFFLOAD) 1177 /** 1178 * dfs_translate_radar_params_for_agile_chan() - Translate radar params from 1179 * 160MHz synthesizer model to 80MHz synthesizer model for Agile channel. 1180 * @dfs: Pointer to wlan_dfs dfs. 1181 * @r_info: Radar found parameters received from FW that are converted to 80MHz 1182 * syntesizer model(both input and output). 1183 * 1184 * Return: void. 1185 */ 1186 1187 void dfs_translate_radar_params_for_agile_chan(struct wlan_dfs *dfs, 1188 struct radar_found_info *r_info); 1189 #else 1190 static inline void 1191 dfs_translate_radar_params_for_agile_chan(struct wlan_dfs *dfs, 1192 struct radar_found_info *r_info) 1193 { 1194 } 1195 #endif 1196 1197 /** 1198 * dfs_is_subset_channel_for_freq() - Find out if prev channel and current 1199 * channel are subsets of each other. 1200 * @old_subchans_freq: Pointer to previous sub-channels freq. 1201 * @old_n_chans: Number of previous sub-channels. 1202 * @new_subchans_freq: Pointer to new sub-channels freq. 1203 * @new_n_chans: Number of new sub-channels 1204 */ 1205 #ifdef CONFIG_CHAN_FREQ_API 1206 bool 1207 dfs_is_subset_channel_for_freq(uint16_t *old_subchans_freq, 1208 uint8_t old_n_chans, 1209 uint16_t *new_subchans_freq, 1210 uint8_t new_n_chans); 1211 #endif 1212 1213 #ifdef QCA_DFS_BW_EXPAND 1214 /** 1215 * dfs_bwexpand_find_usr_cnf_chan() - Find the User configured channel for 1216 * BW Expand. 1217 * @dfs: Pointer to wlan_dfs object. 1218 * 1219 * Return: User configured frequency. 1220 */ 1221 qdf_freq_t dfs_bwexpand_find_usr_cnf_chan(struct wlan_dfs *dfs); 1222 1223 /** 1224 * dfs_bwexpand_try_jumping_to_target_subchan() - Expand the current channel 1225 * bandwidth or jump to a (subset of) user configured target channel. 1226 * Example: Current channel is 60 HT20 and user configured target channel is 1227 * 100 HT160. Agile SM runs on the subchans with 20Mhz BW of 100 HT160, here 1228 * Agile SM runs on 100HT20 and after completion of agile CAC, it checks 1229 * the API dfs_bwexpand_try_jumping_to_target_subchan for possibility of 1230 * BW Expansion and only 20Mhz subchan is available. There is no possible for 1231 * higher bandwidth channel. Then agile CAC runs on the adjacent subchannel 1232 * 104 HT20. After agile CAC completion, the API is checked again for possible 1233 * bandwidth expansion and 102 HT40 is available. The API invokes channel change 1234 * to higher bandwidth. 1235 * @dfs: Pointer to wlan_dfs object. 1236 * 1237 * Return: TRUE, if Bandwidth expansion is success. 1238 * FALSE, if Bandwidth expansion is failure. 1239 */ 1240 bool dfs_bwexpand_try_jumping_to_target_subchan(struct wlan_dfs *dfs); 1241 1242 /** 1243 * dfs_is_rcac_cac_done()- Check RCAC is completed on the subset of the 1244 * user configured target channel. 1245 * @dfs: Pointer to wlan_dfs. 1246 * @chan: Pointer to dfs_channel object of user configured target channel. 1247 * @subset_chan: Pointer to dfs_channel object of subchannel in which RCAC is 1248 * completed. 1249 * 1250 * Return: Boolean value. 1251 */ 1252 bool dfs_is_rcac_cac_done(struct wlan_dfs *dfs, 1253 struct dfs_channel *chan, 1254 struct dfs_channel *subset_chan); 1255 1256 /* 1257 * dfs_get_configured_bwexpand_dfs_chan() - Get a DFS chan when frequency and 1258 * phymode is provided. 1259 * @dfs: pointer to wlan_dfs. 1260 * @user_chan: pointer to dfs_channel. 1261 * @target_mode: phymode of type wlan_phymode. 1262 */ 1263 bool dfs_get_configured_bwexpand_dfs_chan(struct wlan_dfs *dfs, 1264 struct dfs_channel *user_chan, 1265 enum wlan_phymode target_mode); 1266 #else 1267 static inline 1268 qdf_freq_t dfs_bwexpand_find_usr_cnf_chan(struct wlan_dfs *dfs) 1269 { 1270 return 0; 1271 } 1272 1273 static inline 1274 bool dfs_bwexpand_try_jumping_to_target_subchan(struct wlan_dfs *dfs) 1275 { 1276 return false; 1277 } 1278 1279 static inline 1280 bool dfs_is_rcac_cac_done(struct wlan_dfs *dfs, 1281 struct dfs_channel *chan, 1282 struct dfs_channel *subset_chan) 1283 { 1284 return false; 1285 } 1286 1287 static inline 1288 bool dfs_get_configured_bwexpand_dfs_chan(struct wlan_dfs *dfs, 1289 struct dfs_channel *user_chan, 1290 enum wlan_phymode target_mode) 1291 { 1292 return false; 1293 } 1294 #endif /* QCA_DFS_BW_EXPAND */ 1295 #endif /* _DFS_ZERO_CAC_H_ */ 1296