1 /*
2  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2023 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 #ifdef WLAN_FEATURE_11BE
39 #define TREE_DEPTH_320                    5
40 #define TREE_DEPTH_MAX                    TREE_DEPTH_320
41 #else
42 #define TREE_DEPTH_MAX                    TREE_DEPTH_160
43 #endif
44 
45 #define TREE_DEPTH_160                    4
46 #define TREE_DEPTH_80                     3
47 #define TREE_DEPTH_40                     2
48 #define TREE_DEPTH_20                     1
49 #define N_SUBCHANS_FOR_80BW               4
50 #define N_SUBCHANS_FOR_160BW              8
51 
52 #define INITIAL_20_CHAN_OFFSET           -6
53 #define INITIAL_40_CHAN_OFFSET           -4
54 #define INITIAL_80_CHAN_OFFSET            0
55 
56 #define NEXT_20_CHAN_OFFSET               4
57 #define NEXT_40_CHAN_OFFSET               8
58 #define NEXT_80_CHAN_OFFSET              16
59 
60 #define DFS_CHWIDTH_20_VAL               20
61 #define DFS_CHWIDTH_40_VAL               40
62 #define DFS_CHWIDTH_80_VAL               80
63 #define DFS_CHWIDTH_160_VAL             160
64 #define DFS_CHWIDTH_165_VAL             165
65 #define DFS_CHWIDTH_240_VAL             240
66 #define DFS_CHWIDTH_320_VAL             320
67 
68 #define WEATHER_CHAN_START              120
69 #define WEATHER_CHAN_END                128
70 
71 /* PreCAC timeout durations in ms. */
72 #define MIN_PRECAC_DURATION                   (6 * 60 * 1000) /* 6 mins */
73 #define MIN_WEATHER_PRECAC_DURATION          (60 * 60 * 1000) /* 1 hour */
74 #define MAX_PRECAC_DURATION              (4 * 60 * 60 * 1000) /* 4 hours */
75 #define MAX_WEATHER_PRECAC_DURATION     (24 * 60 * 60 * 1000) /* 24 hours */
76 #define MIN_RCAC_DURATION                     (62 * 1000) /* 62 seconds */
77 #define MAX_RCAC_DURATION                     0xffffffff
78 
79 #define PCAC_DFS_INDEX_ZERO               0
80 #define PCAC_TIMER_NOT_RUNNING            0
81 #define PRECAC_NOT_STARTED                0
82 
83 /* While building precac tree, the center of the 165MHz channel or the
84  * restricted 80p80 channel(which includes channels 132, 136, 140, 144,
85  * 149, 153, 157 and 161) is assumed to be 146(center channel) or
86  * 5730(center frequency).
87  */
88 #define RESTRICTED_80P80_CHAN_CENTER_FREQ     5730
89 #define RESTRICTED_80P80_LEFT_80_CENTER_CHAN  138
90 #define RESTRICTED_80P80_RIGHT_80_CENTER_CHAN 155
91 #define RESTRICTED_80P80_LEFT_80_CENTER_FREQ  5690
92 #define RESTRICTED_80P80_RIGHT_80_CENTER_FREQ 5775
93 
94 /* While building the precac tree with 320 MHz root, the center of the
95  * right side 160 MHz channel(which includes real IEEE channels 132, 136,
96  * 140, 144 and pseudo IEEE channels 148, 152, 156, 160)
97  */
98 #define CENTER_OF_320_MHZ                     5650
99 #define CENTER_OF_PSEUDO_160                  5730
100 #define LAST_20_CENTER_OF_FIRST_160           5320
101 #define FIRST_20_CENTER_OF_LAST_80            5745
102 
103 /* Depth of the tree of a given bandwidth. */
104 #define DEPTH_320_ROOT                           0
105 #define DEPTH_160_ROOT                           1
106 #define DEPTH_80_ROOT                            2
107 #define DEPTH_40_ROOT                            3
108 #define DEPTH_20_ROOT                            4
109 
110 #ifdef QCA_DFS_BW_EXPAND
111 /* Column of the phymode_decoupler array */
112 enum phymode_decoupler_col {
113 	CH_WIDTH_COL = 1
114 };
115 #endif /* QCA_DFS_BW_EXPAND */
116 
117 /**
118  * struct precac_tree_node - Individual tree node structure for every node in
119  *                           the precac forest maintained.
120  * @left_child:        Pointer to the left child of the node.
121  * @right_child:       Pointer to the right child of the node.
122  * @ch_ieee:           Center channel ieee value.
123  * @ch_freq:           Center channel frequency value (BSTree node key value).
124  * @n_caced_subchs:    Number of CACed subchannels of the ch_ieee.
125  * @n_nol_subchs:      Number of subchannels of the ch_ieee in NOL.
126  * @n_valid_subchs:    Number of subchannels of the ch_ieee available (as per
127  *                     the country's channel list).
128  * @bandwidth:         Bandwidth of the ch_ieee (in the current node).
129  * @depth:             Depth of the precac tree node.
130  */
131 struct precac_tree_node {
132 	struct precac_tree_node *left_child;
133 	struct precac_tree_node *right_child;
134 	uint8_t ch_ieee;
135 	uint8_t n_caced_subchs;
136 	uint8_t n_nol_subchs;
137 	uint8_t n_valid_subchs;
138 	uint8_t depth;
139 	uint16_t bandwidth;
140 	uint16_t ch_freq;
141 };
142 
143 /**
144  * enum precac_chan_state - Enum for PreCAC state of a channel.
145  * @PRECAC_ERR:            Invalid preCAC state.
146  * @PRECAC_REQUIRED:       preCAC need to be done on the channel.
147  * @PRECAC_NOW:            preCAC is running on the channel.
148  * @PRECAC_DONE:           preCAC is done and channel is clear.
149  * @PRECAC_NOL:            preCAC is done and radar is detected.
150  */
151 enum precac_chan_state {
152 	PRECAC_ERR      = -1,
153 	PRECAC_REQUIRED,
154 	PRECAC_NOW,
155 	PRECAC_DONE,
156 	PRECAC_NOL,
157 };
158 
159 /**
160  * struct dfs_precac_entry - PreCAC entry.
161  * @pe_list:           PreCAC entry.
162  * @vht80_ch_ieee:     VHT80 centre channel IEEE value.
163  * @vht80_ch_freq:     VHT80 centre channel frequency value.
164  * @center_ch_ieee:    Center channel IEEE value of given bandwidth 20/40/80/
165  *                     160. For 165MHz channel, the value is 146.
166  * @center_ch_freq:    Center frequency of given bandwidth 20/40/80/160. For
167  *                     165MHz channel, the value is 5730.
168  * @bw:                Bandwidth of the precac entry.
169  * @dfs:               Pointer to wlan_dfs structure.
170  * @tree_root:         Tree root node with 80MHz channel key.
171  * @non_dfs_subch_count: Number of non DFS subchannels in the entry.
172  */
173 struct dfs_precac_entry {
174 	TAILQ_ENTRY(dfs_precac_entry) pe_list;
175 	uint8_t             vht80_ch_ieee;
176 	uint16_t            vht80_ch_freq;
177 	uint8_t             center_ch_ieee;
178 	uint16_t            center_ch_freq;
179 	uint16_t            bw;
180 	struct wlan_dfs     *dfs;
181 	struct precac_tree_node *tree_root;
182 	uint8_t             non_dfs_subch_count;
183 };
184 
185 /**
186  * dfs_zero_cac_timer_init() - Initialize zero-cac timers
187  * @dfs_soc_obj: Pointer to DFS SOC object structure.
188  */
189 #if defined(ATH_SUPPORT_ZERO_CAC_DFS) && !defined(MOBILE_DFS_SUPPORT)
190 void dfs_zero_cac_timer_init(struct dfs_soc_priv_obj *dfs_soc_obj);
191 #else
192 static inline void
dfs_zero_cac_timer_init(struct dfs_soc_priv_obj * dfs_soc_obj)193 dfs_zero_cac_timer_init(struct dfs_soc_priv_obj *dfs_soc_obj)
194 {
195 }
196 #endif
197 /**
198  * dfs_print_precaclists() - Print precac list.
199  * @dfs: Pointer to wlan_dfs structure.
200  */
201 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \
202 				     defined(QCA_SUPPORT_AGILE_DFS))
203 void dfs_print_precaclists(struct wlan_dfs *dfs);
204 #else
dfs_print_precaclists(struct wlan_dfs * dfs)205 static inline void dfs_print_precaclists(struct wlan_dfs *dfs)
206 {
207 }
208 #endif
209 
210 /**
211  * dfs_reset_precac_lists() - Resets the precac lists.
212  * @dfs: Pointer to wlan_dfs structure.
213  */
214 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \
215 				     defined(QCA_SUPPORT_AGILE_DFS))
216 void dfs_reset_precac_lists(struct wlan_dfs *dfs);
217 #else
dfs_reset_precac_lists(struct wlan_dfs * dfs)218 static inline void dfs_reset_precac_lists(struct wlan_dfs *dfs)
219 {
220 }
221 #endif
222 
223 /**
224  * dfs_reset_precaclists() - Clears and initializes precac_list.
225  * @dfs: Pointer to wlan_dfs structure.
226  */
227 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \
228 				     defined(QCA_SUPPORT_AGILE_DFS))
229 void dfs_reset_precaclists(struct wlan_dfs *dfs);
230 #else
dfs_reset_precaclists(struct wlan_dfs * dfs)231 static inline void dfs_reset_precaclists(struct wlan_dfs *dfs)
232 {
233 }
234 #endif
235 
236 /**
237  * dfs_deinit_precac_list() - Clears the precac list.
238  * @dfs: Pointer to wlan_dfs dtructure.
239  */
240 void dfs_deinit_precac_list(struct wlan_dfs *dfs);
241 
242 /**
243  * dfs_zero_cac_detach() - Free zero_cac memory.
244  * @dfs: Pointer to wlan_dfs dtructure.
245  */
246 #if !defined(MOBILE_DFS_SUPPORT) && defined(ATH_SUPPORT_ZERO_CAC_DFS)
247 void dfs_zero_cac_detach(struct wlan_dfs *dfs);
248 #else
dfs_zero_cac_detach(struct wlan_dfs * dfs)249 static inline void dfs_zero_cac_detach(struct wlan_dfs *dfs)
250 {
251 }
252 #endif
253 
254 /**
255  * dfs_init_precac_list() - Init precac list.
256  * @dfs: Pointer to wlan_dfs dtructure.
257  */
258 void dfs_init_precac_list(struct wlan_dfs *dfs);
259 
260 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \
261 				     defined(QCA_SUPPORT_AGILE_DFS))
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
dfs_start_precac_timer_for_freq(struct wlan_dfs * dfs,uint16_t precac_chan_freq)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) && defined(ATH_SUPPORT_ZERO_CAC_DFS)
286 void dfs_cancel_precac_timer(struct wlan_dfs *dfs);
287 #else
dfs_cancel_precac_timer(struct wlan_dfs * dfs)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) && defined(ATH_SUPPORT_ZERO_CAC_DFS)
298 void dfs_zero_cac_attach(struct wlan_dfs *dfs);
299 #else
dfs_zero_cac_attach(struct wlan_dfs * dfs)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) && defined(ATH_SUPPORT_ZERO_CAC_DFS)
310 void dfs_zero_cac_reset(struct wlan_dfs *dfs);
311 #else
dfs_zero_cac_reset(struct wlan_dfs * dfs)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
dfs_zero_cac_timer_detach(struct dfs_soc_priv_obj * dfs_soc_obj)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) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \
340 				     defined(QCA_SUPPORT_AGILE_DFS))
341 bool dfs_is_precac_done(struct wlan_dfs *dfs, struct dfs_channel *chan);
342 #else
dfs_is_precac_done(struct wlan_dfs * dfs,struct dfs_channel * chan)343 static inline bool dfs_is_precac_done(struct wlan_dfs *dfs,
344 				      struct dfs_channel *chan)
345 {
346 	return false;
347 }
348 #endif
349 
350 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT
351 /**
352  * dfs_decide_precac_preferred_chan_for_freq() - Choose operating channel among
353  *                                      configured DFS channel and
354  *                                      intermediate channel based on
355  *                                      precac status of configured
356  *                                      DFS channel.
357  * @dfs: Pointer to wlan_dfs structure.
358  * @pref_chan_freq: Configured DFS channel frequency
359  * @mode: Configured PHY mode.
360  *
361  * Return: True if intermediate channel needs to configure. False otherwise.
362  */
363 
364 #ifdef CONFIG_CHAN_FREQ_API
365 bool
366 dfs_decide_precac_preferred_chan_for_freq(struct wlan_dfs *dfs,
367 					  uint16_t *pref_chan_freq,
368 					  enum wlan_phymode mode);
369 #endif
370 #else
371 #ifdef CONFIG_CHAN_FREQ_API
372 static inline void
dfs_decide_precac_preferred_chan_for_freq(struct wlan_dfs * dfs,uint8_t * pref_chan,enum wlan_phymode mode)373 dfs_decide_precac_preferred_chan_for_freq(struct wlan_dfs *dfs,
374 					  uint8_t *pref_chan,
375 					  enum wlan_phymode mode)
376 {
377 }
378 #endif
379 #endif
380 
381 /**
382  * dfs_get_ieeechan_for_precac_for_freq() - Get chan of required bandwidth from
383  *                                 precac_list.
384  * @dfs:                 Pointer to wlan_dfs structure.
385  * @exclude_pri_chan_freq: Primary channel freq to be excluded for preCAC.
386  * @exclude_sec_chan_freq: Secondary channel freq to be excluded for preCAC.
387  * @bandwidth:           Bandwidth of requested channel.
388  */
389 #ifdef CONFIG_CHAN_FREQ_API
390 uint16_t dfs_get_ieeechan_for_precac_for_freq(struct wlan_dfs *dfs,
391 					      uint16_t exclude_pri_chan_freq,
392 					      uint16_t exclude_sec_chan_freq,
393 					      uint16_t bandwidth);
394 #endif
395 
396 /**
397  * dfs_override_precac_timeout() - Override the default precac timeout.
398  * @dfs: Pointer to wlan_dfs structure.
399  * @precac_timeout: Precac timeout value.
400  */
401 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \
402 				     defined(QCA_SUPPORT_AGILE_DFS))
403 int dfs_override_precac_timeout(struct wlan_dfs *dfs,
404 		int precac_timeout);
405 #else
dfs_override_precac_timeout(struct wlan_dfs * dfs,int precac_timeout)406 static inline int dfs_override_precac_timeout(struct wlan_dfs *dfs,
407 		int precac_timeout)
408 {
409 	return 0;
410 }
411 #endif
412 
413 /**
414  * dfs_get_override_precac_timeout() - Get precac timeout.
415  * @dfs: Pointer wlan_dfs structure.
416  * @precac_timeout: Get precac timeout value in this variable.
417  */
418 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \
419 				     defined(QCA_SUPPORT_AGILE_DFS))
420 int dfs_get_override_precac_timeout(struct wlan_dfs *dfs,
421 		int *precac_timeout);
422 #else
dfs_get_override_precac_timeout(struct wlan_dfs * dfs,int * precac_timeout)423 static inline int dfs_get_override_precac_timeout(struct wlan_dfs *dfs,
424 		int *precac_timeout)
425 {
426 	return 0;
427 }
428 #endif
429 
430 #if defined(QCA_SUPPORT_AGILE_DFS)
431 /**
432  * dfs_find_pdev_for_agile_precac() - Find pdev to select channel for precac.
433  * @pdev: Pointer to wlan_objmgr_pdev structure.
434  * @cur_agile_dfs_index: current agile dfs index
435  */
436 void dfs_find_pdev_for_agile_precac(struct wlan_objmgr_pdev *pdev,
437 				    uint8_t *cur_agile_dfs_index);
438 
439 /**
440  * dfs_prepare_agile_precac_chan() - Send Agile set request for given pdev.
441  * @dfs: Pointer to wlan_dfs structure.
442  * @is_chan_found: True if a channel is available for PreCAC, false otherwise.
443  */
444 void dfs_prepare_agile_precac_chan(struct wlan_dfs *dfs, bool *is_chan_found);
445 
446 /**
447  * dfs_process_ocac_complete() - Process Off-Channel CAC complete indication.
448  * @pdev :Pointer to wlan_objmgr_pdev structure.
449  * @ocac_status: Off channel CAC complete status
450  * @center_freq1 : For 20/40/80/160Mhz, it is the center of the corresponding
451  * band. For 80P80/165MHz, it is the center of the left 80MHz.
452  * @center_freq2 : It is valid and non-zero only for 80P80/165MHz. It indicates
453  * the Center Frequency of the right 80MHz segment.
454  * @chwidth : Width of the channel for which OCAC completion is received.
455  */
456 void dfs_process_ocac_complete(struct wlan_objmgr_pdev *pdev,
457 			       enum ocac_status_type ocac_status,
458 			       uint32_t center_freq1,
459 			       uint32_t center_freq2,
460 			       enum phy_ch_width chwidth);
461 
462 /*
463  * dfs_is_ocac_complete_event_for_cur_agile_chan() - Check if the OCAC
464  * completion event from FW is received for the currently configured agile
465  * channel in host.
466  *
467  * @dfs: Pointer to dfs structure.
468  * @center_freq_mhz1: Center frequency of the band when the precac width is
469  * 20/40/80/160MHz and center frequency of the left 80MHz in case of restricted
470  * 80P80/165MHz.
471  * @center_freq_mhz2: Center frequency of the right 80MHz in case of restricted
472  * 80P80/165MHz. It is zero for other channel widths.
473  * @chwidth: Agile channel width for which the completion event is received.
474  *
475  * return: True if the channel on which OCAC completion event received is same
476  * as currently configured agile channel in host. False otherwise.
477  */
478 bool dfs_is_ocac_complete_event_for_cur_agile_chan(struct wlan_dfs *dfs);
479 /**
480  * dfs_set_agilecac_chan_for_freq() - Find chan freq for agile CAC.
481  * @dfs:         Pointer to wlan_dfs structure.
482  * @chan_freq:     Pointer to channel freq for agile set request.
483  * @pri_chan_freq: Current primary IEEE channel freq.
484  * @sec_chan_freq: Current secondary IEEE channel freq (in HT80_80 mode).
485  *
486  * Find an IEEE channel freq for agileCAC which is not the current operating
487  * channels (indicated by pri_chan_freq, sec_chan_freq).
488  */
489 #ifdef CONFIG_CHAN_FREQ_API
490 void dfs_set_agilecac_chan_for_freq(struct wlan_dfs *dfs,
491 				    uint16_t *chan_freq,
492 				    uint16_t pri_chan_freq,
493 				    uint16_t sec_chan_freq);
494 #endif
495 
496 /**
497  * dfs_compute_agile_and_curchan_width() - Compute the agile/current channel
498  * width from dfs structure.
499  * @dfs: Pointer to wlan_dfs structure.
500  * @agile_ch_width: Agile channel width.
501  * @cur_ch_width: Current home channel width.
502  */
503 void
504 dfs_compute_agile_and_curchan_width(struct wlan_dfs *dfs,
505 				    enum phy_ch_width *agile_ch_width,
506 				    enum phy_ch_width *cur_ch_width);
507 
508 /**
509  * dfs_agile_precac_start() - Start agile precac.
510  * @dfs: Pointer to wlan_dfs structure.
511  */
512 void dfs_agile_precac_start(struct wlan_dfs *dfs);
513 
514 /**
515  * dfs_start_agile_precac_timer() - Start precac timer for the given channel.
516  * @dfs:         Pointer to wlan_dfs structure.
517  * @ocac_status: Status of the off channel CAC.
518  * @adfs_param:  Agile DFS CAC parameters.
519  *
520  * Start the precac timer with proper timeout values based on the channel to
521  * be preCACed. The preCAC channel number and chwidth information is present
522  * in the adfs_param argument. Once the timer is started, update the timeout
523  * fields in adfs_param.
524  */
525 void dfs_start_agile_precac_timer(struct wlan_dfs *dfs,
526 				  enum ocac_status_type ocac_status,
527 				  struct dfs_agile_cac_params *adfs_param);
528 
529 /**
530  * dfs_set_fw_adfs_support() - Set FW aDFS support in dfs object.
531  * @dfs: Pointer to wlan_dfs structure.
532  * @fw_adfs_support_160: aDFS enabled when pdev is on 160/80P80MHz.
533  * @fw_adfs_support_non_160: aDFS enabled when pdev is on 20/40/80MHz.
534  * @fw_adfs_support_320: aDFS enabled when pdev is on 320 MHz.
535  *
536  * Return: void.
537  */
538 void dfs_set_fw_adfs_support(struct wlan_dfs *dfs,
539 			     bool fw_adfs_support_160,
540 			     bool fw_adfs_support_non_160,
541 			     bool fw_adfs_support_320);
542 #else
dfs_find_pdev_for_agile_precac(struct wlan_objmgr_pdev * pdev,uint8_t * cur_agile_dfs_index)543 static inline void dfs_find_pdev_for_agile_precac(struct wlan_objmgr_pdev *pdev,
544 						  uint8_t *cur_agile_dfs_index)
545 {
546 }
547 
dfs_prepare_agile_precac_chan(struct wlan_dfs * dfs,bool * is_chan_found)548 static inline void dfs_prepare_agile_precac_chan(struct wlan_dfs *dfs,
549 						 bool *is_chan_found)
550 {
551 }
552 
553 static inline void
dfs_process_ocac_complete(struct wlan_objmgr_pdev * pdev,enum ocac_status_type ocac_status,uint32_t center_freq1,uint32_t center_freq2,enum phy_ch_width chwidth)554 dfs_process_ocac_complete(struct wlan_objmgr_pdev *pdev,
555 			  enum ocac_status_type ocac_status,
556 			  uint32_t center_freq1,
557 			  uint32_t center_freq2,
558 			  enum phy_ch_width chwidth)
559 {
560 }
561 
562 static inline bool
dfs_is_ocac_complete_event_for_cur_agile_chan(struct wlan_dfs * dfs)563 dfs_is_ocac_complete_event_for_cur_agile_chan(struct wlan_dfs *dfs)
564 {
565 	return false;
566 }
567 
568 #ifdef CONFIG_CHAN_FREQ_API
569 static inline void
dfs_set_agilecac_chan_for_freq(struct wlan_dfs * dfs,uint16_t * chan_freq,uint16_t pri_chan_freq,uint16_t sec_chan_freq)570 dfs_set_agilecac_chan_for_freq(struct wlan_dfs *dfs,
571 			       uint16_t *chan_freq,
572 			       uint16_t pri_chan_freq,
573 			       uint16_t sec_chan_freq)
574 {
575 }
576 #endif
577 
578 static inline void
dfs_compute_agile_and_curchan_width(struct wlan_dfs * dfs,enum phy_ch_width * agile_ch_width,enum phy_ch_width * cur_ch_width)579 dfs_compute_agile_and_curchan_width(struct wlan_dfs *dfs,
580 				    enum phy_ch_width *agile_ch_width,
581 				    enum phy_ch_width *cur_ch_width)
582 {
583 }
584 
dfs_agile_precac_start(struct wlan_dfs * dfs)585 static inline void dfs_agile_precac_start(struct wlan_dfs *dfs)
586 {
587 }
588 
589 static inline void
dfs_start_agile_precac_timer(struct wlan_dfs * dfs,enum ocac_status_type ocac_status,struct dfs_agile_cac_params * adfs_param)590 dfs_start_agile_precac_timer(struct wlan_dfs *dfs,
591 			     enum ocac_status_type ocac_status,
592 			     struct dfs_agile_cac_params *adfs_param)
593 {
594 }
595 
596 static inline void
dfs_set_fw_adfs_support(struct wlan_dfs * dfs,bool fw_adfs_support_160,bool fw_adfs_support_non_160,bool fw_adfs_support_320)597 dfs_set_fw_adfs_support(struct wlan_dfs *dfs,
598 			bool fw_adfs_support_160,
599 			bool fw_adfs_support_non_160,
600 			bool fw_adfs_support_320)
601 {
602 }
603 #endif
604 
605 #if defined(QCA_SUPPORT_AGILE_DFS) || defined(ATH_SUPPORT_ZERO_CAC_DFS)
606 /**
607  * dfs_agile_soc_obj_init() - Initialize soc obj for agile precac.
608  * @dfs: Pointer to wlan_dfs structure.
609  * @psoc: Pointer to psoc object
610  */
611 void dfs_agile_soc_obj_init(struct wlan_dfs *dfs,
612 			    struct wlan_objmgr_psoc *psoc);
613 #else
dfs_agile_soc_obj_init(struct wlan_dfs * dfs,struct wlan_objmgr_psoc * psoc)614 static inline void dfs_agile_soc_obj_init(struct wlan_dfs *dfs,
615 					  struct wlan_objmgr_psoc *psoc)
616 {
617 }
618 #endif
619 
620 /**
621  * dfs_set_precac_enable() - Set precac enable flag.
622  * @dfs: Pointer to wlan_dfs structure.
623  * @value: input value for dfs_legacy_precac_ucfg flag.
624  */
625 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \
626 				     defined(QCA_SUPPORT_AGILE_DFS))
627 void dfs_set_precac_enable(struct wlan_dfs *dfs,
628 		uint32_t value);
629 #else
dfs_set_precac_enable(struct wlan_dfs * dfs,uint32_t value)630 static inline void dfs_set_precac_enable(struct wlan_dfs *dfs,
631 		uint32_t value)
632 {
633 }
634 #endif
635 
636 /**
637  * dfs_is_agile_precac_enabled() - Check if agile preCAC is enabled for the DFS.
638  * @dfs: Pointer to the wlan_dfs object.
639  *
640  * Return: True if agile DFS is enabled, else false.
641  *
642  * For agile preCAC to be enabled,
643  * 1. User configuration should be set.
644  * 2. Target should support aDFS.
645  */
646 #ifdef QCA_SUPPORT_AGILE_DFS
647 bool dfs_is_agile_precac_enabled(struct wlan_dfs *dfs);
648 #else
dfs_is_agile_precac_enabled(struct wlan_dfs * dfs)649 static inline bool dfs_is_agile_precac_enabled(struct wlan_dfs *dfs)
650 {
651 	return false;
652 }
653 #endif
654 
655 /**
656  * dfs_is_precac_domain() - Check if current DFS domain supports preCAC.
657  * @dfs: Pointer to the wlan_dfs object.
658  *
659  * Return: True if current DFS domain supports preCAC, else false.
660  *
661  * preCAC is currently supported in,
662  * 1. ETSI domain.
663  *
664  */
665 #if defined(QCA_SUPPORT_AGILE_DFS) || defined(ATH_SUPPORT_ZERO_CAC_DFS)
666 bool dfs_is_precac_domain(struct wlan_dfs *dfs);
667 #else
dfs_is_precac_domain(struct wlan_dfs * dfs)668 static inline bool dfs_is_precac_domain(struct wlan_dfs *dfs)
669 {
670 	return false;
671 }
672 #endif
673 
674 /**
675  * dfs_is_rcac_domain() - Check if current DFS domain supports agile RCAC.
676  * @dfs: Pointer to the wlan_dfs object.
677  *
678  * Return: True if current DFS domain supports RCAC, else false.
679  *
680  * preCAC is currently supported in,
681  * 1. FCC domain.
682  * 2. MKK domain.
683  * 3. MKKN domain.
684  *
685  */
686 #if defined(QCA_SUPPORT_ADFS_RCAC)
687 bool dfs_is_rcac_domain(struct wlan_dfs *dfs);
688 #else
dfs_is_rcac_domain(struct wlan_dfs * dfs)689 static inline bool dfs_is_rcac_domain(struct wlan_dfs *dfs)
690 {
691 	return false;
692 }
693 #endif
694 
695 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT
696 /**
697  * dfs_set_precac_intermediate_chan() - Set intermediate chan to be used while
698  *                                      doing precac.
699  * @dfs: Pointer to wlan_dfs structure.
700  * @value: input value for dfs_legacy_precac_ucfg flag.
701  *
702  * Return:
703  * * 0       - Successfully set intermediate channel.
704  * * -EINVAL - Invalid channel.
705  */
706 int32_t dfs_set_precac_intermediate_chan(struct wlan_dfs *dfs,
707 					 uint32_t value);
708 #else
dfs_set_precac_intermediate_chan(struct wlan_dfs * dfs,uint32_t value)709 static inline int32_t dfs_set_precac_intermediate_chan(struct wlan_dfs *dfs,
710 						       uint32_t value)
711 {
712 	return 0;
713 }
714 #endif
715 
716 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT
717 /**
718  * dfs_get_precac_intermediate_chan() - Get configured precac
719  *					intermediate channel.
720  * @dfs: Pointer to wlan_dfs structure.
721  *
722  * Return: Configured intermediate channel number.
723  */
724 uint32_t dfs_get_precac_intermediate_chan(struct wlan_dfs *dfs);
725 #else
dfs_get_intermediate_chan(struct wlan_dfs * dfs)726 static inline uint32_t dfs_get_intermediate_chan(struct wlan_dfs *dfs)
727 {
728 	return 0;
729 }
730 #endif
731 
732 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT
733 
734 /**
735  * dfs_get_precac_chan_state_for_freq() - Get precac status of a given channel.
736  * @dfs: Pointer to wlan_dfs structure.
737  * @precac_chan_freq: Channel freq for which precac state need to be checked.
738  */
739 
740 #ifdef CONFIG_CHAN_FREQ_API
741 enum precac_chan_state
742 dfs_get_precac_chan_state_for_freq(struct wlan_dfs *dfs,
743 				   uint16_t precac_chan_freq);
744 #endif
745 
746 #else
747 #ifdef CONFIG_CHAN_FREQ_API
748 static inline enum precac_chan_state
dfs_get_precac_chan_state_for_freq(struct wlan_dfs * dfs,uint16_t precac_chan_freq)749 dfs_get_precac_chan_state_for_freq(struct wlan_dfs *dfs,
750 				   uint16_t precac_chan_freq)
751 {
752 	return PRECAC_REQUIRED;
753 }
754 #endif
755 #endif
756 
757 /**
758  * dfs_reinit_precac_lists() - Reinit DFS preCAC lists.
759  * @src_dfs: Source DFS from which the preCAC list is copied.
760  * @dest_dfs: Destination DFS to which the preCAC list is copied.
761  * @low_5g_freq: Low 5G frequency value of the destination DFS.
762  * @high_5g_freq: High 5G frequency value of the destination DFS.
763  *
764  * Copy all the preCAC list entries from the source DFS to the destination DFS
765  * which fall within the frequency range of low_5g_freq and high_5g_freq.
766  *
767  * Return: None (void).
768  */
769 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \
770 				     defined(QCA_SUPPORT_AGILE_DFS))
771 void dfs_reinit_precac_lists(struct wlan_dfs *src_dfs,
772 			     struct wlan_dfs *dest_dfs,
773 			     uint16_t low_5g_freq,
774 			     uint16_t high_5g_freq);
775 #else
dfs_reinit_precac_lists(struct wlan_dfs * src_dfs,struct wlan_dfs * dest_dfs,uint16_t low_5g_freq,uint16_t high_5g_freq)776 static inline void dfs_reinit_precac_lists(struct wlan_dfs *src_dfs,
777 					   struct wlan_dfs *dest_dfs,
778 					   uint16_t low_5g_freq,
779 					   uint16_t high_5g_freq)
780 {
781 }
782 #endif
783 
784 /**
785  * dfs_is_precac_done_on_non_80p80_chan_for_freq() - Is precac done on
786  * a 20/40/80/160/165/320 MHz channel.
787  * @dfs: Pointer to wlan_dfs structure.
788  * @chan_freq: Channel frequency
789  *
790  * Return:
791  * * True:  If CAC is done on channel.
792  * * False: If CAC is not done on channel.
793  */
794 #ifdef CONFIG_CHAN_FREQ_API
795 bool
796 dfs_is_precac_done_on_non_80p80_chan_for_freq(struct wlan_dfs *dfs,
797 					      uint16_t chan_freq);
798 #endif
799 
800 /**
801  * dfs_is_precac_done_on_80p80_chan() - Is precac done on 80+80 MHz channel.
802  * @dfs: Pointer to wlan_dfs structure.
803  * @chan: Pointer to dfs_channel for which preCAC done is checked.
804  *
805  * Return:
806  * * True:  If CAC is done on channel.
807  * * False: If CAC is not done on channel.
808  */
809 bool dfs_is_precac_done_on_80p80_chan(struct wlan_dfs *dfs,
810 				      struct dfs_channel *chan);
811 
812 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \
813 				     defined(QCA_SUPPORT_AGILE_DFS))
814 #ifdef CONFIG_CHAN_FREQ_API
815 /**
816  * dfs_find_curchwidth_and_center_chan_for_freq() - Find the channel width
817  *                                                  enum, primary and secondary
818  *                                                  center channel value of
819  *                                                  the current channel.
820  * @dfs:                  Pointer to wlan_dfs structure.
821  * @chwidth:              Channel width enum of current channel.
822  * @primary_chan_freq:    Primary IEEE channel freq.
823  * @secondary_chan_freq:  Secondary IEEE channel freq (in HT80_80 mode).
824  */
825 void
826 dfs_find_curchwidth_and_center_chan_for_freq(struct wlan_dfs *dfs,
827 					     enum phy_ch_width *chwidth,
828 					     uint16_t *primary_chan_freq,
829 					     uint16_t *secondary_chan_freq);
830 #endif
831 
832 #ifdef CONFIG_CHAN_FREQ_API
833 /**
834  * dfs_mark_precac_done_for_freq() - Mark the channel as preCAC done.
835  * @dfs:             Pointer to wlan_dfs structure.
836  * @pri_chan_freq:   Primary channel IEEE freq.
837  * @sec_chan_freq:   Secondary channel IEEE freq(only in HT80_80 mode).
838  * @chan_width:      Channel width enum.
839  */
840 void dfs_mark_precac_done_for_freq(struct wlan_dfs *dfs,
841 				   uint16_t pri_chan_freq,
842 				   uint16_t sec_chan_freq,
843 				   enum phy_ch_width chan_width);
844 #endif
845 
846 /**
847  * dfs_mark_precac_nol_for_freq() - Mark the precac channel as radar.
848  * @dfs:                              Pointer to wlan_dfs structure.
849  * @is_radar_found_on_secondary_seg:  Radar found on secondary seg for Cascade.
850  * @detector_id:                      detector id which found RADAR in HW.
851  * @freq_list:                         Array of radar found frequencies.
852  * @num_channels:                     Number of radar found subchannels.
853  */
854 #ifdef CONFIG_CHAN_FREQ_API
855 void dfs_mark_precac_nol_for_freq(struct wlan_dfs *dfs,
856 				  uint8_t is_radar_found_on_secondary_seg,
857 				  uint8_t detector_id,
858 				  uint16_t *freq_list,
859 				  uint8_t num_channels);
860 #endif
861 
862 /**
863  * dfs_unmark_precac_nol_for_freq() - Unmark the precac channel as radar.
864  * @dfs:      Pointer to wlan_dfs structure.
865  * @chan_freq:  channel freq marked as radar.
866  */
867 #ifdef CONFIG_CHAN_FREQ_API
868 void dfs_unmark_precac_nol_for_freq(struct wlan_dfs *dfs, uint16_t chan_freq);
869 #endif
870 
871 #else
872 
873 #ifdef CONFIG_CHAN_FREQ_API
874 static inline void
dfs_find_curchwidth_and_center_chan_for_freq(struct wlan_dfs * dfs,enum phy_ch_width * chwidth,uint16_t * primary_chan_freq,uint16_t * secondary_chan_freq)875 dfs_find_curchwidth_and_center_chan_for_freq(struct wlan_dfs *dfs,
876 					     enum phy_ch_width *chwidth,
877 					     uint16_t *primary_chan_freq,
878 					     uint16_t *secondary_chan_freq)
879 {
880 }
881 #endif
882 
883 #ifdef CONFIG_CHAN_FREQ_API
dfs_mark_precac_done_for_freq(struct wlan_dfs * dfs,uint16_t pri_chan_freq,uint16_t sec_chan_freq,enum phy_ch_width chan_width)884 static inline void dfs_mark_precac_done_for_freq(struct wlan_dfs *dfs,
885 						 uint16_t pri_chan_freq,
886 						 uint16_t sec_chan_freq,
887 						 enum phy_ch_width chan_width)
888 {
889 }
890 #endif
891 
892 #ifdef CONFIG_CHAN_FREQ_API
893 static inline void
dfs_mark_precac_nol_for_freq(struct wlan_dfs * dfs,uint8_t is_radar_found_on_secondary_seg,uint8_t detector_id,uint16_t * freq,uint8_t num_channels)894 dfs_mark_precac_nol_for_freq(struct wlan_dfs *dfs,
895 			     uint8_t is_radar_found_on_secondary_seg,
896 			     uint8_t detector_id,
897 			     uint16_t *freq,
898 			     uint8_t num_channels)
899 {
900 }
901 #endif
902 
903 #ifdef CONFIG_CHAN_FREQ_API
dfs_unmark_precac_nol_for_freq(struct wlan_dfs * dfs,uint16_t chan_freq)904 static inline void dfs_unmark_precac_nol_for_freq(struct wlan_dfs *dfs,
905 						  uint16_t chan_freq)
906 {
907 }
908 #endif
909 #endif
910 
911 /**
912  * dfs_is_precac_timer_running() - Check whether precac timer is running.
913  * @dfs: Pointer to wlan_dfs structure.
914  */
915 #if !defined(MOBILE_DFS_SUPPORT) && (defined(ATH_SUPPORT_ZERO_CAC_DFS) || \
916 				     defined(QCA_SUPPORT_AGILE_DFS))
917 bool dfs_is_precac_timer_running(struct wlan_dfs *dfs);
918 #else
dfs_is_precac_timer_running(struct wlan_dfs * dfs)919 static inline bool dfs_is_precac_timer_running(struct wlan_dfs *dfs)
920 {
921 	return false;
922 }
923 #endif
924 
925 #ifdef CONFIG_CHAN_FREQ_API
926 #define VHT160_FREQ_DIFF 80
927 
928 #define INITIAL_20_CHAN_FREQ_OFFSET           -70
929 #define INITIAL_40_CHAN_FREQ_OFFSET           -60
930 #define INITIAL_80_CHAN_FREQ_OFFSET           -40
931 #define INITIAL_160_CHAN_FREQ_OFFSET            0
932 
933 #define NEXT_20_CHAN_FREQ_OFFSET               20
934 #define NEXT_40_CHAN_FREQ_OFFSET               40
935 #define NEXT_80_CHAN_FREQ_OFFSET               80
936 #define NEXT_160_CHAN_FREQ_OFFSET             160
937 #define NEXT_320_CHAN_FREQ_OFFSET             320
938 
939 #define WEATHER_CHAN_START_FREQ              5600
940 #define WEATHER_CHAN_END_FREQ                5640
941 
942 #endif
943 
944 /**
945  * dfs_set_rcac_enable() - Set rcac enable flag.
946  * @dfs: Pointer to wlan_dfs structure.
947  * @rcac_en: input value to configure rolling cac feature.
948  */
949 #ifdef QCA_SUPPORT_ADFS_RCAC
950 QDF_STATUS dfs_set_rcac_enable(struct wlan_dfs *dfs,
951 			       bool rcac_en);
952 #else
953 static inline QDF_STATUS
dfs_set_rcac_enable(struct wlan_dfs * dfs,bool rcac_en)954 dfs_set_rcac_enable(struct wlan_dfs *dfs,
955 		    bool rcac_en)
956 {
957 	return QDF_STATUS_SUCCESS;
958 }
959 #endif
960 
961 /**
962  * dfs_get_rcac_enable() - Get rcac enable flag.
963  * @dfs: Pointer to wlan_dfs structure.
964  * @rcac_en: Variable to hold the current rcac config.
965  */
966 #ifdef QCA_SUPPORT_ADFS_RCAC
967 QDF_STATUS dfs_get_rcac_enable(struct wlan_dfs *dfs,
968 			       bool *rcac_en);
969 #else
970 static inline QDF_STATUS
dfs_get_rcac_enable(struct wlan_dfs * dfs,bool * rcac_en)971 dfs_get_rcac_enable(struct wlan_dfs *dfs,
972 		    bool *rcac_en)
973 {
974 	return QDF_STATUS_SUCCESS;
975 }
976 #endif
977 
978 /**
979  * dfs_set_rcac_freq() - Set user configured rolling CAC frequency.
980  * @dfs: Pointer to wlan_dfs structure.
981  * @rcac_freq: User preferred rolling cac frequency.
982  */
983 #ifdef QCA_SUPPORT_ADFS_RCAC
984 QDF_STATUS dfs_set_rcac_freq(struct wlan_dfs *dfs,
985 			     qdf_freq_t rcac_freq);
986 #else
987 static inline QDF_STATUS
dfs_set_rcac_freq(struct wlan_dfs * dfs,qdf_freq_t rcac_freq)988 dfs_set_rcac_freq(struct wlan_dfs *dfs,
989 		  qdf_freq_t rcac_freq)
990 {
991 	return QDF_STATUS_SUCCESS;
992 }
993 #endif
994 
995 /**
996  * dfs_get_rcac_freq() - Get user configured rolling CAC frequency.
997  * @dfs: Pointer to wlan_dfs structure.
998  * @rcac_freq: Variable to store the user preferred rolling cac frequency.
999  */
1000 #ifdef QCA_SUPPORT_ADFS_RCAC
1001 QDF_STATUS dfs_get_rcac_freq(struct wlan_dfs *dfs,
1002 			     qdf_freq_t *rcac_freq);
1003 #else
1004 static inline QDF_STATUS
dfs_get_rcac_freq(struct wlan_dfs * dfs,qdf_freq_t * rcac_freq)1005 dfs_get_rcac_freq(struct wlan_dfs *dfs,
1006 		  qdf_freq_t *rcac_freq)
1007 {
1008 	return QDF_STATUS_SUCCESS;
1009 }
1010 #endif
1011 
1012 /**
1013  * dfs_rcac_timer_init() - Initialize rolling cac timer.
1014  * @dfs_soc_obj: Pointer to DFS SOC object structure.
1015  */
1016 #ifdef QCA_SUPPORT_ADFS_RCAC
1017 void dfs_rcac_timer_init(struct dfs_soc_priv_obj *dfs_soc_obj);
1018 #else
1019 static inline void
dfs_rcac_timer_init(struct dfs_soc_priv_obj * dfs_soc_obj)1020 dfs_rcac_timer_init(struct dfs_soc_priv_obj *dfs_soc_obj)
1021 {
1022 }
1023 #endif
1024 
1025 /**
1026  * dfs_rcac_timer_deinit() - Free rolling cac timer object.
1027  * @dfs_soc_obj: Pointer to dfs_soc_priv_obj structure.
1028  */
1029 #ifdef QCA_SUPPORT_ADFS_RCAC
1030 void dfs_rcac_timer_deinit(struct dfs_soc_priv_obj *dfs_soc_obj);
1031 #else
1032 static inline void
dfs_rcac_timer_deinit(struct dfs_soc_priv_obj * dfs_soc_obj)1033 dfs_rcac_timer_deinit(struct dfs_soc_priv_obj *dfs_soc_obj)
1034 {
1035 }
1036 #endif
1037 
1038 #ifdef QCA_SUPPORT_AGILE_DFS
1039 #define DFS_AGILE_SM_SPIN_LOCK(_soc_obj) \
1040 	qdf_spin_lock_bh(&((_soc_obj)->dfs_agile_sm_lock))
1041 #define DFS_AGILE_SM_SPIN_UNLOCK(_soc_obj) \
1042 	qdf_spin_unlock_bh(&((_soc_obj)->dfs_agile_sm_lock))
1043 
1044 /**
1045  * dfs_agile_sm_deliver_evt() - Deliver the event to AGILE SM.
1046  * @dfs_soc_obj: Pointer to DFS soc object that holds the SM handle.
1047  * @event: Event ID.
1048  * @event_data_len: Length of event data.
1049  * @event_data: pointer to event data.
1050  *
1051  * Return: Success if event is handled, else failure.
1052  */
1053 QDF_STATUS dfs_agile_sm_deliver_evt(struct dfs_soc_priv_obj *dfs_soc_obj,
1054 				    enum dfs_agile_sm_evt event,
1055 				    uint16_t event_data_len,
1056 				    void *event_data);
1057 
1058 /**
1059  * dfs_agile_sm_create() - Create the AGILE state machine.
1060  * @dfs_soc_obj: Pointer to dfs_soc object that holds the SM handle.
1061  *
1062  * Return: QDF_STATUS_SUCCESS if successful, else failure status.
1063  */
1064 QDF_STATUS dfs_agile_sm_create(struct dfs_soc_priv_obj *dfs_soc_obj);
1065 
1066 /**
1067  * dfs_agile_sm_destroy() - Destroy the AGILE state machine.
1068  * @dfs_soc_obj: Pointer to dfs_soc object that holds the SM handle.
1069  *
1070  * Return: QDF_STATUS_SUCCESS if successful, else failure status.
1071  */
1072 QDF_STATUS dfs_agile_sm_destroy(struct dfs_soc_priv_obj *dfs_soc_obj);
1073 
1074 /**
1075  * dfs_is_agile_cac_enabled() - Determine if Agile PreCAC/RCAC is enabled.
1076  * @dfs: Pointer to struct wlan_dfs.
1077  *
1078  * Return: True if either Agile PreCAC/RCAC is enabled, false otherwise.
1079  */
1080 bool dfs_is_agile_cac_enabled(struct wlan_dfs *dfs);
1081 
1082 /* dfs_translate_chwidth_enum2val() - Translate the given channel width enum
1083  *                                    to it's value.
1084  * @dfs:     Pointer to WLAN DFS structure.
1085  * @chwidth: Channel width enum of the pdev's current channel.
1086  *
1087  * Return: The Bandwidth value for the given channel width enum.
1088  */
1089 uint16_t
1090 dfs_translate_chwidth_enum2val(struct wlan_dfs *dfs,
1091 			       enum phy_ch_width chwidth);
1092 #else
1093 
1094 static inline
dfs_agile_sm_deliver_evt(struct dfs_soc_priv_obj * dfs_soc_obj,enum dfs_agile_sm_evt event,uint16_t event_data_len,void * event_data)1095 QDF_STATUS dfs_agile_sm_deliver_evt(struct dfs_soc_priv_obj *dfs_soc_obj,
1096 				    enum dfs_agile_sm_evt event,
1097 				    uint16_t event_data_len,
1098 				    void *event_data)
1099 {
1100 	return QDF_STATUS_SUCCESS;
1101 }
1102 
1103 static inline
dfs_agile_sm_create(struct dfs_soc_priv_obj * dfs_soc_obj)1104 QDF_STATUS dfs_agile_sm_create(struct dfs_soc_priv_obj *dfs_soc_obj)
1105 {
1106 	return QDF_STATUS_SUCCESS;
1107 }
1108 
1109 static inline
dfs_agile_sm_destroy(struct dfs_soc_priv_obj * dfs_soc_obj)1110 QDF_STATUS dfs_agile_sm_destroy(struct dfs_soc_priv_obj *dfs_soc_obj)
1111 {
1112 	return QDF_STATUS_SUCCESS;
1113 }
1114 
dfs_is_agile_cac_enabled(struct wlan_dfs * dfs)1115 static inline bool dfs_is_agile_cac_enabled(struct wlan_dfs *dfs)
1116 {
1117 	return false;
1118 }
1119 
dfs_translate_chwidth_enum2val(struct wlan_dfs * dfs,enum phy_ch_width chwidth)1120 static inline uint16_t dfs_translate_chwidth_enum2val(struct wlan_dfs *dfs,
1121 						      enum phy_ch_width chwidth)
1122 {
1123 	return false;
1124 }
1125 #endif /* QCA_SUPPORT_AGILE_DFS */
1126 
1127 #ifdef QCA_SUPPORT_ADFS_RCAC
1128 /**
1129  * dfs_is_agile_rcac_enabled() - Determine if Rolling CAC is enabled or not.
1130  * @dfs: Pointer to struct wlan_dfs.
1131  *
1132  * Following are the conditions needed to assertain that rolling CAC
1133  * is enabled:
1134  * 1. DFS domain of the PDEV must be FCC or MKK.
1135  * 2. User has enabled Rolling CAC configuration.
1136  * 3. FW capability to support ADFS. Only non-160 capability is checked here.
1137  *    If we happen to choose the next RCAC channel as 160/80-80,
1138  *    'dfs_fw_adfs_support_160' is also verified.
1139  *
1140  *
1141  * Return: True if RCAC support is enabled, false otherwise.
1142  */
1143 bool dfs_is_agile_rcac_enabled(struct wlan_dfs *dfs);
1144 
1145 /**
1146  * dfs_prepare_agile_rcac_channel() - Prepare agile RCAC channel.
1147  * @dfs: Pointer to struct wlan_dfs.
1148  * @is_rcac_chan_available: Flag to indicate if a valid RCAC channel is
1149  *                          found.
1150  */
1151 void dfs_prepare_agile_rcac_channel(struct wlan_dfs *dfs,
1152 				    bool *is_rcac_chan_available);
1153 /**
1154  * dfs_start_agile_rcac_timer() - Start Agile RCAC timer.
1155  * @dfs: Pointer to struct wlan_dfs.
1156  *
1157  */
1158 void dfs_start_agile_rcac_timer(struct wlan_dfs *dfs);
1159 
1160 /**
1161  * dfs_stop_agile_rcac_timer() - Stop Agile RCAC timer.
1162  * @dfs: Pointer to struct wlan_dfs.
1163  *
1164  */
1165 void dfs_stop_agile_rcac_timer(struct wlan_dfs *dfs);
1166 
1167 /**
1168  * dfs_agile_cleanup_rcac() - Reset parameters of wlan_dfs relatewd to RCAC
1169  *
1170  * @dfs: Pointer to struct wlan_dfs.
1171  */
1172 void dfs_agile_cleanup_rcac(struct wlan_dfs *dfs);
1173 #else
dfs_is_agile_rcac_enabled(struct wlan_dfs * dfs)1174 static inline bool dfs_is_agile_rcac_enabled(struct wlan_dfs *dfs)
1175 {
1176 	return false;
1177 }
1178 
dfs_agile_cleanup_rcac(struct wlan_dfs * dfs)1179 static inline void dfs_agile_cleanup_rcac(struct wlan_dfs *dfs)
1180 {
1181 }
1182 
1183 static inline void
dfs_prepare_agile_rcac_channel(struct wlan_dfs * dfs,bool * is_rcac_chan_available)1184 dfs_prepare_agile_rcac_channel(struct wlan_dfs *dfs,
1185 			       bool *is_rcac_chan_available)
1186 {
1187 }
1188 
dfs_start_agile_rcac_timer(struct wlan_dfs * dfs)1189 static inline void dfs_start_agile_rcac_timer(struct wlan_dfs *dfs)
1190 {
1191 }
1192 
dfs_stop_agile_rcac_timer(struct wlan_dfs * dfs)1193 static inline void dfs_stop_agile_rcac_timer(struct wlan_dfs *dfs)
1194 {
1195 }
1196 #endif /* QCA_SUPPORT_ADFS_RCAC */
1197 
1198 #if defined(QCA_SUPPORT_AGILE_DFS) || defined(ATH_SUPPORT_ZERO_CAC_DFS) || \
1199 	defined(QCA_SUPPORT_ADFS_RCAC)
1200 /**
1201  * dfs_process_radar_ind_on_agile_chan() - Process radar indication event on
1202  * agile channel.
1203  * @dfs: Pointer to wlan_dfs structure.
1204  * @radar_found: Pointer to radar_found_info structure.
1205  *
1206  * Return: QDF_STATUS
1207  */
1208 QDF_STATUS
1209 dfs_process_radar_ind_on_agile_chan(struct wlan_dfs *dfs,
1210 				    struct radar_found_info *radar_found);
1211 #else
1212 static inline QDF_STATUS
dfs_process_radar_ind_on_agile_chan(struct wlan_dfs * dfs,struct radar_found_info * radar_found)1213 dfs_process_radar_ind_on_agile_chan(struct wlan_dfs *dfs,
1214 				    struct radar_found_info *radar_found)
1215 {
1216 	return QDF_STATUS_E_FAILURE;
1217 }
1218 #endif
1219 
1220 #ifdef ATH_SUPPORT_ZERO_CAC_DFS
1221 /**
1222  * dfs_precac_status_for_channel() - Find the preCAC status of the given
1223  * channel.
1224  *
1225  * @dfs: Pointer to wlan_dfs dfs.
1226  * @deschan: DFS channel to check preCAC status.
1227  *
1228  * Return:
1229  * DFS_NO_PRECAC_COMPLETED_CHANS - 0 preCAC completed channels.
1230  * DFS_PRECAC_COMPLETED_CHAN - Given channel is preCAC completed.
1231  * DFS_PRECAC_REQUIRED_CHAN - Given channel requires preCAC.
1232  */
1233 enum precac_status_for_chan
1234 dfs_precac_status_for_channel(struct wlan_dfs *dfs,
1235 			      struct dfs_channel *deschan);
1236 #else
1237 static inline enum precac_status_for_chan
dfs_precac_status_for_channel(struct wlan_dfs * dfs,struct dfs_channel * deschan)1238 dfs_precac_status_for_channel(struct wlan_dfs *dfs,
1239 			      struct dfs_channel *deschan)
1240 {
1241 	return DFS_INVALID_PRECAC_STATUS;
1242 }
1243 #endif
1244 
1245 #if (defined(QCA_SUPPORT_AGILE_DFS) || defined(QCA_SUPPORT_ADFS_RCAC)) && \
1246 	defined(WLAN_DFS_TRUE_160MHZ_SUPPORT) && defined(WLAN_DFS_FULL_OFFLOAD)
1247 /**
1248  * dfs_translate_radar_params_for_agile_chan() - Translate radar params from
1249  * 160MHz synthesizer model to 80MHz synthesizer model for Agile channel.
1250  * @dfs: Pointer to wlan_dfs dfs.
1251  * @r_info: Radar found parameters received from FW that are converted to 80MHz
1252  * syntesizer model(both input and output).
1253  *
1254  * Return: void.
1255  */
1256 
1257 void dfs_translate_radar_params_for_agile_chan(struct wlan_dfs *dfs,
1258 					       struct radar_found_info *r_info);
1259 #else
1260 static inline void
dfs_translate_radar_params_for_agile_chan(struct wlan_dfs * dfs,struct radar_found_info * r_info)1261 dfs_translate_radar_params_for_agile_chan(struct wlan_dfs *dfs,
1262 					  struct radar_found_info *r_info)
1263 {
1264 }
1265 #endif
1266 
1267 /**
1268  * dfs_is_subset_channel_for_freq() - Find out if prev channel and current
1269  * channel are subsets of each other.
1270  * @old_subchans_freq: Pointer to previous sub-channels freq.
1271  * @old_n_chans: Number of previous sub-channels.
1272  * @new_subchans_freq: Pointer to new sub-channels freq.
1273  * @new_n_chans:  Number of new sub-channels
1274  */
1275 #ifdef CONFIG_CHAN_FREQ_API
1276 bool
1277 dfs_is_subset_channel_for_freq(uint16_t *old_subchans_freq,
1278 			       uint8_t old_n_chans,
1279 			       uint16_t *new_subchans_freq,
1280 			       uint8_t new_n_chans);
1281 #endif
1282 
1283 #ifdef QCA_DFS_BW_EXPAND
1284 /**
1285  * dfs_bwexpand_find_usr_cnf_chan() - Find the User configured channel for
1286  * BW Expand.
1287  * @dfs: Pointer to wlan_dfs object.
1288  *
1289  * Return: User configured frequency.
1290  */
1291 qdf_freq_t dfs_bwexpand_find_usr_cnf_chan(struct wlan_dfs *dfs);
1292 
1293 /**
1294  * dfs_bwexpand_try_jumping_to_target_subchan() - Expand the current channel
1295  * bandwidth or jump to a (subset of) user configured target channel.
1296  * Example: Current channel is 60 HT20 and user configured target channel is
1297  * 100 HT160. Agile SM runs on the subchans with 20Mhz BW of 100 HT160, here
1298  * Agile SM runs on 100HT20 and after completion of agile CAC, it checks
1299  * the API dfs_bwexpand_try_jumping_to_target_subchan for possibility of
1300  * BW Expansion and only 20Mhz subchan is available. There is no possible for
1301  * higher bandwidth channel. Then agile CAC runs on the adjacent subchannel
1302  * 104 HT20. After agile CAC completion, the API is checked again for possible
1303  * bandwidth expansion and 102 HT40 is available. The API invokes channel change
1304  * to higher bandwidth.
1305  * @dfs: Pointer to wlan_dfs object.
1306  *
1307  * Return: TRUE, if Bandwidth expansion is success.
1308  * FALSE, if Bandwidth expansion is failure.
1309  */
1310 bool dfs_bwexpand_try_jumping_to_target_subchan(struct wlan_dfs *dfs);
1311 
1312 /**
1313  * dfs_is_rcac_cac_done()- Check RCAC is completed on the subset of the
1314  * user configured target channel.
1315  * @dfs: Pointer to wlan_dfs.
1316  * @chan: Pointer to dfs_channel object of user configured target channel.
1317  * @subset_chan: Pointer to dfs_channel object of subchannel in which RCAC is
1318  * completed.
1319  *
1320  * Return: Boolean value.
1321  */
1322 bool dfs_is_rcac_cac_done(struct wlan_dfs *dfs,
1323 			  struct dfs_channel *chan,
1324 			  struct dfs_channel *subset_chan);
1325 
1326 /*
1327  * dfs_get_configured_bwexpand_dfs_chan() - Get a DFS chan when frequency and
1328  * phymode is provided.
1329  * @dfs: pointer to wlan_dfs.
1330  * @user_chan: pointer to dfs_channel.
1331  * @target_mode: phymode of type wlan_phymode.
1332  */
1333 bool dfs_get_configured_bwexpand_dfs_chan(struct wlan_dfs *dfs,
1334 					  struct dfs_channel *user_chan,
1335 					  enum wlan_phymode target_mode);
1336 #else
1337 static inline
dfs_bwexpand_find_usr_cnf_chan(struct wlan_dfs * dfs)1338 qdf_freq_t dfs_bwexpand_find_usr_cnf_chan(struct wlan_dfs *dfs)
1339 {
1340 	return 0;
1341 }
1342 
1343 static inline
dfs_bwexpand_try_jumping_to_target_subchan(struct wlan_dfs * dfs)1344 bool dfs_bwexpand_try_jumping_to_target_subchan(struct wlan_dfs *dfs)
1345 {
1346 	return false;
1347 }
1348 
1349 static inline
dfs_is_rcac_cac_done(struct wlan_dfs * dfs,struct dfs_channel * chan,struct dfs_channel * subset_chan)1350 bool dfs_is_rcac_cac_done(struct wlan_dfs *dfs,
1351 			  struct dfs_channel *chan,
1352 			  struct dfs_channel *subset_chan)
1353 {
1354 	return false;
1355 }
1356 
1357 static inline
dfs_get_configured_bwexpand_dfs_chan(struct wlan_dfs * dfs,struct dfs_channel * user_chan,enum wlan_phymode target_mode)1358 bool dfs_get_configured_bwexpand_dfs_chan(struct wlan_dfs *dfs,
1359 					  struct dfs_channel *user_chan,
1360 					  enum wlan_phymode target_mode)
1361 {
1362 	return false;
1363 }
1364 #endif /* QCA_DFS_BW_EXPAND */
1365 
1366 #if defined(QCA_DFS_BW_PUNCTURE) && !defined(CONFIG_REG_CLIENT)
1367 /**
1368  * dfs_create_punc_sm() - Wrapper API to Create DFS puncture state machine.
1369  * @dfs: pointer to wlan_dfs.
1370  *
1371  * Return: Nothing.
1372  */
1373 void dfs_create_punc_sm(struct wlan_dfs *dfs);
1374 
1375 /**
1376  * dfs_destroy_punc_sm() - Wrapper API to Destroy DFS puncture state machine.
1377  * @dfs: pointer to wlan_dfs.
1378  *
1379  * Return: Nothing.
1380  */
1381 void dfs_destroy_punc_sm(struct wlan_dfs *dfs);
1382 
1383 /**
1384  * dfs_punc_sm_stop_all() - API to stop all puncture SM object.
1385  * @dfs: pointer to wlan_dfs.
1386  *
1387  * Return: Nothing.
1388  */
1389 void dfs_punc_sm_stop_all(struct wlan_dfs *dfs);
1390 
1391 /**
1392  * dfs_punc_sm_stop() - Stop DFS puncture state machine.
1393  * @dfs:           Pointer to wlan_dfs.
1394  * @indx:          Index of DFS puncture state machine.
1395  * @dfs_punc_arr:  Pointer to DFS puncture state machine object.
1396  *
1397  * Return: Nothing.
1398  */
1399 void dfs_punc_sm_stop(struct wlan_dfs *dfs,
1400 		      uint8_t indx,
1401 		      struct dfs_punc_obj *dfs_punc_arr);
1402 
1403 /**
1404  * dfs_punc_sm_create() - Create DFS puncture state machine.
1405  * @dfs_punc:             Pointer to DFS puncture state machine object.
1406  *
1407  * Return: Success if SM is created.
1408  */
1409 QDF_STATUS dfs_punc_sm_create(struct dfs_punc_obj *dfs_punc);
1410 
1411 /**
1412  * dfs_punc_sm_destroy() - Destroy DFS puncture state machine.
1413  * @dfs_punc:              Pointer to DFS puncture state machine object.
1414  *
1415  * Return: Success if SM is destroyed.
1416  */
1417 QDF_STATUS dfs_punc_sm_destroy(struct dfs_punc_obj *dfs_punc);
1418 
1419 /**
1420  * dfs_punc_cac_timer_attach() - Attach puncture CAC timer to DFS puncture
1421  *                               state machine.
1422  * @dfs:                         Pointer to wlan_dfs.
1423  * @dfs_punc_arr:                Pointer to DFS puncture state machine object.
1424  *
1425  * Return: Nothing.
1426  */
1427 void dfs_punc_cac_timer_attach(struct wlan_dfs *dfs,
1428 			       struct dfs_punc_obj *dfs_punc_arr);
1429 
1430 /**
1431  * dfs_handle_dfs_puncture_unpuncture() - Handles DFS puncture and unpuncturing.
1432  * @dfs:                                  Pointer to wlan_dfs.
1433  *
1434  * Return: Nothing.
1435  */
1436 void dfs_handle_dfs_puncture_unpuncture(struct wlan_dfs *dfs);
1437 
1438 /**
1439  * dfs_punc_cac_timer_reset() - Reset puncture CAC timer.
1440  * @dfs_punc_arr:               Pointer to DFS puncture state machine object.
1441  *
1442  * Return: Nothing.
1443  */
1444 void dfs_punc_cac_timer_reset(struct dfs_punc_obj *dfs_punc_arr);
1445 
1446 /**
1447  * dfs_punc_cac_timer_detach() - Detach puncture CAC timer from DFS puncture
1448  *                               state machine.
1449  * @dfs_punc_arr:                Pointer to DFS puncture state machine object.
1450  *
1451  * Return: Nothing.
1452  */
1453 void dfs_punc_cac_timer_detach(struct dfs_punc_obj *dfs_punc_arr);
1454 
1455 /**
1456  * dfs_start_punc_cac_timer() - Start puncture CAC timer.
1457  * @dfs_punc_arr:               Pointer to DFS puncture state machine object.
1458  * @is_weather_chan:            check if the channel is weather channel.
1459  *
1460  * Return: Nothing.
1461  */
1462 void dfs_start_punc_cac_timer(struct dfs_punc_obj *dfs_punc_arr,
1463 			      bool is_weather_chan);
1464 
1465 /**
1466  * dfs_cancel_punc_cac_timer() - Cancel puncture CAC timer.
1467  * @dfs_punc_arr:                Pointer to DFS puncture state machine object.
1468  *
1469  * Return: Nothing.
1470  */
1471 void dfs_cancel_punc_cac_timer(struct dfs_punc_obj *dfs_punc_arr);
1472 
1473 /**
1474  * utils_dfs_puncturing_sm_deliver_evt() - Utility API to post events to DFS
1475  *                                         puncture state machine.
1476  * @pdev:                          Pointer to DFS pdev object.
1477  * @sm_indx:                       Index of state machine.
1478  * @event:                         Event to be posted to DFS Puncturing SM.
1479  *
1480  * Return: Nothing.
1481  */
1482 void utils_dfs_puncturing_sm_deliver_evt(struct wlan_objmgr_pdev *pdev,
1483 					 uint8_t sm_indx,
1484 					 enum dfs_punc_sm_evt event);
1485 /**
1486  * dfs_puncturing_sm_deliver_evt() - API to post events to DFS puncture
1487  *                                   state machine.
1488  * @dfs:                           Pointer to wlan_dfs.
1489  * @event:                         Event to be posted to DFS Puncturing SM.
1490  * @event_data_len:                Size of event data.
1491  * @event_data:                    Event data.
1492  *
1493  * Return: Nothing.
1494  */
1495 QDF_STATUS dfs_puncturing_sm_deliver_evt(struct wlan_dfs *dfs,
1496 					 enum dfs_punc_sm_evt event,
1497 					 uint16_t event_data_len,
1498 					 void *event_data);
1499 
1500 /**
1501  * dfs_handle_nol_puncture() - Send SM event post NOL expiry.
1502  * @dfs:           Pointer to wlan_dfs.
1503  * @nolfreq:       NOL channel frequency.
1504  *
1505  * Return: Nothing.
1506  */
1507 void dfs_handle_nol_puncture(struct wlan_dfs *dfs, qdf_freq_t nolfreq);
1508 
1509 /**
1510  * dfs_is_ignore_radar_for_punctured_chans() - Store the radar bitmap and check
1511  *                                             if radar is found in already
1512  *                                             punctured channel and ignore the
1513  *                                             radar.
1514  * @dfs:                       Wlan_dfs structure
1515  * @dfs_curr_radar_bitmap:     Variable to store radar bitmap.
1516  *
1517  * Return: If radar is found on punctured channel then return true.
1518  * Else return false.
1519  */
1520 bool dfs_is_ignore_radar_for_punctured_chans(struct wlan_dfs *dfs,
1521 					     uint16_t dfs_curr_radar_bitmap);
1522 #else
1523 static inline
dfs_create_punc_sm(struct wlan_dfs * dfs)1524 void dfs_create_punc_sm(struct wlan_dfs *dfs)
1525 {
1526 }
1527 
1528 static inline
dfs_destroy_punc_sm(struct wlan_dfs * dfs)1529 void dfs_destroy_punc_sm(struct wlan_dfs *dfs)
1530 {
1531 }
1532 
1533 static inline
dfs_punc_sm_stop_all(struct wlan_dfs * dfs)1534 void dfs_punc_sm_stop_all(struct wlan_dfs *dfs)
1535 {
1536 }
1537 
1538 static inline
dfs_punc_sm_stop(struct wlan_dfs * dfs,uint8_t indx,struct dfs_punc_obj * dfs_punc_arr)1539 void dfs_punc_sm_stop(struct wlan_dfs *dfs,
1540 		      uint8_t indx,
1541 		      struct dfs_punc_obj *dfs_punc_arr)
1542 {
1543 }
1544 
1545 static inline
dfs_punc_sm_create(struct dfs_punc_obj * dfs_punc)1546 QDF_STATUS dfs_punc_sm_create(struct dfs_punc_obj *dfs_punc)
1547 {
1548 	return QDF_STATUS_E_FAILURE;
1549 }
1550 
1551 static inline
dfs_punc_sm_destroy(struct dfs_punc_obj * dfs_punc)1552 QDF_STATUS dfs_punc_sm_destroy(struct dfs_punc_obj *dfs_punc)
1553 {
1554 	return QDF_STATUS_E_FAILURE;
1555 }
1556 
1557 static inline
dfs_punc_cac_timer_attach(struct wlan_dfs * dfs,struct dfs_punc_obj * dfs_punc_arr)1558 void dfs_punc_cac_timer_attach(struct wlan_dfs *dfs,
1559 			       struct dfs_punc_obj *dfs_punc_arr)
1560 {
1561 }
1562 
1563 static inline
dfs_handle_dfs_puncture_unpuncture(struct wlan_dfs * dfs)1564 void dfs_handle_dfs_puncture_unpuncture(struct wlan_dfs *dfs)
1565 {
1566 }
1567 
1568 static inline
dfs_punc_cac_timer_reset(struct dfs_punc_obj * dfs_punc_arr)1569 void dfs_punc_cac_timer_reset(struct dfs_punc_obj *dfs_punc_arr)
1570 {
1571 }
1572 
1573 static inline
dfs_punc_cac_timer_detach(struct dfs_punc_obj * dfs_punc_arr)1574 void dfs_punc_cac_timer_detach(struct dfs_punc_obj *dfs_punc_arr)
1575 {
1576 }
1577 
1578 static inline
dfs_start_punc_cac_timer(struct dfs_punc_obj * dfs_punc_arr,bool is_weather_chan)1579 void dfs_start_punc_cac_timer(struct dfs_punc_obj *dfs_punc_arr,
1580 			      bool is_weather_chan)
1581 {
1582 }
1583 
1584 static inline
dfs_cancel_punc_cac_timer(struct dfs_punc_obj * dfs_punc_arr)1585 void dfs_cancel_punc_cac_timer(struct dfs_punc_obj *dfs_punc_arr)
1586 {
1587 }
1588 
1589 static inline
utils_dfs_puncturing_sm_deliver_evt(struct wlan_objmgr_pdev * pdev,uint8_t sm_indx,enum dfs_punc_sm_evt event)1590 void utils_dfs_puncturing_sm_deliver_evt(struct wlan_objmgr_pdev *pdev,
1591 					 uint8_t sm_indx,
1592 					 enum dfs_punc_sm_evt event)
1593 {
1594 }
1595 
1596 static inline
dfs_puncturing_sm_deliver_evt(struct wlan_dfs * dfs,enum dfs_punc_sm_evt event,uint16_t event_data_len,void * event_data)1597 QDF_STATUS dfs_puncturing_sm_deliver_evt(struct wlan_dfs *dfs,
1598 					 enum dfs_punc_sm_evt event,
1599 					 uint16_t event_data_len,
1600 					 void *event_data)
1601 {
1602 	return QDF_STATUS_E_FAILURE;
1603 }
1604 
1605 static inline
dfs_handle_nol_puncture(struct wlan_dfs * dfs,qdf_freq_t nolfreq)1606 void dfs_handle_nol_puncture(struct wlan_dfs *dfs, qdf_freq_t nolfreq)
1607 {
1608 }
1609 
1610 static inline
dfs_is_ignore_radar_for_punctured_chans(struct wlan_dfs * dfs,uint16_t dfs_curr_radar_bitmap)1611 bool dfs_is_ignore_radar_for_punctured_chans(struct wlan_dfs *dfs,
1612 					     uint16_t dfs_curr_radar_bitmap)
1613 {
1614 	return false;
1615 }
1616 #endif /* DFS_BW_PUNCTURE */
1617 #endif /* _DFS_ZERO_CAC_H_ */
1618