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