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_TGT_API_H_
27 #define _WLAN_DFS_TGT_API_H_
28 
29 #include <wlan_dfs_public_struct.h>
30 
31 #define WLAN_DFS_RESET_TIME_S 7
32 #define WLAN_DFS_WAIT (60 + WLAN_DFS_RESET_TIME_S) /* 60 seconds */
33 #define WLAN_DFS_WAIT_MS ((WLAN_DFS_WAIT) * 1000)  /*in MS*/
34 
35 /* Command id to send test radar to firmware */
36 #define DFS_PHYERR_OFFLOAD_TEST_SET_RADAR 0
37 
38 /* Segment ID corresponding to primary segment */
39 #define SEG_ID_PRIMARY 0
40 
41 /* Segment ID corresponding to secondary segment */
42 #define SEG_ID_SECONDARY 1
43 
44 /* dfs_radar_args_for_unit_test: Radar parameters to be sent in unit test cmd.
45  * @IDX_CMD_ID:          Index id pointing to command id value
46  * @IDX_PDEV_ID:         Index id pointing to pdev id value
47  * @IDX_RADAR_PARAM1_ID: Index pointing to packed arguments value that includes
48  *                         1). Segment ID,
49  *                         2). Chirp information (is chirp or non chirp),
50  *                         3). Frequency offset.
51  *                         4). Detector ID.
52  *                         5). Frequency Hopping(FH) Radar type
53  *                             (is frequency hopping or not).
54  *
55  * The packed argument structure is:
56  *
57  * ------------------------------32 bits arg----------------------------------
58  *
59  * -------17 bits------|1 bit|1 bit|--2 bits-|-------8 bits------|1 bit|2 bits|
60  * ____________________________________________________________________________
61  *|                    |     |     |   | |   | | | | | | | | | | |     |   |   |
62  *|---17 Unused bits---|  x  |  x  | x | | x |x|x|x| |x|x|x|x| |x|  x  | x | x |
63  *|____________________|_____|_____|___|_|___|_|_|_|_|_|_|_|_|_|_|_____|___|___|
64  *
65  *                     |_____|_____|_________|___________________|_____|_______|
66  *                       FH   sign   det.ID     freq.offset       Chirp  seg.ID
67  *
68  * @DFS_UNIT_TEST_NUM_ARGS:     Number of arguments for bangradar unit test
69  *                              command.
70  * @DFS_MAX_NUM_UNIT_TEST_ARGS: Maximum number of arguments for unit test
71  *                              command in radar simulation.
72  */
73 enum {
74 	IDX_CMD_ID = 0,
75 	IDX_PDEV_ID,
76 	IDX_RADAR_PARAM1_ID,
77 	DFS_UNIT_TEST_NUM_ARGS,
78 	DFS_MAX_NUM_UNIT_TEST_ARGS = DFS_UNIT_TEST_NUM_ARGS
79 };
80 
81 #define SEG_ID_SHIFT               0
82 #define IS_CHIRP_SHIFT             2
83 #define FREQ_OFF_SHIFT             3
84 #define DET_ID_SHIFT              11
85 #define FREQ_OFFSET_SIGNBIT_SHIFT 13
86 #define IS_FH_SHIFT               14
87 #define SEG_ID_MASK              0x03
88 #define IS_CHIRP_MASK            0x01
89 #define FREQ_OFFSET_MASK         0xFF
90 #define DET_ID_MASK              0x03
91 #define FREQ_OFFSET_SIGNBIT_MASK 0x01
92 #define IS_FH_MASK               0x01
93 
94 /**
95  * struct dfs_emulate_bang_radar_test_cmd - Unit test command structure to send
96  *                                          WMI command to firmware from host
97  *                                          and simulate bangradar event.
98  * @vdev_id: vdev id
99  * @num_args: number of arguments
100  * @args: arguments
101  */
102 struct dfs_emulate_bang_radar_test_cmd {
103 	uint32_t vdev_id;
104 	uint32_t num_args;
105 	uint32_t args[DFS_MAX_NUM_UNIT_TEST_ARGS];
106 };
107 
108 /**
109  * struct vdev_adfs_complete_status - OCAC complete status event param
110  * @vdev_id: Physical device identifier
111  * @chan_freq: Channel number
112  * @chan_width: Channel Width
113  * @center_freq1 : For 20/40/80/160Mhz, it is the center of the corresponding
114  * band. For 80P80/165MHz, it is the center of the left 80MHz.
115  * @center_freq2 : It is valid and non-zero only for 80P80/165MHz. It indicates
116  * the Center Frequency of the right 80MHz segment.
117  * @ocac_status: off channel cac status
118  */
119 struct vdev_adfs_complete_status {
120 	uint32_t vdev_id;
121 	uint32_t chan_freq;
122 	uint32_t chan_width;
123 	uint32_t center_freq1;
124 	uint32_t center_freq2;
125 	enum ocac_status_type ocac_status;
126 };
127 
128 extern struct dfs_to_mlme global_dfs_to_mlme;
129 
130 #ifdef DFS_COMPONENT_ENABLE
131 /**
132  * tgt_dfs_set_current_channel_for_freq() - Fill dfs channel structure from
133  *                                          dfs_channel structure.
134  * @pdev: Pointer to DFS pdev object.
135  * @dfs_ch_freq: Frequency in Mhz.
136  * @dfs_ch_flags: Channel flags.
137  * @dfs_ch_flagext: Extended channel flags.
138  * @dfs_ch_ieee: IEEE channel number.
139  * @dfs_ch_vhtop_ch_freq_seg1: Channel Center frequency1.
140  * @dfs_ch_vhtop_ch_freq_seg2: Channel Center frequency2.
141  * @dfs_ch_mhz_freq_seg1:  Channel center frequency of primary segment in MHZ.
142  * @dfs_ch_mhz_freq_seg2:  Channel center frequency of secondary segment in MHZ
143  *                         applicable only for 80+80MHZ mode of operation.
144  * @dfs_ch_op_puncturing:  Puncturing pattern followed in current operating
145  *                         channel.
146  * @is_channel_updated: Boolean to represent channel update.
147  */
148 #ifdef CONFIG_CHAN_FREQ_API
149 QDF_STATUS
150 tgt_dfs_set_current_channel_for_freq(struct wlan_objmgr_pdev *pdev,
151 				     uint16_t dfs_ch_freq,
152 				     uint64_t dfs_ch_flags,
153 				     uint16_t dfs_ch_flagext,
154 				     uint8_t dfs_ch_ieee,
155 				     uint8_t dfs_ch_vhtop_ch_freq_seg1,
156 				     uint8_t dfs_ch_vhtop_ch_freq_seg2,
157 				     uint16_t dfs_ch_mhz_freq_seg1,
158 				     uint16_t dfs_ch_mhz_freq_seg2,
159 				     uint16_t dfs_ch_op_puncturing,
160 				     bool *is_channel_updated);
161 #endif
162 
163 /**
164  * tgt_dfs_radar_enable() - Enables the radar.
165  * @pdev: Pointer to DFS pdev object.
166  * @no_cac: If no_cac is 0, it cancels the CAC.
167  * @opmode: operating mode
168  * @enable: disable/enable radar
169  *
170  * This is called each time a channel change occurs, to (potentially) enable
171  * the radar code.
172  */
173 QDF_STATUS tgt_dfs_radar_enable(
174 	struct wlan_objmgr_pdev *pdev,
175 	int no_cac, uint32_t opmode, bool enable);
176 
177 /**
178  * tgt_dfs_control()- Used to process ioctls related to DFS.
179  * @pdev: Pointer to DFS pdev object.
180  * @id: Command type.
181  * @indata: Input buffer.
182  * @insize: size of the input buffer.
183  * @outdata: A buffer for the results.
184  * @outsize: Size of the output buffer.
185  * @error: returned error
186  */
187 QDF_STATUS tgt_dfs_control(struct wlan_objmgr_pdev *pdev,
188 	u_int id,
189 	void *indata,
190 	uint32_t insize,
191 	void *outdata,
192 	uint32_t *outsize,
193 	int *error);
194 
195 /**
196  * tgt_dfs_get_radars() - Based on the chipset, calls init radar table functions
197  * @pdev: Pointer to DFS pdev object.
198  *
199  * Wrapper function for dfs_get_radars(). This function called from
200  * outside of DFS component.
201  */
202 QDF_STATUS tgt_dfs_get_radars(struct wlan_objmgr_pdev *pdev);
203 
204 /**
205  * tgt_dfs_process_radar_ind() - Process radar found indication.
206  * @pdev: Pointer to DFS pdev object.
207  * @radar_found: radar found info.
208  *
209  * Process radar found indication.
210  *
211  * Return QDF_STATUS.
212  */
213 QDF_STATUS tgt_dfs_process_radar_ind(struct wlan_objmgr_pdev *pdev,
214 		struct radar_found_info *radar_found);
215 #else
216 
tgt_dfs_radar_enable(struct wlan_objmgr_pdev * pdev,int no_cac,uint32_t opmode,bool enable)217 static inline QDF_STATUS tgt_dfs_radar_enable(
218 	struct wlan_objmgr_pdev *pdev,
219 	int no_cac, uint32_t opmode, bool enable)
220 {
221 	return QDF_STATUS_SUCCESS;
222 }
223 
tgt_dfs_control(struct wlan_objmgr_pdev * pdev,u_int id,void * indata,uint32_t insize,void * outdata,uint32_t * outsize,int * error)224 static inline QDF_STATUS tgt_dfs_control(struct wlan_objmgr_pdev *pdev,
225 	u_int id,
226 	void *indata,
227 	uint32_t insize,
228 	void *outdata,
229 	uint32_t *outsize,
230 	int *error)
231 {
232 	return QDF_STATUS_SUCCESS;
233 }
234 
tgt_dfs_get_radars(struct wlan_objmgr_pdev * pdev)235 static inline QDF_STATUS tgt_dfs_get_radars(struct wlan_objmgr_pdev *pdev)
236 {
237 	return QDF_STATUS_SUCCESS;
238 }
239 
tgt_dfs_process_radar_ind(struct wlan_objmgr_pdev * pdev,struct radar_found_info * radar_found)240 static inline QDF_STATUS tgt_dfs_process_radar_ind(
241 		struct wlan_objmgr_pdev *pdev,
242 		struct radar_found_info *radar_found)
243 {
244 	return QDF_STATUS_SUCCESS;
245 }
246 #endif
247 
248 #ifdef WLAN_DFS_PARTIAL_OFFLOAD
249 /**
250  * tgt_dfs_process_phyerr() - Process phyerr.
251  * @pdev: Pointer to DFS pdev object.
252  * @buf: Phyerr buffer.
253  * @datalen: phyerr buffer length.
254  * @r_rssi: RSSI.
255  * @r_ext_rssi: Extension channel RSSI.
256  * @r_rs_tstamp: Timestamp.
257  * @r_fulltsf: TSF64.
258  *
259  * Wrapper function for dfs_process_phyerr(). This function called from
260  * outside of DFS component.
261  */
262 QDF_STATUS tgt_dfs_process_phyerr(struct wlan_objmgr_pdev *pdev,
263 	void *buf,
264 	uint16_t datalen,
265 	uint8_t r_rssi,
266 	uint8_t r_ext_rssi,
267 	uint32_t r_rs_tstamp,
268 	uint64_t r_fulltsf);
269 #else
tgt_dfs_process_phyerr(struct wlan_objmgr_pdev * pdev,void * buf,uint16_t datalen,uint8_t r_rssi,uint8_t r_ext_rssi,uint32_t r_rs_tstamp,uint64_t r_fulltsf)270 static inline QDF_STATUS tgt_dfs_process_phyerr(struct wlan_objmgr_pdev *pdev,
271 						void *buf,
272 						uint16_t datalen,
273 						uint8_t r_rssi,
274 						uint8_t r_ext_rssi,
275 						uint32_t r_rs_tstamp,
276 						uint64_t r_fulltsf)
277 {
278 	return QDF_STATUS_SUCCESS;
279 }
280 #endif
281 
282 /**
283  * tgt_dfs_process_phyerr_filter_offload() - Process radar event.
284  * Wrapper function for dfs_process_phyerr_filter_offload(). This function
285  * called from outside of DFS component.
286  * @pdev: Pointer to DFS pdev object.
287  * @wlan_radar_event: pointer to radar_event_info.
288  *
289  * Return: QDF_STATUS
290  */
291 QDF_STATUS tgt_dfs_process_phyerr_filter_offload(struct wlan_objmgr_pdev *pdev,
292 	struct radar_event_info *wlan_radar_event);
293 
294 /**
295  * tgt_dfs_is_phyerr_filter_offload() - Is phyerr filter offload.
296  * @psoc: Pointer to psoc object.
297  * @is_phyerr_filter_offload: Pointer to is_phyerr_filter_offload.
298  *
299  * Return: QDF_STATUS
300  */
301 QDF_STATUS tgt_dfs_is_phyerr_filter_offload(struct wlan_objmgr_psoc *psoc,
302 					    bool *is_phyerr_filter_offload);
303 
304 /**
305  * tgt_dfs_destroy_object() - Destroys the DFS object.
306  * @pdev: Pointer to DFS pdev object.
307  *
308  * Wrapper function for  dfs_destroy_object(). This function called from
309  * outside of DFS component.
310  */
311 QDF_STATUS tgt_dfs_destroy_object(struct wlan_objmgr_pdev *pdev);
312 
313 #ifdef MOBILE_DFS_SUPPORT
314 /**
315  * tgt_dfs_set_tx_leakage_threshold() - set tx_leakage_threshold.
316  * @pdev: Pointer to DFS pdev object.
317  *
318  * Return QDF_STATUS.
319  */
320 QDF_STATUS tgt_dfs_set_tx_leakage_threshold(struct wlan_objmgr_pdev *pdev);
321 #else
tgt_dfs_set_tx_leakage_threshold(struct wlan_objmgr_pdev * pdev)322 static inline QDF_STATUS tgt_dfs_set_tx_leakage_threshold
323 		(struct wlan_objmgr_pdev *pdev)
324 {
325 	return QDF_STATUS_SUCCESS;
326 }
327 #endif
328 
329 /**
330  * tgt_dfs_is_precac_timer_running() - Check whether precac timer is running.
331  * @pdev: Pointer to DFS pdev object.
332  * @is_precac_timer_running: Pointer to save precac timer value.
333  *
334  * Wrapper function for dfs_is_precac_timer_running(). This function called from
335  * outside of DFS component.
336  */
337 QDF_STATUS tgt_dfs_is_precac_timer_running(struct wlan_objmgr_pdev *pdev,
338 	bool *is_precac_timer_running);
339 
340 /**
341  * tgt_dfs_set_agile_precac_state() - set state for Agile Precac.
342  *
343  * @pdev: Pointer to DFS pdev object.
344  * @agile_precac_state: Agile Precac state
345  *
346  * wrapper function for  dfs_set_agile_precac_state.
347  * This function called from outside of dfs component.
348  */
349 QDF_STATUS tgt_dfs_set_agile_precac_state(struct wlan_objmgr_pdev *pdev,
350 					  int agile_precac_state);
351 
352 /**
353  * tgt_dfs_agile_precac_start() - Start agile precac
354  *
355  * @pdev: Pointer to DFS pdev object.
356  *
357  * wrapper function for  dfs_set_agile_precac_state.
358  * This function called from outside of dfs component.
359  */
360 QDF_STATUS tgt_dfs_agile_precac_start(struct wlan_objmgr_pdev *pdev);
361 
362 /**
363  * tgt_dfs_ocac_complete() - Process off channel cac complete indication.
364  * @pdev: Pointer to DFS pdev object.
365  * @ocac_status: Off channel CAC complete status.
366  *
367  * wrapper function for  dfs_set_agile_precac_state.
368  * This function called from outside of dfs component.
369  */
370 QDF_STATUS tgt_dfs_ocac_complete(struct wlan_objmgr_pdev *pdev,
371 				 struct vdev_adfs_complete_status *ocac_status);
372 
373 /**
374  * tgt_dfs_cac_complete() - Process cac complete indication.
375  * @pdev: Pointer to DFS pdev object.
376  * @vdev_id: vdev id.
377  *
378  * Process cac complete indication from firmware.
379  *
380  * Return QDF_STATUS.
381  */
382 QDF_STATUS tgt_dfs_cac_complete(struct wlan_objmgr_pdev *pdev,
383 		uint32_t vdev_id);
384 
385 /**
386  * tgt_dfs_reg_ev_handler() - Register dfs events.
387  * @psoc: Pointer to psoc.
388  *
389  * Register dfs events.
390  *
391  * Return: QDF_STATUS.
392  */
393 QDF_STATUS tgt_dfs_reg_ev_handler(struct wlan_objmgr_psoc *psoc);
394 
395 /**
396  * tgt_dfs_stop() - Clear dfs timers.
397  * @pdev: Pointer to pdev object
398  */
399 QDF_STATUS tgt_dfs_stop(struct wlan_objmgr_pdev *pdev);
400 
401 /**
402 * tgt_dfs_process_emulate_bang_radar_cmd() - Process to emulate dfs bangradar
403 *                                            command.
404 * @pdev: Pointer to DFS pdev object.
405 * @dfs_unit_test: bang radar emulation command
406 *
407 * Process  to emulate dfs bangradar command.
408 *
409 * Return: QDF_STATUS.
410 */
411 QDF_STATUS tgt_dfs_process_emulate_bang_radar_cmd(struct wlan_objmgr_pdev *pdev,
412 		struct dfs_emulate_bang_radar_test_cmd *dfs_unit_test);
413 
414 #ifdef MOBILE_DFS_SUPPORT
415 /**
416  * tgt_dfs_set_phyerr_filter_offload() - config phyerr filter offload
417  * @pdev: Pointer to DFS pdev object.
418  *
419  * Return: QDF_STATUS
420  */
421 QDF_STATUS tgt_dfs_set_phyerr_filter_offload(struct wlan_objmgr_pdev *pdev);
422 #else
tgt_dfs_set_phyerr_filter_offload(struct wlan_objmgr_pdev * pdev)423 static inline QDF_STATUS tgt_dfs_set_phyerr_filter_offload
424 	(struct wlan_objmgr_pdev *pdev)
425 {
426 	return QDF_STATUS_SUCCESS;
427 }
428 #endif
429 
430 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
431 /**
432  * tgt_dfs_send_avg_params_to_fw() - send average radar parameters to fw.
433  * @pdev: Pointer to DFS pdev object.
434  * @params: Pointer to dfs radar average parameters.
435  *
436  * Return: QDF_STATUS
437  */
438 QDF_STATUS
439 tgt_dfs_send_avg_params_to_fw(struct wlan_objmgr_pdev *pdev,
440 			      struct dfs_radar_found_params *params);
441 #endif
442 
443 /**
444  * tgt_dfs_action_on_status_from_fw() - trigger the action to be taken based on
445  * host dfs status received from fw.
446  * @pdev: Pointer to pdev object.
447  * @status: Pointer to the host dfs status received from fw.
448  *
449  * Return: QDF_STATUS
450  */
451 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
452 QDF_STATUS tgt_dfs_action_on_status_from_fw(struct wlan_objmgr_pdev *pdev,
453 					    uint32_t *status);
454 #else
455 static inline
tgt_dfs_action_on_status_from_fw(struct wlan_objmgr_pdev * pdev,uint32_t * status)456 QDF_STATUS tgt_dfs_action_on_status_from_fw(struct wlan_objmgr_pdev *pdev,
457 					    uint32_t *status)
458 {
459 	return QDF_STATUS_SUCCESS;
460 }
461 #endif
462 
463 /**
464  * tgt_dfs_is_radar_enabled() - checks if radar detection is enabled.
465  * @pdev: Pointer to pdev object.
466  * @ignore_dfs: Pointer to check the value. If 1, radar detection is disabled.
467  */
468 void tgt_dfs_is_radar_enabled(struct wlan_objmgr_pdev *pdev, int *ignore_dfs);
469 
470 /**
471  * tgt_dfs_reset_spoof_test() - reset the dfs spoof check variables
472  * @pdev: Pointer to pdev object.
473  *
474  * Return: QDF_STATUS
475  */
476 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
477 QDF_STATUS tgt_dfs_reset_spoof_test(struct wlan_objmgr_pdev *pdev);
478 #else
479 static inline
tgt_dfs_reset_spoof_test(struct wlan_objmgr_pdev * pdev)480 QDF_STATUS tgt_dfs_reset_spoof_test(struct wlan_objmgr_pdev *pdev)
481 {
482 	return QDF_STATUS_SUCCESS;
483 }
484 #endif
485 
486 /**
487  * tgt_dfs_enable_stadfs() - Enable/Disable STADFS capability.
488  * @pdev: Pointer to DFS pdev object.
489  * @val: input value.
490  */
491 #ifdef QCA_SUPPORT_STA_DFS
492 void tgt_dfs_enable_stadfs(struct wlan_objmgr_pdev *pdev, bool val);
493 #else
494 static inline
tgt_dfs_enable_stadfs(struct wlan_objmgr_pdev * pdev,bool val)495 void tgt_dfs_enable_stadfs(struct wlan_objmgr_pdev *pdev, bool val)
496 {
497 }
498 #endif
499 
500 /**
501  * tgt_dfs_is_stadfs_enabled() - Get STADFS capability
502  * @pdev: Pointer to DFS pdev object.
503  *
504  * Return: true if STADFS is enabled, else false.
505  */
506 #ifdef QCA_SUPPORT_STA_DFS
507 bool tgt_dfs_is_stadfs_enabled(struct wlan_objmgr_pdev *pdev);
508 #else
509 static inline
tgt_dfs_is_stadfs_enabled(struct wlan_objmgr_pdev * pdev)510 bool tgt_dfs_is_stadfs_enabled(struct wlan_objmgr_pdev *pdev)
511 {
512 	return false;
513 }
514 #endif
515 
516 /**
517  * tgt_dfs_is_5ghz_supported_in_pdev() - Check if the input pdev supports 5GHZ.
518  * @pdev: Pointer to DFS pdev object.
519  *
520  * Return: true if the pdev supports 5GHz, else false.
521  */
522 bool tgt_dfs_is_5ghz_supported_in_pdev(struct wlan_objmgr_pdev *pdev);
523 
524 #if defined(WLAN_DFS_FULL_OFFLOAD) && defined(QCA_DFS_NOL_OFFLOAD)
525 /**
526  * tgt_dfs_send_usenol_pdev_param() - Send usenol pdev param to FW.
527  * @pdev: Pointer to pdev object.
528  * @usenol: Value of usenol
529  *
530  * Return: QDF_STATUS
531  */
532 QDF_STATUS tgt_dfs_send_usenol_pdev_param(struct wlan_objmgr_pdev *pdev,
533 					  bool usenol);
534 
535 /**
536  * tgt_dfs_send_subchan_marking() - Send subchannel marking pdev param to FW.
537  * @pdev: Pointer to pdev object.
538  * @subchanmark: Value of subchannel_marking.
539  *
540  * Return: QDF_STATUS
541  */
542 QDF_STATUS tgt_dfs_send_subchan_marking(struct wlan_objmgr_pdev *pdev,
543 					bool subchanmark);
544 #else
545 static inline
tgt_dfs_send_usenol_pdev_param(struct wlan_objmgr_pdev * pdev,bool usenol)546 QDF_STATUS tgt_dfs_send_usenol_pdev_param(struct wlan_objmgr_pdev *pdev,
547 					  bool usenol)
548 {
549 	return QDF_STATUS_SUCCESS;
550 }
551 
552 static inline QDF_STATUS
tgt_dfs_send_subchan_marking(struct wlan_objmgr_pdev * pdev,bool subchanmark)553 tgt_dfs_send_subchan_marking(struct wlan_objmgr_pdev *pdev, bool subchanmark)
554 {
555 	return QDF_STATUS_SUCCESS;
556 }
557 #endif
558 #ifdef QCA_SUPPORT_AGILE_DFS
559 /**
560  * tgt_dfs_set_fw_adfs_support() - Set FW aDFS support in dfs object.
561  * @pdev: Pointer to pdev object.
562  * @fw_adfs_support_160: aDFS enabled when pdev is on 160/80P80MHz.
563  * @fw_adfs_support_non_160: aDFS enabled when pdev is on 20/40/80MHz.
564  * @fw_adfs_support_320: aDFS enabled when pdev is on 320 MHz.
565  *
566  * Return: void.
567  */
568 void tgt_dfs_set_fw_adfs_support(struct wlan_objmgr_pdev *pdev,
569 				 bool fw_adfs_support_160,
570 				 bool fw_adfs_support_non_160,
571 				 bool fw_adfs_support_320);
572 #else
573 static inline
tgt_dfs_set_fw_adfs_support(struct wlan_objmgr_pdev * pdev,bool fw_adfs_support_160,bool fw_adfs_support_non_160,bool fw_adfs_support_320)574 void tgt_dfs_set_fw_adfs_support(struct wlan_objmgr_pdev *pdev,
575 				 bool fw_adfs_support_160,
576 				 bool fw_adfs_support_non_160,
577 				 bool fw_adfs_support_320)
578 {
579 }
580 #endif
581 
582 #ifdef QCA_HW_MODE_SWITCH
583 /**
584  * tgt_dfs_init_tmp_psoc_nol() - Init temporary psoc NOL structure.
585  * @pdev: Pointer to pdev object.
586  * @num_radios: Number of radios in the psoc.
587  *
588  * Return: void.
589  */
590 void tgt_dfs_init_tmp_psoc_nol(struct wlan_objmgr_pdev *pdev,
591 			       uint8_t num_radios);
592 
593 /**
594  * tgt_dfs_deinit_tmp_psoc_nol() - De-init temporary psoc NOL structure.
595  * @pdev: Pointer to pdev object.
596  *
597  * Return: void.
598  */
599 void tgt_dfs_deinit_tmp_psoc_nol(struct wlan_objmgr_pdev *pdev);
600 
601 /**
602  * tgt_dfs_save_dfs_nol_in_psoc() - Save NOL data of given pdev.
603  * @pdev: Pointer to pdev object.
604  * @pdev_id: The pdev ID which will have the NOL data.
605  *
606  * Based on the frequency of the NOL channel, copy it to the target pdev_id
607  * structure in psoc.
608  *
609  * Return: void.
610  */
611 void tgt_dfs_save_dfs_nol_in_psoc(struct wlan_objmgr_pdev *pdev,
612 				  uint8_t pdev_id);
613 
614 /**
615  * tgt_dfs_reinit_nol_from_psoc_copy() - Reinit saved NOL data to corresponding
616  * pdevs.
617  * @pdev: Pointer to pdev object.
618  * @pdev_id: pdev_id of the given pdev.
619  * @low_5ghz_freq: The low 5GHz frequency value of the target pdev id.
620  * @high_5ghz_freq: The high 5GHz frequency value of the target pdev id.
621  *
622  * Return: void.
623  */
624 void tgt_dfs_reinit_nol_from_psoc_copy(struct wlan_objmgr_pdev *pdev,
625 				       uint8_t pdev_id,
626 				       uint16_t low_5ghz_freq,
627 				       uint16_t high_5ghz_freq);
628 
629 /**
630  * tgt_dfs_reinit_precac_lists() - Reinit preCAC lists.
631  * @src_pdev: Source pdev object from which the preCAC list is copied.
632  * @dest_pdev: Destination pdev object to which the preCAC list is copied.
633  * @low_5g_freq: Low 5G frequency value of the destination DFS.
634  * @high_5g_freq: High 5G frequency value of the destination DFS.
635  *
636  * Copy all the preCAC list entries from the source pdev object to the
637  * destination pdev object which fall within the frequency range of
638  * low_5g_freq and high_5g_freq.
639  *
640  * Return: None (void).
641  */
642 void tgt_dfs_reinit_precac_lists(struct wlan_objmgr_pdev *src_pdev,
643 				 struct wlan_objmgr_pdev *dest_pdev,
644 				 uint16_t low_5g_freq,
645 				 uint16_t high_5g_freq);
646 
647 /**
648  * tgt_dfs_complete_deferred_tasks() - Process HW mode switch completion and
649  * handle deferred tasks.
650  * @pdev: Pointer to primary pdev object.
651  *
652  * Return: void.
653  */
654 void tgt_dfs_complete_deferred_tasks(struct wlan_objmgr_pdev *pdev);
655 #else
656 static inline
tgt_dfs_init_tmp_psoc_nol(struct wlan_objmgr_pdev * pdev,uint8_t num_radios)657 void tgt_dfs_init_tmp_psoc_nol(struct wlan_objmgr_pdev *pdev,
658 			       uint8_t num_radios)
659 {
660 }
661 
662 static inline
tgt_dfs_deinit_tmp_psoc_nol(struct wlan_objmgr_pdev * pdev)663 void tgt_dfs_deinit_tmp_psoc_nol(struct wlan_objmgr_pdev *pdev)
664 {
665 }
666 
667 static inline
tgt_dfs_save_dfs_nol_in_psoc(struct wlan_objmgr_pdev * pdev,uint8_t pdev_id)668 void tgt_dfs_save_dfs_nol_in_psoc(struct wlan_objmgr_pdev *pdev,
669 				  uint8_t pdev_id)
670 {
671 }
672 
673 static inline
tgt_dfs_reinit_nol_from_psoc_copy(struct wlan_objmgr_pdev * pdev,uint8_t pdev_id,uint16_t low_5ghz_freq,uint16_t high_5ghz_freq)674 void tgt_dfs_reinit_nol_from_psoc_copy(struct wlan_objmgr_pdev *pdev,
675 				       uint8_t pdev_id,
676 				       uint16_t low_5ghz_freq,
677 				       uint16_t high_5ghz_freq)
678 {
679 }
680 
681 static inline
tgt_dfs_reinit_precac_lists(struct wlan_objmgr_pdev * src_pdev,struct wlan_objmgr_pdev * dest_pdev,uint16_t low_5g_freq,uint16_t high_5g_freq)682 void tgt_dfs_reinit_precac_lists(struct wlan_objmgr_pdev *src_pdev,
683 				 struct wlan_objmgr_pdev *dest_pdev,
684 				 uint16_t low_5g_freq,
685 				 uint16_t high_5g_freq)
686 {
687 }
688 
689 static inline
tgt_dfs_complete_deferred_tasks(struct wlan_objmgr_pdev * pdev)690 void tgt_dfs_complete_deferred_tasks(struct wlan_objmgr_pdev *pdev)
691 {
692 }
693 #endif
694 #endif /* _WLAN_DFS_TGT_API_H_ */
695