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) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \ 206 defined(QCA_SUPPORT_AGILE_DFS)) 207 void dfs_print_precaclists(struct wlan_dfs *dfs); 208 #else 209 static inline void dfs_print_precaclists(struct wlan_dfs *dfs) 210 { 211 } 212 #endif 213 214 /** 215 * dfs_reset_precac_lists() - Resets the precac lists. 216 * @dfs: Pointer to wlan_dfs structure. 217 */ 218 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \ 219 defined(QCA_SUPPORT_AGILE_DFS)) 220 void dfs_reset_precac_lists(struct wlan_dfs *dfs); 221 #else 222 static inline void dfs_reset_precac_lists(struct wlan_dfs *dfs) 223 { 224 } 225 #endif 226 227 /** 228 * dfs_reset_precaclists() - Clears and initializes precac_list. 229 * @dfs: Pointer to wlan_dfs structure. 230 */ 231 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \ 232 defined(QCA_SUPPORT_AGILE_DFS)) 233 void dfs_reset_precaclists(struct wlan_dfs *dfs); 234 #else 235 static inline void dfs_reset_precaclists(struct wlan_dfs *dfs) 236 { 237 } 238 #endif 239 240 /** 241 * dfs_deinit_precac_list() - Clears the precac list. 242 * @dfs: Pointer to wlan_dfs dtructure. 243 */ 244 void dfs_deinit_precac_list(struct wlan_dfs *dfs); 245 246 /** 247 * dfs_zero_cac_detach() - Free zero_cac memory. 248 * @dfs: Pointer to wlan_dfs dtructure. 249 */ 250 #if !defined(MOBILE_DFS_SUPPORT) && defined(ATH_SUPPORT_ZERO_CAC_DFS) 251 void dfs_zero_cac_detach(struct wlan_dfs *dfs); 252 #else 253 static inline void dfs_zero_cac_detach(struct wlan_dfs *dfs) 254 { 255 } 256 #endif 257 258 /** 259 * dfs_init_precac_list() - Init precac list. 260 * @dfs: Pointer to wlan_dfs dtructure. 261 */ 262 void dfs_init_precac_list(struct wlan_dfs *dfs); 263 264 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \ 265 defined(QCA_SUPPORT_AGILE_DFS)) 266 /** 267 * dfs_start_precac_timer_for_freq() - Start precac timer. 268 * @dfs: Pointer to wlan_dfs structure. 269 * @precac_chan_freq: Frequency to start precac timer. 270 */ 271 #ifdef CONFIG_CHAN_FREQ_API 272 void dfs_start_precac_timer_for_freq(struct wlan_dfs *dfs, 273 uint16_t precac_chan_freq); 274 #endif 275 #else 276 #ifdef CONFIG_CHAN_FREQ_API 277 static inline 278 void dfs_start_precac_timer_for_freq(struct wlan_dfs *dfs, 279 uint16_t precac_chan_freq) 280 { 281 } 282 #endif 283 #endif 284 285 /** 286 * dfs_cancel_precac_timer() - Cancel the precac timer. 287 * @dfs: Pointer to wlan_dfs structure. 288 */ 289 #if !defined(MOBILE_DFS_SUPPORT) && defined(ATH_SUPPORT_ZERO_CAC_DFS) 290 void dfs_cancel_precac_timer(struct wlan_dfs *dfs); 291 #else 292 static inline void dfs_cancel_precac_timer(struct wlan_dfs *dfs) 293 { 294 } 295 #endif 296 297 /** 298 * dfs_zero_cac_attach() - Initialize dfs zerocac variables. 299 * @dfs: Pointer to DFS structure. 300 */ 301 #if !defined(MOBILE_DFS_SUPPORT) && defined(ATH_SUPPORT_ZERO_CAC_DFS) 302 void dfs_zero_cac_attach(struct wlan_dfs *dfs); 303 #else 304 static inline void dfs_zero_cac_attach(struct wlan_dfs *dfs) 305 { 306 } 307 #endif 308 309 /** 310 * dfs_zero_cac_reset() - Reset Zero cac DFS variables. 311 * @dfs: Pointer to wlan_dfs structure. 312 */ 313 #if !defined(MOBILE_DFS_SUPPORT) && defined(ATH_SUPPORT_ZERO_CAC_DFS) 314 void dfs_zero_cac_reset(struct wlan_dfs *dfs); 315 #else 316 static inline void dfs_zero_cac_reset(struct wlan_dfs *dfs) 317 { 318 } 319 #endif 320 321 /** 322 * dfs_zero_cac_timer_detach() - Free Zero cac DFS variables. 323 * @dfs_soc_obj: Pointer to dfs_soc_priv_obj structure. 324 */ 325 #if defined(ATH_SUPPORT_ZERO_CAC_DFS) && !defined(MOBILE_DFS_SUPPORT) 326 void dfs_zero_cac_timer_detach(struct dfs_soc_priv_obj *dfs_soc_obj); 327 #else 328 static inline void 329 dfs_zero_cac_timer_detach(struct dfs_soc_priv_obj *dfs_soc_obj) 330 { 331 } 332 #endif 333 334 /** 335 * dfs_is_precac_done() - Is precac done. 336 * @dfs: Pointer to wlan_dfs structure. 337 * @chan: Pointer to dfs_channel for which preCAC done is checked. 338 * 339 * Return: 340 * * True: If precac is done on channel. 341 * * False: If precac is not done on channel. 342 */ 343 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \ 344 defined(QCA_SUPPORT_AGILE_DFS)) 345 bool dfs_is_precac_done(struct wlan_dfs *dfs, struct dfs_channel *chan); 346 #else 347 static inline bool dfs_is_precac_done(struct wlan_dfs *dfs, 348 struct dfs_channel *chan) 349 { 350 return false; 351 } 352 #endif 353 354 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT 355 /** 356 * dfs_decide_precac_preferred_chan_for_freq() - Choose operating channel among 357 * configured DFS channel and 358 * intermediate channel based on 359 * precac status of configured 360 * DFS channel. 361 * @dfs: Pointer to wlan_dfs structure. 362 * @pref_chan: Configured DFS channel frequency 363 * @mode: Configured PHY mode. 364 * 365 * Return: True if intermediate channel needs to configure. False otherwise. 366 */ 367 368 #ifdef CONFIG_CHAN_FREQ_API 369 bool 370 dfs_decide_precac_preferred_chan_for_freq(struct wlan_dfs *dfs, 371 uint16_t *pref_chan_freq, 372 enum wlan_phymode mode); 373 #endif 374 #else 375 #ifdef CONFIG_CHAN_FREQ_API 376 static inline void 377 dfs_decide_precac_preferred_chan_for_freq(struct wlan_dfs *dfs, 378 uint8_t *pref_chan, 379 enum wlan_phymode mode) 380 { 381 } 382 #endif 383 #endif 384 385 /** 386 * dfs_get_ieeechan_for_precac_for_freq() - Get chan of required bandwidth from 387 * precac_list. 388 * @dfs: Pointer to wlan_dfs structure. 389 * @exclude_pri_chan_freq: Primary channel freq to be excluded for preCAC. 390 * @exclude_sec_chan_freq: Secondary channel freq to be excluded for preCAC. 391 * @bandwidth: Bandwidth of requested channel. 392 */ 393 #ifdef CONFIG_CHAN_FREQ_API 394 uint16_t dfs_get_ieeechan_for_precac_for_freq(struct wlan_dfs *dfs, 395 uint16_t exclude_pri_chan_freq, 396 uint16_t exclude_sec_chan_freq, 397 uint16_t bandwidth); 398 #endif 399 400 /** 401 * dfs_override_precac_timeout() - Override the default precac timeout. 402 * @dfs: Pointer to wlan_dfs structure. 403 * @precac_timeout: Precac timeout value. 404 */ 405 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \ 406 defined(QCA_SUPPORT_AGILE_DFS)) 407 int dfs_override_precac_timeout(struct wlan_dfs *dfs, 408 int precac_timeout); 409 #else 410 static inline int dfs_override_precac_timeout(struct wlan_dfs *dfs, 411 int precac_timeout) 412 { 413 return 0; 414 } 415 #endif 416 417 /** 418 * dfs_get_override_precac_timeout() - Get precac timeout. 419 * @dfs: Pointer wlan_dfs structure. 420 * @precac_timeout: Get precac timeout value in this variable. 421 */ 422 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \ 423 defined(QCA_SUPPORT_AGILE_DFS)) 424 int dfs_get_override_precac_timeout(struct wlan_dfs *dfs, 425 int *precac_timeout); 426 #else 427 static inline int dfs_get_override_precac_timeout(struct wlan_dfs *dfs, 428 int *precac_timeout) 429 { 430 return 0; 431 } 432 #endif 433 434 #if defined(QCA_SUPPORT_AGILE_DFS) 435 /** 436 * dfs_find_pdev_for_agile_precac() - Find pdev to select channel for precac. 437 * @pdev: Pointer to wlan_objmgr_pdev structure. 438 * @cur_agile_dfs_index: current agile dfs index 439 */ 440 void dfs_find_pdev_for_agile_precac(struct wlan_objmgr_pdev *pdev, 441 uint8_t *cur_agile_dfs_index); 442 443 /** 444 * dfs_prepare_agile_precac_chan() - Send Agile set request for given pdev. 445 * @dfs: Pointer to wlan_dfs structure. 446 * @is_chan_found: True if a channel is available for PreCAC, false otherwise. 447 */ 448 void dfs_prepare_agile_precac_chan(struct wlan_dfs *dfs, bool *is_chan_found); 449 450 /** 451 * dfs_process_ocac_complete() - Process Off-Channel CAC complete indication. 452 * @pdev :Pointer to wlan_objmgr_pdev structure. 453 * @ocac_status: Off channel CAC complete status 454 * @center_freq1 : For 20/40/80/160Mhz, it is the center of the corresponding 455 * band. For 80P80/165MHz, it is the center of the left 80MHz. 456 * @center_freq2 : It is valid and non-zero only for 80P80/165MHz. It indicates 457 * the Center Frequency of the right 80MHz segment. 458 * @chwidth : Width of the channel for which OCAC completion is received. 459 */ 460 void dfs_process_ocac_complete(struct wlan_objmgr_pdev *pdev, 461 uint32_t ocac_status, 462 uint32_t center_freq1, 463 uint32_t center_freq2, 464 enum phy_ch_width chwidth); 465 466 /** 467 * dfs_set_agilecac_chan_for_freq() - Find chan freq for agile CAC. 468 * @dfs: Pointer to wlan_dfs structure. 469 * @chan_freq: Pointer to channel freq for agile set request. 470 * @pri_chan_freq: Current primary IEEE channel freq. 471 * @sec_chan_freq: Current secondary IEEE channel freq (in HT80_80 mode). 472 * 473 * Find an IEEE channel freq for agileCAC which is not the current operating 474 * channels (indicated by pri_chan_freq, sec_chan_freq). 475 */ 476 #ifdef CONFIG_CHAN_FREQ_API 477 void dfs_set_agilecac_chan_for_freq(struct wlan_dfs *dfs, 478 uint16_t *chan_freq, 479 uint16_t pri_chan_freq, 480 uint16_t sec_chan_freq); 481 #endif 482 483 /** 484 * dfs_compute_agile_and_curchan_width() - Compute the agile/current channel 485 * width from dfs structure. 486 * @dfs: Pointer to wlan_dfs structure. 487 * @agile_ch_width: Agile channel width. 488 * @cur_ch_width: Current home channel width. 489 */ 490 void 491 dfs_compute_agile_and_curchan_width(struct wlan_dfs *dfs, 492 enum phy_ch_width *agile_ch_width, 493 enum phy_ch_width *cur_ch_width); 494 495 /** 496 * dfs_agile_precac_start() - Start agile precac. 497 * @dfs: Pointer to wlan_dfs structure. 498 */ 499 void dfs_agile_precac_start(struct wlan_dfs *dfs); 500 501 /** 502 * dfs_start_agile_precac_timer() - Start precac timer for the given channel. 503 * @dfs: Pointer to wlan_dfs structure. 504 * @ocac_status: Status of the off channel CAC. 505 * @adfs_param: Agile DFS CAC parameters. 506 * 507 * Start the precac timer with proper timeout values based on the channel to 508 * be preCACed. The preCAC channel number and chwidth information is present 509 * in the adfs_param argument. Once the timer is started, update the timeout 510 * fields in adfs_param. 511 */ 512 void dfs_start_agile_precac_timer(struct wlan_dfs *dfs, 513 uint8_t ocac_status, 514 struct dfs_agile_cac_params *adfs_param); 515 516 /** 517 * dfs_set_fw_adfs_support() - Set FW aDFS support in dfs object. 518 * @dfs: Pointer to wlan_dfs structure. 519 * @fw_adfs_support_160: aDFS enabled when pdev is on 160/80P80MHz. 520 * @fw_adfs_support_non_160: aDFS enabled when pdev is on 20/40/80MHz. 521 * @fw_adfs_support_320: aDFS enabled when pdev is on 320 MHz. 522 * 523 * Return: void. 524 */ 525 void dfs_set_fw_adfs_support(struct wlan_dfs *dfs, 526 bool fw_adfs_support_160, 527 bool fw_adfs_support_non_160, 528 bool fw_adfs_support_320); 529 #else 530 static inline void dfs_find_pdev_for_agile_precac(struct wlan_objmgr_pdev *pdev, 531 uint8_t *cur_agile_dfs_index) 532 { 533 } 534 535 static inline void dfs_prepare_agile_precac_chan(struct wlan_dfs *dfs, 536 bool *is_chan_found) 537 { 538 } 539 540 static inline void 541 dfs_process_ocac_complete(struct wlan_objmgr_pdev *pdev, 542 uint32_t ocac_status, 543 uint32_t center_freq1, 544 uint32_t center_freq2, 545 enum phy_ch_width chwidth) 546 { 547 } 548 549 #ifdef CONFIG_CHAN_FREQ_API 550 static inline void 551 dfs_set_agilecac_chan_for_freq(struct wlan_dfs *dfs, 552 uint16_t *chan_freq, 553 uint16_t pri_chan_freq, 554 uint16_t sec_chan_freq) 555 { 556 } 557 #endif 558 559 static inline void 560 dfs_compute_agile_and_curchan_width(struct wlan_dfs *dfs, 561 enum phy_ch_width *agile_ch_width, 562 enum phy_ch_width *cur_ch_width) 563 { 564 } 565 566 static inline void dfs_agile_precac_start(struct wlan_dfs *dfs) 567 { 568 } 569 570 static inline void 571 dfs_start_agile_precac_timer(struct wlan_dfs *dfs, 572 uint8_t ocac_status, 573 struct dfs_agile_cac_params *adfs_param) 574 { 575 } 576 577 static inline void 578 dfs_set_fw_adfs_support(struct wlan_dfs *dfs, 579 bool fw_adfs_support_160, 580 bool fw_adfs_support_non_160, 581 bool fw_adfs_support_320) 582 { 583 } 584 #endif 585 586 #if defined(QCA_SUPPORT_AGILE_DFS) || defined(ATH_SUPPORT_ZERO_CAC_DFS) 587 /** 588 * dfs_agile_soc_obj_init() - Initialize soc obj for agile precac. 589 * @dfs: Pointer to wlan_dfs structure. 590 * @precac_chan: Start thr precac timer in this channel. 591 * @ocac_status: Status of the off channel CAC. 592 */ 593 void dfs_agile_soc_obj_init(struct wlan_dfs *dfs, 594 struct wlan_objmgr_psoc *psoc); 595 #else 596 static inline void dfs_agile_soc_obj_init(struct wlan_dfs *dfs, 597 struct wlan_objmgr_psoc *psoc) 598 { 599 } 600 #endif 601 602 /** 603 * dfs_set_precac_enable() - Set precac enable flag. 604 * @dfs: Pointer to wlan_dfs structure. 605 * @value: input value for dfs_legacy_precac_ucfg flag. 606 */ 607 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \ 608 defined(QCA_SUPPORT_AGILE_DFS)) 609 void dfs_set_precac_enable(struct wlan_dfs *dfs, 610 uint32_t value); 611 #else 612 static inline void dfs_set_precac_enable(struct wlan_dfs *dfs, 613 uint32_t value) 614 { 615 } 616 #endif 617 618 /** 619 * dfs_is_agile_precac_enabled() - Check if agile preCAC is enabled for the DFS. 620 * @dfs: Pointer to the wlan_dfs object. 621 * 622 * Return: True if agile DFS is enabled, else false. 623 * 624 * For agile preCAC to be enabled, 625 * 1. User configuration should be set. 626 * 2. Target should support aDFS. 627 */ 628 #ifdef QCA_SUPPORT_AGILE_DFS 629 bool dfs_is_agile_precac_enabled(struct wlan_dfs *dfs); 630 #else 631 static inline bool dfs_is_agile_precac_enabled(struct wlan_dfs *dfs) 632 { 633 return false; 634 } 635 #endif 636 637 /** 638 * dfs_is_precac_domain() - Check if current DFS domain supports preCAC. 639 * @dfs: Pointer to the wlan_dfs object. 640 * 641 * Return: True if current DFS domain supports preCAC, else false. 642 * 643 * preCAC is currently supported in, 644 * 1. ETSI domain. 645 * 646 */ 647 #if defined(QCA_SUPPORT_AGILE_DFS) || defined(ATH_SUPPORT_ZERO_CAC_DFS) 648 bool dfs_is_precac_domain(struct wlan_dfs *dfs); 649 #else 650 static inline bool dfs_is_precac_domain(struct wlan_dfs *dfs) 651 { 652 return false; 653 } 654 #endif 655 656 /** 657 * dfs_is_rcac_domain() - Check if current DFS domain supports agile RCAC. 658 * @dfs: Pointer to the wlan_dfs object. 659 * 660 * Return: True if current DFS domain supports RCAC, else false. 661 * 662 * preCAC is currently supported in, 663 * 1. FCC domain. 664 * 2. MKK domain. 665 * 3. MKKN domain. 666 * 667 */ 668 #if defined(QCA_SUPPORT_ADFS_RCAC) 669 bool dfs_is_rcac_domain(struct wlan_dfs *dfs); 670 #else 671 static inline bool dfs_is_rcac_domain(struct wlan_dfs *dfs) 672 { 673 return false; 674 } 675 #endif 676 677 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT 678 /** 679 * dfs_set_precac_intermediate_chan() - Set intermediate chan to be used while 680 * doing precac. 681 * @dfs: Pointer to wlan_dfs structure. 682 * @value: input value for dfs_legacy_precac_ucfg flag. 683 * 684 * Return: 685 * * 0 - Successfully set intermediate channel. 686 * * -EINVAL - Invalid channel. 687 */ 688 int32_t dfs_set_precac_intermediate_chan(struct wlan_dfs *dfs, 689 uint32_t value); 690 #else 691 static inline int32_t dfs_set_precac_intermediate_chan(struct wlan_dfs *dfs, 692 uint32_t value) 693 { 694 return 0; 695 } 696 #endif 697 698 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT 699 /** 700 * dfs_get_precac_intermediate_chan() - Get configured precac 701 * intermediate channel. 702 * @dfs: Pointer to wlan_dfs structure. 703 * 704 * Return: Configured intermediate channel number. 705 */ 706 uint32_t dfs_get_precac_intermediate_chan(struct wlan_dfs *dfs); 707 #else 708 static inline uint32_t dfs_get_intermediate_chan(struct wlan_dfs *dfs) 709 { 710 return 0; 711 } 712 #endif 713 714 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT 715 716 /** 717 * dfs_get_precac_chan_state_for_freq() - Get precac status of a given channel. 718 * @dfs: Pointer to wlan_dfs structure. 719 * @precac_chan: Channel freq for which precac state need to be checked. 720 */ 721 722 #ifdef CONFIG_CHAN_FREQ_API 723 enum precac_chan_state 724 dfs_get_precac_chan_state_for_freq(struct wlan_dfs *dfs, 725 uint16_t precac_chan_freq); 726 #endif 727 728 #else 729 #ifdef CONFIG_CHAN_FREQ_API 730 static inline enum precac_chan_state 731 dfs_get_precac_chan_state_for_freq(struct wlan_dfs *dfs, 732 uint16_t precac_chan_freq) 733 { 734 return PRECAC_REQUIRED; 735 } 736 #endif 737 #endif 738 739 /** 740 * dfs_reinit_precac_lists() - Reinit DFS preCAC lists. 741 * @src_dfs: Source DFS from which the preCAC list is copied. 742 * @dest_dfs: Destination DFS to which the preCAC list is copied. 743 * @low_5g_freq: Low 5G frequency value of the destination DFS. 744 * @high_5g_freq: High 5G frequency value of the destination DFS. 745 * 746 * Copy all the preCAC list entries from the source DFS to the destination DFS 747 * which fall within the frequency range of low_5g_freq and high_5g_freq. 748 * 749 * Return: None (void). 750 */ 751 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \ 752 defined(QCA_SUPPORT_AGILE_DFS)) 753 void dfs_reinit_precac_lists(struct wlan_dfs *src_dfs, 754 struct wlan_dfs *dest_dfs, 755 uint16_t low_5g_freq, 756 uint16_t high_5g_freq); 757 #else 758 static inline void dfs_reinit_precac_lists(struct wlan_dfs *src_dfs, 759 struct wlan_dfs *dest_dfs, 760 uint16_t low_5g_freq, 761 uint16_t high_5g_freq) 762 { 763 } 764 #endif 765 766 /** 767 * dfs_is_precac_done_on_non_80p80_chan_for_freq() - Is precac done on 768 * a 20/40/80/160/165/320 MHz channel. 769 *@dfs: Pointer to wlan_dfs structure. 770 *@chan: Channel frequency 771 * 772 * Return: 773 * * True: If CAC is done on channel. 774 * * False: If CAC is not done on channel. 775 */ 776 #ifdef CONFIG_CHAN_FREQ_API 777 bool 778 dfs_is_precac_done_on_non_80p80_chan_for_freq(struct wlan_dfs *dfs, 779 uint16_t chan_freq); 780 #endif 781 782 /** 783 * dfs_is_precac_done_on_80p80_chan() - Is precac done on 80+80 MHz channel. 784 * @dfs: Pointer to wlan_dfs structure. 785 * @chan: Pointer to dfs_channel for which preCAC done is checked. 786 * 787 * Return: 788 * * True: If CAC is done on channel. 789 * * False: If CAC is not done on channel. 790 */ 791 bool dfs_is_precac_done_on_80p80_chan(struct wlan_dfs *dfs, 792 struct dfs_channel *chan); 793 794 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \ 795 defined(QCA_SUPPORT_AGILE_DFS)) 796 #ifdef CONFIG_CHAN_FREQ_API 797 /** 798 * dfs_find_curchwidth_and_center_chan_for_freq() - Find the channel width 799 * enum, primary and secondary 800 * center channel value of 801 * the current channel. 802 * @dfs: Pointer to wlan_dfs structure. 803 * @chwidth: Channel width enum of current channel. 804 * @primary_chan_freq: Primary IEEE channel freq. 805 * @secondary_chan_freq: Secondary IEEE channel freq (in HT80_80 mode). 806 */ 807 void 808 dfs_find_curchwidth_and_center_chan_for_freq(struct wlan_dfs *dfs, 809 enum phy_ch_width *chwidth, 810 uint16_t *primary_chan_freq, 811 uint16_t *secondary_chan_freq); 812 #endif 813 814 #ifdef CONFIG_CHAN_FREQ_API 815 /** 816 * dfs_mark_precac_done_for_freq() - Mark the channel as preCAC done. 817 * @dfs: Pointer to wlan_dfs structure. 818 * @pri_chan_freq: Primary channel IEEE freq. 819 * @sec_chan_freq: Secondary channel IEEE freq(only in HT80_80 mode). 820 * @chan_width: Channel width enum. 821 */ 822 void dfs_mark_precac_done_for_freq(struct wlan_dfs *dfs, 823 uint16_t pri_chan_freq, 824 uint16_t sec_chan_freq, 825 enum phy_ch_width chan_width); 826 #endif 827 828 /** 829 * dfs_mark_precac_nol_for_freq() - Mark the precac channel as radar. 830 * @dfs: Pointer to wlan_dfs structure. 831 * @is_radar_found_on_secondary_seg: Radar found on secondary seg for Cascade. 832 * @detector_id: detector id which found RADAR in HW. 833 * @freq_list: Array of radar found frequencies. 834 * @num_channels: Number of radar found subchannels. 835 */ 836 #ifdef CONFIG_CHAN_FREQ_API 837 void dfs_mark_precac_nol_for_freq(struct wlan_dfs *dfs, 838 uint8_t is_radar_found_on_secondary_seg, 839 uint8_t detector_id, 840 uint16_t *freq_list, 841 uint8_t num_channels); 842 #endif 843 844 /** 845 * dfs_unmark_precac_nol_for_freq() - Unmark the precac channel as radar. 846 * @dfs: Pointer to wlan_dfs structure. 847 * @channel: channel freq marked as radar. 848 */ 849 #ifdef CONFIG_CHAN_FREQ_API 850 void dfs_unmark_precac_nol_for_freq(struct wlan_dfs *dfs, uint16_t chan_freq); 851 #endif 852 853 #else 854 855 #ifdef CONFIG_CHAN_FREQ_API 856 static inline void 857 dfs_find_curchwidth_and_center_chan_for_freq(struct wlan_dfs *dfs, 858 enum phy_ch_width *chwidth, 859 uint16_t *primary_chan_freq, 860 uint16_t *secondary_chan_freq) 861 { 862 } 863 #endif 864 865 #ifdef CONFIG_CHAN_FREQ_API 866 static inline void dfs_mark_precac_done_for_freq(struct wlan_dfs *dfs, 867 uint16_t pri_chan_freq, 868 uint16_t sec_chan_freq, 869 enum phy_ch_width chan_width) 870 { 871 } 872 #endif 873 874 #ifdef CONFIG_CHAN_FREQ_API 875 static inline void 876 dfs_mark_precac_nol_for_freq(struct wlan_dfs *dfs, 877 uint8_t is_radar_found_on_secondary_seg, 878 uint8_t detector_id, 879 uint16_t *freq, 880 uint8_t num_channels) 881 { 882 } 883 #endif 884 885 #ifdef CONFIG_CHAN_FREQ_API 886 static inline void dfs_unmark_precac_nol_for_freq(struct wlan_dfs *dfs, 887 uint16_t chan_freq) 888 { 889 } 890 #endif 891 #endif 892 893 /** 894 * dfs_is_precac_timer_running() - Check whether precac timer is running. 895 * @dfs: Pointer to wlan_dfs structure. 896 */ 897 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \ 898 defined(QCA_SUPPORT_AGILE_DFS)) 899 bool dfs_is_precac_timer_running(struct wlan_dfs *dfs); 900 #else 901 static inline bool dfs_is_precac_timer_running(struct wlan_dfs *dfs) 902 { 903 return false; 904 } 905 #endif 906 907 #ifdef CONFIG_CHAN_FREQ_API 908 #define VHT160_FREQ_DIFF 80 909 910 #define INITIAL_20_CHAN_FREQ_OFFSET -70 911 #define INITIAL_40_CHAN_FREQ_OFFSET -60 912 #define INITIAL_80_CHAN_FREQ_OFFSET -40 913 #define INITIAL_160_CHAN_FREQ_OFFSET 0 914 915 #define NEXT_20_CHAN_FREQ_OFFSET 20 916 #define NEXT_40_CHAN_FREQ_OFFSET 40 917 #define NEXT_80_CHAN_FREQ_OFFSET 80 918 #define NEXT_160_CHAN_FREQ_OFFSET 160 919 #define NEXT_320_CHAN_FREQ_OFFSET 320 920 921 #define WEATHER_CHAN_START_FREQ 5600 922 #define WEATHER_CHAN_END_FREQ 5640 923 924 #endif 925 926 /** 927 * dfs_set_rcac_enable() - Set rcac enable flag. 928 * @dfs: Pointer to wlan_dfs structure. 929 * @rcac_en: input value to configure rolling cac feature. 930 */ 931 #ifdef QCA_SUPPORT_ADFS_RCAC 932 QDF_STATUS dfs_set_rcac_enable(struct wlan_dfs *dfs, 933 bool rcac_en); 934 #else 935 static inline QDF_STATUS 936 dfs_set_rcac_enable(struct wlan_dfs *dfs, 937 bool rcac_en) 938 { 939 return QDF_STATUS_SUCCESS; 940 } 941 #endif 942 943 /** 944 * dfs_get_rcac_enable() - Get rcac enable flag. 945 * @dfs: Pointer to wlan_dfs structure. 946 * @rcac_en: Variable to hold the current rcac config. 947 */ 948 #ifdef QCA_SUPPORT_ADFS_RCAC 949 QDF_STATUS dfs_get_rcac_enable(struct wlan_dfs *dfs, 950 bool *rcac_en); 951 #else 952 static inline QDF_STATUS 953 dfs_get_rcac_enable(struct wlan_dfs *dfs, 954 bool *rcac_en) 955 { 956 return QDF_STATUS_SUCCESS; 957 } 958 #endif 959 960 /** 961 * dfs_set_rcac_freq() - Set user configured rolling CAC frequency. 962 * @dfs: Pointer to wlan_dfs structure. 963 * @rcac_freq: User preferred rolling cac frequency. 964 */ 965 #ifdef QCA_SUPPORT_ADFS_RCAC 966 QDF_STATUS dfs_set_rcac_freq(struct wlan_dfs *dfs, 967 qdf_freq_t rcac_freq); 968 #else 969 static inline QDF_STATUS 970 dfs_set_rcac_freq(struct wlan_dfs *dfs, 971 qdf_freq_t rcac_freq) 972 { 973 return QDF_STATUS_SUCCESS; 974 } 975 #endif 976 977 /** 978 * dfs_get_rcac_freq() - Get user configured rolling CAC frequency. 979 * @dfs: Pointer to wlan_dfs structure. 980 * @rcac_freq: Variable to store the user preferred rolling cac frequency. 981 */ 982 #ifdef QCA_SUPPORT_ADFS_RCAC 983 QDF_STATUS dfs_get_rcac_freq(struct wlan_dfs *dfs, 984 qdf_freq_t *rcac_freq); 985 #else 986 static inline QDF_STATUS 987 dfs_get_rcac_freq(struct wlan_dfs *dfs, 988 qdf_freq_t *rcac_freq) 989 { 990 return QDF_STATUS_SUCCESS; 991 } 992 #endif 993 994 /** 995 * dfs_rcac_timer_init() - Initialize rolling cac timer. 996 * @dfs_soc_obj: Pointer to DFS SOC object structure. 997 */ 998 #ifdef QCA_SUPPORT_ADFS_RCAC 999 void dfs_rcac_timer_init(struct dfs_soc_priv_obj *dfs_soc_obj); 1000 #else 1001 static inline void 1002 dfs_rcac_timer_init(struct dfs_soc_priv_obj *dfs_soc_obj) 1003 { 1004 } 1005 #endif 1006 1007 /** 1008 * dfs_rcac_timer_deinit() - Free rolling cac timer object. 1009 * @dfs_soc_obj: Pointer to dfs_soc_priv_obj structure. 1010 */ 1011 #ifdef QCA_SUPPORT_ADFS_RCAC 1012 void dfs_rcac_timer_deinit(struct dfs_soc_priv_obj *dfs_soc_obj); 1013 #else 1014 static inline void 1015 dfs_rcac_timer_deinit(struct dfs_soc_priv_obj *dfs_soc_obj) 1016 { 1017 } 1018 #endif 1019 1020 #ifdef QCA_SUPPORT_AGILE_DFS 1021 #define DFS_AGILE_SM_SPIN_LOCK(_soc_obj) \ 1022 qdf_spin_lock_bh(&((_soc_obj)->dfs_agile_sm_lock)) 1023 #define DFS_AGILE_SM_SPIN_UNLOCK(_soc_obj) \ 1024 qdf_spin_unlock_bh(&((_soc_obj)->dfs_agile_sm_lock)) 1025 1026 /** 1027 * dfs_agile_sm_deliver_evt() - Deliver the event to AGILE SM. 1028 * @dfs_soc_obj: Pointer to DFS soc object that holds the SM handle. 1029 * @event: Event ID. 1030 * @event_data_len: Length of event data. 1031 * @event_data: pointer to event data. 1032 * 1033 * Return: Success if event is handled, else failure. 1034 */ 1035 QDF_STATUS dfs_agile_sm_deliver_evt(struct dfs_soc_priv_obj *dfs_soc_obj, 1036 enum dfs_agile_sm_evt event, 1037 uint16_t event_data_len, 1038 void *event_data); 1039 1040 /** 1041 * dfs_agile_sm_create() - Create the AGILE state machine. 1042 * @dfs_soc_obj: Pointer to dfs_soc object that holds the SM handle. 1043 * 1044 * Return: QDF_STATUS_SUCCESS if successful, else failure status. 1045 */ 1046 QDF_STATUS dfs_agile_sm_create(struct dfs_soc_priv_obj *dfs_soc_obj); 1047 1048 /** 1049 * dfs_agile_sm_destroy() - Destroy the AGILE state machine. 1050 * @dfs_soc_obj: Pointer to dfs_soc object that holds the SM handle. 1051 * 1052 * Return: QDF_STATUS_SUCCESS if successful, else failure status. 1053 */ 1054 QDF_STATUS dfs_agile_sm_destroy(struct dfs_soc_priv_obj *dfs_soc_obj); 1055 1056 /** 1057 * dfs_is_agile_cac_enabled() - Determine if Agile PreCAC/RCAC is enabled. 1058 * @dfs: Pointer to struct wlan_dfs. 1059 * 1060 * Return: True if either Agile PreCAC/RCAC is enabled, false otherwise. 1061 */ 1062 bool dfs_is_agile_cac_enabled(struct wlan_dfs *dfs); 1063 1064 /* dfs_translate_chwidth_enum2val() - Translate the given channel width enum 1065 * to it's value. 1066 * @dfs: Pointer to WLAN DFS structure. 1067 * @chwidth: Channel width enum of the pdev's current channel. 1068 * 1069 * Return: The Bandwidth value for the given channel width enum. 1070 */ 1071 uint16_t 1072 dfs_translate_chwidth_enum2val(struct wlan_dfs *dfs, 1073 enum phy_ch_width chwidth); 1074 #else 1075 1076 static inline 1077 QDF_STATUS dfs_agile_sm_deliver_evt(struct dfs_soc_priv_obj *dfs_soc_obj, 1078 enum dfs_agile_sm_evt event, 1079 uint16_t event_data_len, 1080 void *event_data) 1081 { 1082 return QDF_STATUS_SUCCESS; 1083 } 1084 1085 static inline 1086 QDF_STATUS dfs_agile_sm_create(struct dfs_soc_priv_obj *dfs_soc_obj) 1087 { 1088 return QDF_STATUS_SUCCESS; 1089 } 1090 1091 static inline 1092 QDF_STATUS dfs_agile_sm_destroy(struct dfs_soc_priv_obj *dfs_soc_obj) 1093 { 1094 return QDF_STATUS_SUCCESS; 1095 } 1096 1097 static inline bool dfs_is_agile_cac_enabled(struct wlan_dfs *dfs) 1098 { 1099 return false; 1100 } 1101 1102 static inline uint16_t dfs_translate_chwidth_enum2val(struct wlan_dfs *dfs, 1103 enum phy_ch_width chwidth) 1104 { 1105 return false; 1106 } 1107 #endif /* QCA_SUPPORT_AGILE_DFS */ 1108 1109 #ifdef QCA_SUPPORT_ADFS_RCAC 1110 /** 1111 * dfs_is_agile_rcac_enabled() - Determine if Rolling CAC is enabled or not. 1112 * @dfs: Pointer to struct wlan_dfs. 1113 * 1114 * Following are the conditions needed to assertain that rolling CAC 1115 * is enabled: 1116 * 1. DFS domain of the PDEV must be FCC or MKK. 1117 * 2. User has enabled Rolling CAC configuration. 1118 * 3. FW capability to support ADFS. Only non-160 capability is checked here. 1119 * If we happen to choose the next RCAC channel as 160/80-80, 1120 * 'dfs_fw_adfs_support_160' is also verified. 1121 * 1122 * 1123 * Return: True if RCAC support is enabled, false otherwise. 1124 */ 1125 bool dfs_is_agile_rcac_enabled(struct wlan_dfs *dfs); 1126 1127 /** 1128 * dfs_prepare_agile_rcac_channel() - Prepare agile RCAC channel. 1129 * @dfs: Pointer to struct wlan_dfs. 1130 * @is_rcac_chan_available: Flag to indicate if a valid RCAC channel is 1131 * found. 1132 */ 1133 void dfs_prepare_agile_rcac_channel(struct wlan_dfs *dfs, 1134 bool *is_rcac_chan_available); 1135 /** 1136 * dfs_start_agile_rcac_timer() - Start Agile RCAC timer. 1137 * @dfs: Pointer to struct wlan_dfs. 1138 * 1139 */ 1140 void dfs_start_agile_rcac_timer(struct wlan_dfs *dfs); 1141 1142 /** 1143 * dfs_stop_agile_rcac_timer() - Stop Agile RCAC timer. 1144 * @dfs: Pointer to struct wlan_dfs. 1145 * 1146 */ 1147 void dfs_stop_agile_rcac_timer(struct wlan_dfs *dfs); 1148 #else 1149 static inline bool dfs_is_agile_rcac_enabled(struct wlan_dfs *dfs) 1150 { 1151 return false; 1152 } 1153 1154 static inline void 1155 dfs_prepare_agile_rcac_channel(struct wlan_dfs *dfs, 1156 bool *is_rcac_chan_available) 1157 { 1158 } 1159 1160 static inline void dfs_start_agile_rcac_timer(struct wlan_dfs *dfs) 1161 { 1162 } 1163 1164 static inline void dfs_stop_agile_rcac_timer(struct wlan_dfs *dfs) 1165 { 1166 } 1167 #endif /* QCA_SUPPORT_ADFS_RCAC */ 1168 1169 #if defined(QCA_SUPPORT_AGILE_DFS) || defined(ATH_SUPPORT_ZERO_CAC_DFS) || \ 1170 defined(QCA_SUPPORT_ADFS_RCAC) 1171 /** 1172 * dfs_process_radar_ind_on_agile_chan() - Process radar indication event on 1173 * agile channel. 1174 * @dfs: Pointer to wlan_dfs structure. 1175 * @radar_found: Pointer to radar_found_info structure. 1176 * 1177 * Return: QDF_STATUS 1178 */ 1179 QDF_STATUS 1180 dfs_process_radar_ind_on_agile_chan(struct wlan_dfs *dfs, 1181 struct radar_found_info *radar_found); 1182 #else 1183 static inline QDF_STATUS 1184 dfs_process_radar_ind_on_agile_chan(struct wlan_dfs *dfs, 1185 struct radar_found_info *radar_found) 1186 { 1187 return QDF_STATUS_E_FAILURE; 1188 } 1189 #endif 1190 1191 #ifdef ATH_SUPPORT_ZERO_CAC_DFS 1192 /** 1193 * dfs_precac_status_for_channel() - Find the preCAC status of the given 1194 * channel. 1195 * 1196 * @dfs: Pointer to wlan_dfs dfs. 1197 * @deschan: DFS channel to check preCAC status. 1198 * 1199 * Return: 1200 * DFS_NO_PRECAC_COMPLETED_CHANS - 0 preCAC completed channels. 1201 * DFS_PRECAC_COMPLETED_CHAN - Given channel is preCAC completed. 1202 * DFS_PRECAC_REQUIRED_CHAN - Given channel requires preCAC. 1203 */ 1204 enum precac_status_for_chan 1205 dfs_precac_status_for_channel(struct wlan_dfs *dfs, 1206 struct dfs_channel *deschan); 1207 #else 1208 static inline enum precac_status_for_chan 1209 dfs_precac_status_for_channel(struct wlan_dfs *dfs, 1210 struct dfs_channel *deschan) 1211 { 1212 return DFS_INVALID_PRECAC_STATUS; 1213 } 1214 #endif 1215 1216 #if (defined(QCA_SUPPORT_AGILE_DFS) || defined(QCA_SUPPORT_ADFS_RCAC)) && \ 1217 defined(WLAN_DFS_TRUE_160MHZ_SUPPORT) && defined(WLAN_DFS_FULL_OFFLOAD) 1218 /** 1219 * dfs_translate_radar_params_for_agile_chan() - Translate radar params from 1220 * 160MHz synthesizer model to 80MHz synthesizer model for Agile channel. 1221 * @dfs: Pointer to wlan_dfs dfs. 1222 * @r_info: Radar found parameters received from FW that are converted to 80MHz 1223 * syntesizer model(both input and output). 1224 * 1225 * Return: void. 1226 */ 1227 1228 void dfs_translate_radar_params_for_agile_chan(struct wlan_dfs *dfs, 1229 struct radar_found_info *r_info); 1230 #else 1231 static inline void 1232 dfs_translate_radar_params_for_agile_chan(struct wlan_dfs *dfs, 1233 struct radar_found_info *r_info) 1234 { 1235 } 1236 #endif 1237 1238 /** 1239 * dfs_is_subset_channel_for_freq() - Find out if prev channel and current 1240 * channel are subsets of each other. 1241 * @old_subchans_freq: Pointer to previous sub-channels freq. 1242 * @old_n_chans: Number of previous sub-channels. 1243 * @new_subchans_freq: Pointer to new sub-channels freq. 1244 * @new_n_chans: Number of new sub-channels 1245 */ 1246 #ifdef CONFIG_CHAN_FREQ_API 1247 bool 1248 dfs_is_subset_channel_for_freq(uint16_t *old_subchans_freq, 1249 uint8_t old_n_chans, 1250 uint16_t *new_subchans_freq, 1251 uint8_t new_n_chans); 1252 #endif 1253 1254 #ifdef QCA_DFS_BW_EXPAND 1255 /** 1256 * dfs_bwexpand_find_usr_cnf_chan() - Find the User configured channel for 1257 * BW Expand. 1258 * @dfs: Pointer to wlan_dfs object. 1259 * 1260 * Return: User configured frequency. 1261 */ 1262 qdf_freq_t dfs_bwexpand_find_usr_cnf_chan(struct wlan_dfs *dfs); 1263 1264 /** 1265 * dfs_bwexpand_try_jumping_to_target_subchan() - Expand the current channel 1266 * bandwidth or jump to a (subset of) user configured target channel. 1267 * Example: Current channel is 60 HT20 and user configured target channel is 1268 * 100 HT160. Agile SM runs on the subchans with 20Mhz BW of 100 HT160, here 1269 * Agile SM runs on 100HT20 and after completion of agile CAC, it checks 1270 * the API dfs_bwexpand_try_jumping_to_target_subchan for possibility of 1271 * BW Expansion and only 20Mhz subchan is available. There is no possible for 1272 * higher bandwidth channel. Then agile CAC runs on the adjacent subchannel 1273 * 104 HT20. After agile CAC completion, the API is checked again for possible 1274 * bandwidth expansion and 102 HT40 is available. The API invokes channel change 1275 * to higher bandwidth. 1276 * @dfs: Pointer to wlan_dfs object. 1277 * 1278 * Return: TRUE, if Bandwidth expansion is success. 1279 * FALSE, if Bandwidth expansion is failure. 1280 */ 1281 bool dfs_bwexpand_try_jumping_to_target_subchan(struct wlan_dfs *dfs); 1282 1283 /** 1284 * dfs_is_rcac_cac_done()- Check RCAC is completed on the subset of the 1285 * user configured target channel. 1286 * @dfs: Pointer to wlan_dfs. 1287 * @chan: Pointer to dfs_channel object of user configured target channel. 1288 * @subset_chan: Pointer to dfs_channel object of subchannel in which RCAC is 1289 * completed. 1290 * 1291 * Return: Boolean value. 1292 */ 1293 bool dfs_is_rcac_cac_done(struct wlan_dfs *dfs, 1294 struct dfs_channel *chan, 1295 struct dfs_channel *subset_chan); 1296 1297 /* 1298 * dfs_get_configured_bwexpand_dfs_chan() - Get a DFS chan when frequency and 1299 * phymode is provided. 1300 * @dfs: pointer to wlan_dfs. 1301 * @user_chan: pointer to dfs_channel. 1302 * @target_mode: phymode of type wlan_phymode. 1303 */ 1304 bool dfs_get_configured_bwexpand_dfs_chan(struct wlan_dfs *dfs, 1305 struct dfs_channel *user_chan, 1306 enum wlan_phymode target_mode); 1307 #else 1308 static inline 1309 qdf_freq_t dfs_bwexpand_find_usr_cnf_chan(struct wlan_dfs *dfs) 1310 { 1311 return 0; 1312 } 1313 1314 static inline 1315 bool dfs_bwexpand_try_jumping_to_target_subchan(struct wlan_dfs *dfs) 1316 { 1317 return false; 1318 } 1319 1320 static inline 1321 bool dfs_is_rcac_cac_done(struct wlan_dfs *dfs, 1322 struct dfs_channel *chan, 1323 struct dfs_channel *subset_chan) 1324 { 1325 return false; 1326 } 1327 1328 static inline 1329 bool dfs_get_configured_bwexpand_dfs_chan(struct wlan_dfs *dfs, 1330 struct dfs_channel *user_chan, 1331 enum wlan_phymode target_mode) 1332 { 1333 return false; 1334 } 1335 #endif /* QCA_DFS_BW_EXPAND */ 1336 #endif /* _DFS_ZERO_CAC_H_ */ 1337