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