xref: /wlan-driver/qca-wifi-host-cmn/umac/dfs/dispatcher/inc/wlan_dfs_ucfg_api.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
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  *
5  *
6  * Permission to use, copy, modify, and/or distribute this software for
7  * any purpose with or without fee is hereby granted, provided that the
8  * above copyright notice and this permission notice appear in all
9  * copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
12  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
13  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
14  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
15  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
16  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
17  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18  * PERFORMANCE OF THIS SOFTWARE.
19  */
20 
21 /**
22  * DOC: This file has the DFS dispatcher API which is exposed to outside of DFS
23  * component.
24  */
25 
26 #ifndef _WLAN_DFS_UCFG_API_H_
27 #define _WLAN_DFS_UCFG_API_H_
28 
29 #include <wlan_objmgr_psoc_obj.h>
30 #include <wlan_objmgr_pdev_obj.h>
31 #include <wlan_dfs_ioctl.h>
32 #include <wlan_dfs_public_struct.h>
33 
34 /**
35  * struct dfs_to_mlme - These are MLME function pointer used by DFS component.
36  * @pdev_component_obj_attach:         Attach DFS object to PDEV.
37  * @pdev_component_obj_detach:         Detach DFS object from PDEV.
38  * @dfs_start_rcsa:                    Send RCSA to RootAP.
39  * @mlme_mark_dfs:                     Mark DFS channel frequency as radar.
40  * @mlme_start_csa_for_freq:
41  * @mlme_proc_cac:                     Process the CAC completion event.
42  * @mlme_deliver_event_up_after_cac:   Send a CAC timeout, VAP up event to user
43  *                                     space
44  * @mlme_get_extchan_for_freq:         Get the extension channel.
45  * @mlme_set_no_chans_available:       Sets no_chans_available flag.
46  * @mlme_ieee2mhz:                     Gets Channel freq from ieee number.
47  * @mlme_find_dot11_chan_for_freq:     Find a channel pointer.
48  * @mlme_get_dfs_channels_for_freq:    Get DFS channels from current channel
49  *                                     list.
50  * @mlme_dfs_ch_flags_ext:             Gets channel extension flag.
51  * @mlme_channel_change_by_precac:     Channel change triggered by PreCAC.
52  * @mlme_precac_chan_change_csa_for_freq:Channel change triggered by PrCAC using
53  *                                     Channel Switch Announcement.
54  * @mlme_postnol_chan_switch:          Channel change post NOL using Channel
55  *                                     Switch Announcement.
56  * @mlme_unpunc_chan_switch:           After DFS unpuncture occurs send VDEV
57  *                                     restart.
58  * @mlme_nol_timeout_notification:     NOL timeout notification.
59  * @mlme_clist_update:                 Updates the channel list.
60  * @mlme_is_opmode_sta:                Check if pdev opmode is STA.
61  * @mlme_get_cac_timeout_for_freq:     Get CAC timeout for a given channel
62  *                                     frequency.
63  * @mlme_rebuild_chan_list_with_non_dfs_channels: Rebuild channels with non-dfs
64  *                                     channels.
65  * @mlme_restart_vaps_with_non_dfs_chan: Restart vaps with non-dfs channel.
66  * @mlme_check_allowed_prim_chanlist:  Check whether the given channel is
67  *                                     present in the primary allowed channel
68  *                                     list or not.
69  * @mlme_update_scan_channel_list:     Update the scan channel list sent to FW.
70  * @mlme_bringdown_vaps:               Bringdown vaps if no chans is present.
71  * @mlme_dfs_deliver_event:            Deliver DFS events to user space
72  * @mlme_is_inter_band_chan_switch_allowed: Check if switch between 5 GHz and
73  *                                     6 GHz is allowed.
74  * @mlme_acquire_radar_mode_switch_lock: Acquire lock for radar processing over
75  *                                     mode switch.
76  * @mlme_release_radar_mode_switch_lock: Release lock taken for radar processing
77  *                                     over mode switch.
78  * @mlme_proc_spoof_success:           Called when FW send spoof success event.
79  * @mlme_set_tx_flag:                  Called when Radar is detected to
80  *                                     indicate stop data traffic.
81  */
82 struct dfs_to_mlme {
83 	QDF_STATUS (*pdev_component_obj_attach)(struct wlan_objmgr_pdev *pdev,
84 			enum wlan_umac_comp_id id,
85 			void *comp_priv_obj,
86 			QDF_STATUS status);
87 	QDF_STATUS (*pdev_component_obj_detach)(struct wlan_objmgr_pdev *pdev,
88 			enum wlan_umac_comp_id id,
89 			void *comp_priv_obj);
90 	QDF_STATUS (*dfs_start_rcsa)(struct wlan_objmgr_pdev *pdev,
91 			bool *wait_for_csa);
92 	QDF_STATUS (*mlme_mark_dfs)(struct wlan_objmgr_pdev *pdev,
93 			uint8_t ieee,
94 			uint16_t freq,
95 			uint16_t vhtop_ch_freq_seg2,
96 			uint64_t flags,
97 			uint16_t dfs_radar_bitmap);
98 #ifdef CONFIG_CHAN_FREQ_API
99 	QDF_STATUS (*mlme_start_csa_for_freq)(struct wlan_objmgr_pdev *pdev,
100 					      uint8_t ieee_chan, uint16_t freq,
101 					      uint16_t cfreq2, uint64_t flags);
102 #endif
103 
104 	QDF_STATUS (*mlme_proc_cac)(struct wlan_objmgr_pdev *pdev);
105 	QDF_STATUS (*mlme_deliver_event_up_after_cac)(
106 			struct wlan_objmgr_pdev *pdev);
107 #ifdef CONFIG_CHAN_FREQ_API
108 	QDF_STATUS (*mlme_get_extchan_for_freq)(struct wlan_objmgr_pdev *pdev,
109 						uint16_t *dfs_ch_freq,
110 						uint64_t *dfs_ch_flags,
111 						uint16_t *dfs_ch_flagext,
112 						uint8_t *dfs_ch_ieee,
113 						uint8_t *dfs_vhtop_ch_freq_seg1,
114 						uint8_t *dfs_vhtop_ch_freq_seg2,
115 						uint16_t *dfs_ch_mhz_freq_seg1,
116 						uint16_t *dfs_ch_mhz_freq_seg2);
117 #endif
118 	QDF_STATUS (*mlme_set_no_chans_available)(struct wlan_objmgr_pdev *pdev,
119 			int val);
120 	QDF_STATUS (*mlme_ieee2mhz)(struct wlan_objmgr_pdev *pdev,
121 			int ieee,
122 			uint64_t flag,
123 			int *freq);
124 #ifdef CONFIG_CHAN_FREQ_API
125 	QDF_STATUS (*mlme_find_dot11_chan_for_freq)(struct wlan_objmgr_pdev *,
126 						    uint16_t freq,
127 						    uint16_t des_cfreq2_mhz,
128 						    int mode,
129 						    uint16_t *dfs_ch_freq,
130 						    uint64_t *dfs_ch_flags,
131 						    uint16_t *dfs_ch_flagext,
132 						    uint8_t *dfs_ch_ieee,
133 						    uint8_t *dfs_ch_freq_seg1,
134 						    uint8_t *dfs_ch_freq_seg2,
135 						    uint16_t *dfs_cfreq1_mhz,
136 						    uint16_t *dfs_cfreq2_mhz);
137 #endif
138 #ifdef CONFIG_CHAN_FREQ_API
139 	QDF_STATUS (*mlme_get_dfs_channels_for_freq)(
140 			struct wlan_objmgr_pdev *pdev,
141 			uint16_t *dfs_chan_freq,
142 			uint64_t *dfs_chan_flags,
143 			uint16_t *dfs_chan_flagext,
144 			uint8_t *dfs_chan_ieee,
145 			uint8_t *dfs_chan_vhtop_ch_freq_seg1,
146 			uint8_t *dfs_chan_vhtop_ch_freq_seg2,
147 			uint16_t *dfs_chan_mhz_freq_seg1,
148 			uint16_t *dfs_chan_mhz_freq_seg2,
149 			int index);
150 #endif
151 	QDF_STATUS (*mlme_dfs_ch_flags_ext)(struct wlan_objmgr_pdev *pdev,
152 			uint16_t *flag_ext);
153 	QDF_STATUS (*mlme_channel_change_by_precac)(
154 			struct wlan_objmgr_pdev *pdev);
155 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT
156 #ifdef CONFIG_CHAN_FREQ_API
157 	QDF_STATUS
158 	    (*mlme_precac_chan_change_csa_for_freq)(struct wlan_objmgr_pdev *,
159 						    uint16_t des_chan_freq,
160 						    uint16_t des_cfreq2,
161 						    enum wlan_phymode des_mode);
162 #endif
163 #endif
164 #if defined(QCA_SUPPORT_DFS_CHAN_POSTNOL) || defined(QCA_DFS_BW_EXPAND)
165 	QDF_STATUS
166 	(*mlme_postnol_chan_switch)(struct wlan_objmgr_pdev *pdev,
167 				    qdf_freq_t des_chan_freq,
168 				    qdf_freq_t des_cfreq2,
169 				    enum wlan_phymode des_mode);
170 #endif
171 #if defined(QCA_DFS_BW_PUNCTURE) && !defined(CONFIG_REG_CLIENT)
172 	QDF_STATUS
173 	    (*mlme_unpunc_chan_switch)(struct wlan_objmgr_pdev *pdev,
174 				       uint16_t new_punc_pattern);
175 #endif
176 	QDF_STATUS (*mlme_nol_timeout_notification)(
177 			struct wlan_objmgr_pdev *pdev);
178 	QDF_STATUS (*mlme_clist_update)(struct wlan_objmgr_pdev *pdev,
179 			void *nollist,
180 			int nentries);
181 	bool (*mlme_is_opmode_sta)(struct wlan_objmgr_pdev *pdev);
182 #ifdef CONFIG_CHAN_FREQ_API
183 	QDF_STATUS
184 	    (*mlme_get_cac_timeout_for_freq)(struct wlan_objmgr_pdev *pdev,
185 					     uint16_t dfs_ch_freq,
186 					     uint16_t c_vhtop_ch_freq_seg2,
187 					     uint64_t dfs_ch_flags,
188 					     int *cac_timeout);
189 #endif
190 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
191 	QDF_STATUS (*mlme_rebuild_chan_list_with_non_dfs_channels)
192 			(struct wlan_objmgr_pdev *pdev);
193 #endif
194 	QDF_STATUS (*mlme_restart_vaps_with_non_dfs_chan)
195 			(struct wlan_objmgr_pdev *pdev, int no_chans_avail);
196 	bool (*mlme_check_allowed_prim_chanlist)
197 			(struct wlan_objmgr_pdev *pdev, uint32_t chan);
198 	QDF_STATUS (*mlme_update_scan_channel_list)
199 			(struct wlan_objmgr_pdev *pdev);
200 	QDF_STATUS (*mlme_bringdown_vaps)
201 			(struct wlan_objmgr_pdev *pdev);
202 	void (*mlme_dfs_deliver_event)
203 			(struct wlan_objmgr_pdev *pdev,
204 			 uint16_t freq,
205 			 enum WLAN_DFS_EVENTS event);
206 	bool (*mlme_is_inter_band_chan_switch_allowed)
207 			(struct wlan_objmgr_pdev *pdev);
208 	void (*mlme_acquire_radar_mode_switch_lock)
209 			(struct wlan_objmgr_pdev *pdev);
210 	void (*mlme_release_radar_mode_switch_lock)
211 			(struct wlan_objmgr_pdev *pdev);
212 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
213 	QDF_STATUS (*mlme_proc_spoof_success)
214 			(struct wlan_objmgr_pdev *pdev);
215 #endif
216 	QDF_STATUS (*mlme_set_tx_flag)(struct wlan_objmgr_pdev *pdev,
217 				       bool is_tx_allowed);
218 };
219 
220 extern struct dfs_to_mlme global_dfs_to_mlme;
221 
222 /**
223  * wlan_dfs_pdev_obj_create_notification() - DFS pdev object create handler.
224  * @pdev: Pointer to DFS pdev object.
225  * @arg: component argument
226  */
227 QDF_STATUS wlan_dfs_pdev_obj_create_notification(struct wlan_objmgr_pdev *pdev,
228 		void *arg);
229 
230 /**
231  * wlan_dfs_pdev_obj_destroy_notification() - DFS pdev object delete handler.
232  * @pdev: Pointer to DFS pdev object.
233  * @arg: component argument
234  */
235 QDF_STATUS wlan_dfs_pdev_obj_destroy_notification(struct wlan_objmgr_pdev *pdev,
236 		void *arg);
237 
238 /**
239  * ucfg_dfs_is_ap_cac_timer_running() - Returns the dfs cac timer.
240  * @pdev: Pointer to DFS pdev object.
241  * @is_ap_cac_timer_running: Pointer to save dfs_cac_timer_running value.
242  *
243  * Wrapper function for dfs_is_ap_cac_timer_running().
244  * This function called from outside of dfs component.
245  */
246 QDF_STATUS ucfg_dfs_is_ap_cac_timer_running(struct wlan_objmgr_pdev *pdev,
247 		int *is_ap_cac_timer_running);
248 
249 /**
250  * ucfg_dfs_getnol() - Wrapper function for dfs_get_nol()
251  * @pdev: Pointer to DFS pdev object.
252  * @dfs_nolinfo: Pointer to dfsreq_nolinfo structure.
253  *
254  * Wrapper function for dfs_getnol().
255  * This function called from outside of dfs component.
256  */
257 QDF_STATUS ucfg_dfs_getnol(struct wlan_objmgr_pdev *pdev, void *dfs_nolinfo);
258 
259 /**
260  * ucfg_dfs_override_cac_timeout() -  Override the default CAC timeout.
261  * @pdev: Pointer to DFS pdev object.
262  * @cac_timeout: CAC timeout value.
263  * @status: pointer to save status
264  *
265  * Wrapper function for dfs_override_cac_timeout().
266  * This function called from outside of dfs component.
267  */
268 QDF_STATUS ucfg_dfs_override_cac_timeout(struct wlan_objmgr_pdev *pdev,
269 		int cac_timeout, int *status);
270 
271 /**
272  * ucfg_dfs_get_override_cac_timeout() -  Get override CAC timeout value.
273  * @pdev: Pointer to DFS pdev object.
274  * @cac_timeout: Pointer to save the CAC timeout value.
275  * @status: pointer to save status
276  *
277  * Wrapper function for dfs_get_override_cac_timeout().
278  * This function called from outside of dfs component.
279  */
280 QDF_STATUS ucfg_dfs_get_override_cac_timeout(struct wlan_objmgr_pdev *pdev,
281 		int *cac_timeout, int *status);
282 
283 /**
284  * ucfg_dfs_get_override_precac_timeout() - Get precac timeout.
285  * @pdev: Pointer to DFS pdev object.
286  * @precac_timeout: Get precac timeout value in this variable.
287  *
288  * Wrapper function for dfs_get_override_precac_timeout().
289  * This function called from outside of dfs component.
290  */
291 QDF_STATUS ucfg_dfs_get_override_precac_timeout(struct wlan_objmgr_pdev *pdev,
292 		int *precac_timeout);
293 
294 /**
295  * ucfg_dfs_override_precac_timeout() - Override the default precac timeout.
296  * @pdev: Pointer to DFS pdev object.
297  * @precac_timeout: Precac timeout value.
298  *
299  * Wrapper function for dfs_override_precac_timeout().
300  * This function called from outside of dfs component.
301  */
302 QDF_STATUS ucfg_dfs_override_precac_timeout(struct wlan_objmgr_pdev *pdev,
303 		int precac_timeout);
304 
305 /**
306  * ucfg_dfs_set_precac_enable() - Set precac enable flag.
307  * @pdev: Pointer to DFS pdev object.
308  * @value: input value for dfs_legacy_precac_ucfg flag.
309  *
310  * Wrapper function for dfs_set_precac_enable().
311  * This function called from outside of dfs component.
312  */
313 QDF_STATUS ucfg_dfs_set_precac_enable(struct wlan_objmgr_pdev *pdev,
314 				      uint32_t value);
315 
316 /**
317  * ucfg_dfs_get_agile_precac_enable() - Get agile precac enable flag.
318  * @pdev: Pointer to DFS pdev object.
319  * @buff: Pointer to save dfs_agile_precac_ucfg value.
320  *
321  * Wrapper function for dfs_is_legacy_precac_enabled().
322  * This function called from outside of dfs component.
323  *
324  * Return:
325  * * QDF_STATUS_SUCCESS: Successfully able to get agile precac flag.
326  * * QDF_STATUS_E_FAILURE: Failed to get agile precac flag.
327  */
328 QDF_STATUS ucfg_dfs_get_agile_precac_enable(struct wlan_objmgr_pdev *pdev,
329 					    bool *buff);
330 
331 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT
332 /**
333  * ucfg_dfs_set_precac_intermediate_chan() - Set intermediate channel
334  *                                           for preCAC.
335  * @pdev: Pointer to DFS pdev object.
336  * @value: Channel number of intermediate channel
337  *
338  * Wrapper function for dfs_set_precac_intermediate_chan().
339  * This function is called from outside of dfs component.
340  *
341  * Return:
342  * * QDF_STATUS_SUCCESS  : Successfully set intermediate channel.
343  * * QDF_STATUS_E_FAILURE: Failed to set intermediate channel.
344  */
345 QDF_STATUS ucfg_dfs_set_precac_intermediate_chan(struct wlan_objmgr_pdev *pdev,
346 						 uint32_t value);
347 
348 /**
349  * ucfg_dfs_get_precac_intermediate_chan() - Get intermediate channel
350  *						for preCAC.
351  * @pdev: Pointer to DFS pdev object.
352  * @buff: Pointer to Channel number of intermediate channel.
353  *
354  * Wrapper function for dfs_get_precac_intermediate_chan().
355  * This function is called from outside of dfs component.
356  *
357  * Return: Configured intermediate precac channel.
358  */
359 QDF_STATUS ucfg_dfs_get_precac_intermediate_chan(struct wlan_objmgr_pdev *pdev,
360 						 int *buff);
361 
362 /**
363  * ucfg_dfs_get_precac_chan_state_for_freq() - Get precac status for the
364  * given channel.
365  * @pdev: Pointer to DFS pdev object.
366  * @precac_freq: Channel frequency for which precac state needs to be
367  *               determined.
368  *
369  * Wrapper function for dfs_get_precac_chan_state_for_freq().
370  * This function called from outside of dfs component.
371  *
372  * Return: Precac state of the given channel.
373  */
374 #ifdef CONFIG_CHAN_FREQ_API
375 enum precac_chan_state
376 ucfg_dfs_get_precac_chan_state_for_freq(struct wlan_objmgr_pdev *pdev,
377 					uint16_t precac_freq);
378 #endif
379 
380 #endif
381 
382 #ifdef MOBILE_DFS_SUPPORT
383 /**
384  * ucfg_dfs_update_config() - Update DFS user config.
385  * @psoc: Pointer to psoc.
386  * @req: DFS user config.
387  *
388  * Return: QDF_STATUS
389  */
390 QDF_STATUS ucfg_dfs_update_config(struct wlan_objmgr_psoc *psoc,
391 		struct dfs_user_config *req);
392 #else
ucfg_dfs_update_config(struct wlan_objmgr_psoc * psoc,struct dfs_user_config * req)393 static inline QDF_STATUS ucfg_dfs_update_config(struct wlan_objmgr_psoc *psoc,
394 		struct dfs_user_config *req)
395 {
396 	return QDF_STATUS_SUCCESS;
397 }
398 #endif
399 
400 /**
401  * ucfg_dfs_set_override_status_timeout() - override the value of host dfs
402  * status wait timeout.
403  * @pdev: Pointer to DFS pdev object.
404  * @status_timeout: timeout value.
405  *
406  * Wrapper function for dfs_set_override_status_timeout().
407  * This function called from outside of dfs component.
408  *
409  * Return: QDF_STATUS
410  */
411 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
412 QDF_STATUS ucfg_dfs_set_override_status_timeout(struct wlan_objmgr_pdev *pdev,
413 					    int status_timeout);
414 #else
415 static inline
ucfg_dfs_set_override_status_timeout(struct wlan_objmgr_pdev * pdev,int status_timeout)416 QDF_STATUS ucfg_dfs_set_override_status_timeout(struct wlan_objmgr_pdev *pdev,
417 					    int status_timeout)
418 {
419 	return QDF_STATUS_SUCCESS;
420 }
421 #endif
422 
423 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(WLAN_DFS_SYNTHETIC_RADAR)
424 /**
425  * ucfg_dfs_allow_hw_pulses() - Set or unset dfs-allow_hw_pulses
426  * which isolates synthetic radar pulse detection from actual radar detection.
427  * @pdev: Pointer to DFS pdev object.
428  * @allow_hw_pulses: Allow synthetic pulse detection true/false.
429  *
430  * Wrapper function for dfs_set_allow_hw_pulses().
431  * This function called from outside of dfs component.
432  *
433  * Return: void
434  */
435 void ucfg_dfs_allow_hw_pulses(struct wlan_objmgr_pdev *pdev,
436 			      bool allow_hw_pulses);
437 
438 /**
439  * ucfg_dfs_is_hw_pulses_allowed() - Check if actual radar detection is allowed
440  * or synthetic pulse detection is enabled.
441  * @pdev: Pointer to DFS pdev object.
442  *
443  * Wrapper function for dfs_is_hw_pulses_allowed().
444  * This function called from outside of dfs component.
445  *
446  * Return: bool
447  */
448 bool ucfg_dfs_is_hw_pulses_allowed(struct wlan_objmgr_pdev *pdev);
449 #else
450 static inline
ucfg_dfs_allow_hw_pulses(struct wlan_objmgr_pdev * pdev,bool allow_hw_pulses)451 void ucfg_dfs_allow_hw_pulses(struct wlan_objmgr_pdev *pdev,
452 			      bool allow_hw_pulses)
453 {
454 }
455 
456 static inline
ucfg_dfs_is_hw_pulses_allowed(struct wlan_objmgr_pdev * pdev)457 bool ucfg_dfs_is_hw_pulses_allowed(struct wlan_objmgr_pdev *pdev)
458 {
459 	return true;
460 }
461 #endif
462 
463 /**
464  * ucfg_dfs_get_override_status_timeout() - Get the value of host dfs status
465  * wait timeout.
466  * @pdev: Pointer to DFS pdev object.
467  * @status_timeout: Pointer to save the timeout value.
468  *
469  * Wrapper function for dfs_get_override_status_timeout().
470  * This function called from outside of dfs component.
471  *
472  * Return: QDF_STATUS
473  */
474 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
475 QDF_STATUS ucfg_dfs_get_override_status_timeout(struct wlan_objmgr_pdev *pdev,
476 						int *status_timeout);
477 #else
478 static inline
ucfg_dfs_get_override_status_timeout(struct wlan_objmgr_pdev * pdev,int * status_timeout)479 QDF_STATUS ucfg_dfs_get_override_status_timeout(struct wlan_objmgr_pdev *pdev,
480 						int *status_timeout)
481 {
482 	return QDF_STATUS_SUCCESS;
483 }
484 #endif
485 
486 /**
487  * ucfg_dfs_set_nol_subchannel_marking() - Set or unset NOL subchannel marking.
488  * @pdev: Pointer to DFS pdev object.
489  * @nol_subchannel_marking: Set NOL subchannel marking based on this value.
490  *
491  * Wrapper function for dfs_set_nol_subchannel_marking().
492  * This function is called from outside of dfs component.
493  *
494  * Return: QDF_STATUS
495  */
496 QDF_STATUS ucfg_dfs_set_nol_subchannel_marking(struct wlan_objmgr_pdev *pdev,
497 					       bool nol_subchannel_marking);
498 
499 /**
500  * ucfg_dfs_get_nol_subchannel_marking() - Get the value of NOL subchannel
501  * marking.
502  * @pdev: Pointer to DFS pdev object.
503  * @nol_subchannel_marking: Store the value of  NOL subchannel marking.
504  *
505  * Wrapper function for dfs_get_nol_subchannel_marking().
506  * This function is called from outside of dfs component.
507  *
508  * Return: QDF_STATUS
509  */
510 QDF_STATUS ucfg_dfs_get_nol_subchannel_marking(struct wlan_objmgr_pdev *pdev,
511 					       bool *nol_subchannel_marking);
512 /**
513  * ucfg_dfs_reinit_timers() - Init DFS timers.
514  * @pdev: Pointer to wlan_objmgr_pdev structure.
515  *
516  * Wrapper function to reset CAC, NOL, DFS Test Timer and ZeroCAC Timer.
517  * This is invoked per pdev to reinitialize timers after HW Mode Switch is
518  * triggered.
519  */
520 QDF_STATUS ucfg_dfs_reinit_timers(struct wlan_objmgr_pdev *pdev);
521 
522 /**
523  * ucfg_dfs_reset_agile_config() - Reset ADFS config.
524  * @psoc: Pointer to wlan_objmgr_psoc structure.
525  *
526  * Wrapper function to reset Agile DFS config such as the variables which hold
527  * information about the state of the preCAC timer, active precac
528  * dfs index and OCAC status. It is invoked before HW Mode switch is triggered
529  * to ensure ADFS config is in a well known consistent state.
530  */
531 #ifdef QCA_SUPPORT_AGILE_DFS
532 QDF_STATUS ucfg_dfs_reset_agile_config(struct wlan_objmgr_psoc *psoc);
533 #else
ucfg_dfs_reset_agile_config(struct wlan_objmgr_psoc * psoc)534 static inline QDF_STATUS ucfg_dfs_reset_agile_config(struct wlan_objmgr_psoc
535 						    *psoc)
536 {
537 	return QDF_STATUS_SUCCESS;
538 }
539 #endif
540 
541 /**
542  * ucfg_dfs_set_rcac_enable() - Set rcac enable flag.
543  * @pdev: Pointer to DFS pdev object.
544  * @rcac_en: User input value to enable/disable rolling cac feature.
545  *
546  */
547 #ifdef QCA_SUPPORT_ADFS_RCAC
548 QDF_STATUS ucfg_dfs_set_rcac_enable(struct wlan_objmgr_pdev *pdev,
549 				    bool rcac_en);
550 #else
551 static inline QDF_STATUS
ucfg_dfs_set_rcac_enable(struct wlan_objmgr_pdev * pdev,bool rcac_en)552 ucfg_dfs_set_rcac_enable(struct wlan_objmgr_pdev *pdev,
553 			 bool rcac_en)
554 {
555 	return QDF_STATUS_SUCCESS;
556 }
557 #endif
558 
559 /**
560  * ucfg_dfs_get_rcac_enable() - Get rcac enable flag.
561  * @pdev: Pointer to DFS pdev object.
562  * @rcac_en: Pointer to hold the "rcac" config.
563  *
564  */
565 #ifdef QCA_SUPPORT_ADFS_RCAC
566 QDF_STATUS ucfg_dfs_get_rcac_enable(struct wlan_objmgr_pdev *pdev,
567 				    bool *rcac_en);
568 #else
569 static inline QDF_STATUS
ucfg_dfs_get_rcac_enable(struct wlan_objmgr_pdev * pdev,bool * rcac_en)570 ucfg_dfs_get_rcac_enable(struct wlan_objmgr_pdev *pdev,
571 			 bool *rcac_en)
572 {
573 	return QDF_STATUS_SUCCESS;
574 }
575 #endif
576 
577 /**
578  * ucfg_dfs_set_rcac_freq() - Set rcac freq.
579  * @pdev: Pointer to DFS pdev object.
580  * @rcac_freq: User configured rcac freq in MHZ.
581  *
582  */
583 #ifdef QCA_SUPPORT_ADFS_RCAC
584 QDF_STATUS ucfg_dfs_set_rcac_freq(struct wlan_objmgr_pdev *pdev,
585 				  qdf_freq_t rcac_freq);
586 #else
587 static inline QDF_STATUS
ucfg_dfs_set_rcac_freq(struct wlan_objmgr_pdev * pdev,qdf_freq_t rcac_freq)588 ucfg_dfs_set_rcac_freq(struct wlan_objmgr_pdev *pdev,
589 		       qdf_freq_t rcac_freq)
590 {
591 	return QDF_STATUS_SUCCESS;
592 }
593 #endif
594 
595 /**
596  * ucfg_dfs_get_rcac_freq() - Get rcac freq.
597  * @pdev: Pointer to DFS pdev object.
598  * @rcac_freq: Pointer to store the user configured rcac freq in MHZ.
599  *
600  */
601 #ifdef QCA_SUPPORT_ADFS_RCAC
602 QDF_STATUS ucfg_dfs_get_rcac_freq(struct wlan_objmgr_pdev *pdev,
603 				  qdf_freq_t *rcac_freq);
604 #else
605 static inline QDF_STATUS
ucfg_dfs_get_rcac_freq(struct wlan_objmgr_pdev * pdev,qdf_freq_t * rcac_freq)606 ucfg_dfs_get_rcac_freq(struct wlan_objmgr_pdev *pdev,
607 		       qdf_freq_t *rcac_freq)
608 {
609 	return QDF_STATUS_SUCCESS;
610 }
611 #endif
612 
613 /**
614  * ucfg_dfs_is_agile_rcac_enabled() - Determine if Rolling CAC is supported
615  * or not.
616  * @pdev: Pointer to struct wlan_objmgr_pdev.
617  *
618  * Following are the conditions needed to assertain that rolling CAC
619  * is enabled:
620  * 1. DFS domain of the PDEV must be FCC or MKK.
621  * 2. User has enabled Rolling CAC configuration.
622  * 3. FW capability to support ADFS.
623  *
624  * Return: True if RCAC support is enabled, false otherwise.
625  */
626 #ifdef QCA_SUPPORT_ADFS_RCAC
627 bool ucfg_dfs_is_agile_rcac_enabled(struct wlan_objmgr_pdev *pdev);
628 #else
629 static inline bool
ucfg_dfs_is_agile_rcac_enabled(struct wlan_objmgr_pdev * pdev)630 ucfg_dfs_is_agile_rcac_enabled(struct wlan_objmgr_pdev *pdev)
631 {
632 	return false;
633 }
634 #endif
635 
636 #endif /* _WLAN_DFS_UCFG_API_H_ */
637