xref: /wlan-driver/qca-wifi-host-cmn/umac/dfs/core/src/dfs_partial_offload_radar.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2017-2019 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: dfs_partial_offload_radar.h
23  * This file contains partial offload specific dfs interfaces
24  */
25 
26 #ifndef _DFS_PARTIAL_OFFLOAD_RADAR_H_
27 #define _DFS_PARTIAL_OFFLOAD_RADAR_H_
28 
29 /**
30  * dfs_get_po_radars() - Initialize the RADAR table for PO.
31  * @dfs: Pointer to wlan_dfs structure.
32  */
33 #if defined(WLAN_DFS_PARTIAL_OFFLOAD)
34 void dfs_get_po_radars(struct wlan_dfs *dfs);
35 #else
dfs_get_po_radars(struct wlan_dfs * dfs)36 static inline void dfs_get_po_radars(struct wlan_dfs *dfs)
37 {
38 }
39 #endif
40 
41 /**
42  * dfs_send_avg_params_to_fw() - send avg radar parameters to FW.
43  * @dfs: Pointer to wlan_dfs structure.
44  * @params: Pointer to dfs_radar_found_params.
45  *
46  * Return: None
47  */
48 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
49 void dfs_send_avg_params_to_fw(struct wlan_dfs *dfs,
50 			       struct dfs_radar_found_params *params);
51 #else
52 static inline
dfs_send_avg_params_to_fw(struct wlan_dfs * dfs,struct dfs_radar_found_params * params)53 void dfs_send_avg_params_to_fw(struct wlan_dfs *dfs,
54 			       struct dfs_radar_found_params *params)
55 {
56 }
57 #endif
58 
59 /**
60  * dfs_host_wait_timer_init() - Initialize dfs host status wait timer.
61  * @dfs: Pointer to wlan_dfs structure.
62  */
63 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
64 void dfs_host_wait_timer_init(struct wlan_dfs *dfs);
65 #else
dfs_host_wait_timer_init(struct wlan_dfs * dfs)66 static inline void dfs_host_wait_timer_init(struct wlan_dfs *dfs)
67 {
68 }
69 #endif
70 
71 /**
72  * dfs_host_wait_timer_detach() - Free dfs host status wait timer.
73  * @dfs: Pointer to wlan_dfs structure.
74  */
75 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
76 void dfs_host_wait_timer_detach(struct wlan_dfs *dfs);
77 #else
dfs_host_wait_timer_detach(struct wlan_dfs * dfs)78 static inline void dfs_host_wait_timer_detach(struct wlan_dfs *dfs)
79 {
80 }
81 #endif
82 
83 /**
84  * dfs_set_override_status_timeout() - Change the dfs host status timeout.
85  * @dfs: Pointer to wlan_dfs structure.
86  * @status_timeout: timeout value.
87  *
88  * Return: QDF_STATUS
89  */
90 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
91 QDF_STATUS dfs_set_override_status_timeout(struct wlan_dfs *dfs,
92 				       int status_timeout);
93 #else
dfs_set_override_status_timeout(struct wlan_dfs * dfs,int status_timeout)94 static inline QDF_STATUS dfs_set_override_status_timeout(struct wlan_dfs *dfs,
95 						     int status_timeout)
96 {
97 	return QDF_STATUS_SUCCESS;
98 }
99 #endif
100 
101 /**
102  * dfs_get_override_status_timeout() - Get the dfs host status timeout value.
103  * @dfs: Pointer to wlan_dfs structure.
104  * @status_timeout: Pointer to  timeout value.
105  *
106  * Return: QDF_STATUS
107  */
108 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
109 QDF_STATUS dfs_get_override_status_timeout(struct wlan_dfs *dfs,
110 					   int *status_timeout);
111 #else
112 static inline
dfs_get_override_status_timeout(struct wlan_dfs * dfs,int * status_timeout)113 QDF_STATUS dfs_get_override_status_timeout(struct wlan_dfs *dfs,
114 					   int *status_timeout)
115 {
116 	return QDF_STATUS_SUCCESS;
117 }
118 #endif
119 
120 /**
121  * dfs_radarfound_action_fcc() - The dfs action on radar detection by host for
122  * FCC domain.
123  * @dfs: Pointer to wlan_dfs structure.
124  * @seg_id: segment id.
125  *
126  * Return: None
127  */
128 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
129 void dfs_radarfound_action_fcc(struct wlan_dfs *dfs, uint8_t seg_id);
130 #else
dfs_radarfound_action_fcc(struct wlan_dfs * dfs,uint8_t seg_id)131 static inline void dfs_radarfound_action_fcc(struct wlan_dfs *dfs,
132 					     uint8_t seg_id)
133 {
134 }
135 #endif
136 
137 /**
138  * dfs_host_wait_timer_reset() - Stop dfs host wait timer.
139  * @dfs: Pointer to wlan_dfs structure.
140  */
141 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
142 void dfs_host_wait_timer_reset(struct wlan_dfs *dfs);
143 #else
dfs_host_wait_timer_reset(struct wlan_dfs * dfs)144 static inline void dfs_host_wait_timer_reset(struct wlan_dfs *dfs)
145 {
146 }
147 #endif
148 
149 /**
150  * dfs_remove_spoof_channel_from_nol() - Remove the spoofed radar hit channel
151  * from NOL.
152  * @dfs: Pointer to wlan_dfs structure.
153  */
154 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
155 void dfs_remove_spoof_channel_from_nol(struct wlan_dfs *dfs);
156 #else
dfs_remove_spoof_channel_from_nol(struct wlan_dfs * dfs)157 static inline void dfs_remove_spoof_channel_from_nol(struct wlan_dfs *dfs)
158 {
159 }
160 #endif
161 
162 /**
163  * dfs_reset_spoof_test() - reset the spoof test variables.
164  * @dfs: Pointer to wlan_dfs structure.
165  *
166  * Return: None.
167  */
168 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
169 void dfs_reset_spoof_test(struct wlan_dfs *dfs);
170 #else
dfs_reset_spoof_test(struct wlan_dfs * dfs)171 static inline void dfs_reset_spoof_test(struct wlan_dfs *dfs)
172 {
173 }
174 #endif
175 
176 /**
177  * dfs_action_on_fw_radar_status_check() - The dfs action on host dfs
178  * confirmation by fw.
179  * @dfs: Pointer to wlan_dfs structure.
180  * @status: pointer to host dfs status.
181  *
182  * Return: None
183  */
184 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
185 void dfs_action_on_fw_radar_status_check(struct wlan_dfs *dfs,
186 					 uint32_t *status);
187 #else
dfs_action_on_fw_radar_status_check(struct wlan_dfs * dfs,uint32_t * status)188 static inline void dfs_action_on_fw_radar_status_check(struct wlan_dfs *dfs,
189 						       uint32_t *status)
190 {
191 }
192 #endif
193 
194 #if defined(WLAN_DFS_PARTIAL_OFFLOAD)
195 void dfs_false_radarfound_reset_vars(struct wlan_dfs *dfs);
196 #else
dfs_false_radarfound_reset_vars(struct wlan_dfs * dfs)197 static inline void dfs_false_radarfound_reset_vars(struct wlan_dfs *dfs)
198 {
199 }
200 #endif
201 
202 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(WLAN_DFS_SYNTHETIC_RADAR)
203 /**
204  * dfs_allow_hw_pulses() - Set or unset dfs_allow_hw_pulses
205  * which allow or disallow HW pulses.
206  * @dfs: Pointer to DFS pdev object.
207  * @allow_hw_pulses: allow/disallow synthetic pulse detection true/false.
208  *
209  * Return: void
210  */
211 void dfs_allow_hw_pulses(struct wlan_dfs *dfs, bool allow_hw_pulses);
212 #else
dfs_allow_hw_pulses(struct wlan_dfs * dfs,bool allow_hw_pulses)213 static inline void dfs_allow_hw_pulses(struct wlan_dfs *dfs,
214 				       bool allow_hw_pulses)
215 {
216 }
217 #endif
218 
219 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(WLAN_DFS_SYNTHETIC_RADAR)
220 /**
221  * dfs_is_hw_pulses_allowed() - Check if HW pulses are allowed or not.
222  * @dfs: Pointer to wlan_dfs structure.
223  *
224  * Return: bool
225  */
226 bool dfs_is_hw_pulses_allowed(struct wlan_dfs *dfs);
227 #else
dfs_is_hw_pulses_allowed(struct wlan_dfs * dfs)228 static inline bool dfs_is_hw_pulses_allowed(struct wlan_dfs *dfs)
229 {
230 	return true;
231 }
232 #endif
233 
234 /**
235  * dfs_inject_synthetic_pulse_sequence() - Inject the synthetic pulse to the
236  * phyerror processing algorithm.
237  * @dfs: Pointer to wlan_dfs structure.
238  * @buf: Pointer to buffer of pulses.
239  *
240  * Return: QDF_STATUS
241  */
242 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(WLAN_DFS_SYNTHETIC_RADAR)
243 QDF_STATUS dfs_inject_synthetic_pulse_sequence(struct wlan_dfs *dfs,
244 					       unsigned char *buf);
245 #else
246 static inline
dfs_inject_synthetic_pulse_sequence(struct wlan_dfs * dfs,unsigned char * buf)247 QDF_STATUS dfs_inject_synthetic_pulse_sequence(struct wlan_dfs *dfs,
248 					       unsigned char *buf)
249 {
250 	return QDF_STATUS_SUCCESS;
251 }
252 #endif /* WLAN_DFS_PARTIAL_OFFLOAD && WLAN_DFS_SYNTHETIC_RADAR */
253 
254 /**
255  * dfs_disable_radar_and_flush_pulses() - Disable radar detect and flush
256  * the pulses to avoid false radar detects
257  * @dfs: Pointer to struct wlan_dfs
258  *
259  * Return: None
260  */
261 #if defined(WLAN_DFS_PARTIAL_OFFLOAD)
262 void
263 dfs_disable_radar_and_flush_pulses(struct wlan_dfs *dfs);
264 #else
265 static inline void
dfs_disable_radar_and_flush_pulses(struct wlan_dfs * dfs)266 dfs_disable_radar_and_flush_pulses(struct wlan_dfs *dfs)
267 {
268 }
269 #endif
270 
271 #endif /*  _DFS_PARTIAL_OFFLOAD_RADAR_H_ */
272