1 /*
2  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
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 #ifndef _WLAN_CFR_UCFG_API_H_
21 #define _WLAN_CFR_UCFG_API_H_
22 
23 #include <wlan_objmgr_peer_obj.h>
24 #include <wlan_objmgr_pdev_obj.h>
25 #include <wlan_cfr_public_structs.h>
26 #include <wlan_cfr_utils_api.h>
27 
28 /**
29  * ucfg_cfr_start_capture() - function to start cfr capture for connected client
30  * @pdev: pointer to pdev object
31  * @peer: pointer to peer object
32  * @cfr_params: config params to cfr capture
33  *
34  * Return: status of start capture.
35  */
36 int ucfg_cfr_start_capture(struct wlan_objmgr_pdev *pdev,
37 			   struct wlan_objmgr_peer *peer,
38 			   struct cfr_capture_params *cfr_params);
39 
40 /**
41  * ucfg_cfr_get_capture_status() - function to populate capture status
42  * @pdev: pointer to pdev object
43  * @status: capture status
44  *
45  * Return: none
46  */
47 void ucfg_cfr_get_capture_status(struct wlan_objmgr_pdev *pdev,
48 				 enum cfr_capt_status *status);
49 
50 /**
51  * ucfg_cfr_stop_capture() - function to stop cfr capture for connected client
52  * @pdev: pointer to pdev object
53  * @peer: pointer to peer object
54  *
55  * Return: status of stop capture.
56  */
57 int ucfg_cfr_stop_capture(struct wlan_objmgr_pdev *pdev,
58 			  struct wlan_objmgr_peer *peer);
59 
60 /**
61  * ucfg_cfr_start_capture_probe_req() - function to start cfr capture for
62  *					unassociated clients
63  * @pdev: pointer to pdev object
64  * @unassoc_mac: mac address of un-associated client
65  * @params: config params to cfr capture
66  *
67  * Return: status of start capture.
68  */
69 int ucfg_cfr_start_capture_probe_req(struct wlan_objmgr_pdev *pdev,
70 				     struct qdf_mac_addr *unassoc_mac,
71 				     struct cfr_capture_params *params);
72 
73 /**
74  * ucfg_cfr_stop_capture_probe_req() - function to stop cfr capture for
75  *				       unassociated clients
76  * @pdev: pointer to pdev object
77  * @unassoc_mac: mac address of un-associated client
78  *
79  * Return: status of stop capture.
80  */
81 int ucfg_cfr_stop_capture_probe_req(struct wlan_objmgr_pdev *pdev,
82 				    struct qdf_mac_addr *unassoc_mac);
83 
84 /**
85  * ucfg_cfr_list_peers() - Lists total number of peers with cfr capture enabled
86  * @pdev: pointer to pdev object
87  *
88  * Return: number of peers with cfr capture enabled
89  */
90 int ucfg_cfr_list_peers(struct wlan_objmgr_pdev *pdev);
91 
92 /**
93  * ucfg_cfr_set_timer() - function to enable cfr timer
94  * @pdev: pointer to pdev object
95  * @value: value to be set
96  *
97  * Return: status of timer enable
98  */
99 int ucfg_cfr_set_timer(struct wlan_objmgr_pdev *pdev, uint32_t value);
100 
101 /**
102  * ucfg_cfr_get_timer() - function to get cfr_timer_enable
103  * @pdev: pointer to pdev object
104  *
105  * Return: value of cfr_timer_enable
106  */
107 int ucfg_cfr_get_timer(struct wlan_objmgr_pdev *pdev);
108 
109 /**
110  * ucfg_cfr_stop_indication() - User space API to write cfr stop string
111  * @vdev: pointer to vdev object
112  *
113  * Write stop string and indicate to up layer.
114  *
115  * Return: status of write CFR stop string
116  */
117 QDF_STATUS ucfg_cfr_stop_indication(struct wlan_objmgr_vdev *vdev);
118 
119 #ifdef WLAN_CFR_ADRASTEA
120 /**
121  * ucfg_cfr_capture_data() - API called when HTT msg for CFR dump ind received
122  * @psoc: pointer to psoc object
123  * @vdev_id : vdev id
124  * @hdr: CFR header
125  * @mem_index: start offset index of dump in mem
126  *
127  * Return: None
128  */
129 void ucfg_cfr_capture_data(struct wlan_objmgr_psoc *psoc, uint32_t vdev_id,
130 			   struct csi_cfr_header *hdr, uint32_t mem_index);
131 #else
132 static inline
ucfg_cfr_capture_data(struct wlan_objmgr_psoc * psoc,uint32_t vdev_id,struct csi_cfr_header * hdr,uint32_t mem_index)133 void ucfg_cfr_capture_data(struct wlan_objmgr_psoc *psoc, uint32_t vdev_id,
134 			   struct csi_cfr_header *hdr, uint32_t mem_index)
135 {
136 }
137 #endif
138 
139 #ifdef WLAN_ENH_CFR_ENABLE
140 /* Channel capture recipe filters */
141 enum capture_type {
142 	RCC_DIRECTED_FTM_FILTER,
143 	RCC_ALL_FTM_ACK_FILTER,
144 	RCC_DIRECTED_NDPA_NDP_FILTER,
145 	RCC_NDPA_NDP_ALL_FILTER,
146 	RCC_TA_RA_FILTER,
147 	RCC_ALL_PACKET_FILTER,
148 	RCC_DIS_ALL_MODE,
149 };
150 
151 /**
152  * ucfg_cfr_set_rcc_mode() - function to set RCC mode
153  * @vdev: pointer to vdev object
154  * @mode: capture type passed by user
155  * @value: Enable/Disable capture mode
156  *
157  * Return: status if the mode is set or not
158  */
159 QDF_STATUS ucfg_cfr_set_rcc_mode(struct wlan_objmgr_vdev *vdev,
160 				 enum capture_type mode, uint8_t value);
161 
162 /**
163  * ucfg_cfr_get_rcc_enabled() - function to get RCC mode
164  * @vdev: pointer to vdev object
165  *
166  * Return: if the rcc is enabled or not
167  */
168 bool ucfg_cfr_get_rcc_enabled(struct wlan_objmgr_vdev *vdev);
169 
170 /**
171  * ucfg_cfr_set_tara_config() - function to configure TA/RA address and mask
172  * @vdev: pointer to vdev object
173  * @params: user config
174  *
175  * Return: status
176  */
177 QDF_STATUS ucfg_cfr_set_tara_config(struct wlan_objmgr_vdev *vdev,
178 				    struct cfr_wlanconfig_param *params);
179 
180 /**
181  * ucfg_cfr_set_bw_nss() - function to configure nss and bandwidth
182  * @vdev: pointer to vdev object
183  * @params: user config
184  *
185  * Return: status
186  */
187 QDF_STATUS ucfg_cfr_set_bw_nss(struct wlan_objmgr_vdev *vdev,
188 			       struct cfr_wlanconfig_param *params);
189 
190 /**
191  * ucfg_cfr_set_frame_type_subtype() - function to configure frame type/subtype
192  * @vdev: pointer to vdev object
193  * @params: user config
194  *
195  * Return: status
196  */
197 QDF_STATUS
198 ucfg_cfr_set_frame_type_subtype(struct wlan_objmgr_vdev *vdev,
199 				struct cfr_wlanconfig_param *params);
200 
201 /**
202  * ucfg_cfr_set_capture_duration() - function to configure capture duration
203  * @vdev: pointer to vdev object
204  * @params: user config
205  *
206  * Return: status
207  */
208 QDF_STATUS
209 ucfg_cfr_set_capture_duration(struct wlan_objmgr_vdev *vdev,
210 			      struct cfr_wlanconfig_param *params);
211 
212 /**
213  * ucfg_cfr_set_capture_interval() - function to configure capture interval
214  * @vdev: pointer to vdev object
215  * @params: user config
216  *
217  * Return: status
218  */
219 QDF_STATUS
220 ucfg_cfr_set_capture_interval(struct wlan_objmgr_vdev *vdev,
221 			      struct cfr_wlanconfig_param *params);
222 
223 /**
224  * ucfg_cfr_set_tara_filterin_as_fp() - function to FP/MO filtering for m_TA_RA
225  * @vdev: pointer to vdev object
226  * @params: user config
227  *
228  * Return: status
229  */
230 QDF_STATUS
231 ucfg_cfr_set_tara_filterin_as_fp(struct wlan_objmgr_vdev *vdev,
232 				 struct cfr_wlanconfig_param *params);
233 
234 /**
235  * ucfg_cfr_set_capture_count() - function to configure capture count
236  * @vdev: pointer to vdev object
237  * @params: user config
238  *
239  * Return: status
240  */
241 QDF_STATUS
242 ucfg_cfr_set_capture_count(struct wlan_objmgr_vdev *vdev,
243 			   struct cfr_wlanconfig_param *params);
244 
245 /**
246  * ucfg_cfr_set_capture_interval_mode_sel() - function to configure capture
247  *					      interval mode nob
248  * @vdev: pointer to vdev object
249  * @params: user confi
250  *
251  * Return: status
252  */
253 QDF_STATUS
254 ucfg_cfr_set_capture_interval_mode_sel(struct wlan_objmgr_vdev *vdev,
255 				       struct cfr_wlanconfig_param *params);
256 
257 /**
258  * ucfg_cfr_set_en_bitmap() - function to configure 16-bit bitmap in TA_RA mode
259  * @vdev: pointer to vdev object
260  * @params: user config
261  *
262  * Return: status
263  */
264 QDF_STATUS ucfg_cfr_set_en_bitmap(struct wlan_objmgr_vdev *vdev,
265 				  struct cfr_wlanconfig_param *params);
266 
267 /**
268  * ucfg_cfr_set_reset_bitmap() - function to clear all 9 params for all 16
269  * groups in TA_RA mode
270  * @vdev: pointer to vdev object
271  * @params: user config
272  *
273  * Return: status
274  */
275 QDF_STATUS ucfg_cfr_set_reset_bitmap(struct wlan_objmgr_vdev *vdev,
276 				     struct cfr_wlanconfig_param *params);
277 
278 /**
279  * ucfg_cfr_set_ul_mu_user_mask() - function to configure UL MU user mask
280  * @vdev: pointer to vdev object
281  * @params: user config
282  *
283  * Return: status
284  */
285 QDF_STATUS
286 ucfg_cfr_set_ul_mu_user_mask(struct wlan_objmgr_vdev *vdev,
287 			     struct cfr_wlanconfig_param *params);
288 
289 /**
290  * ucfg_cfr_set_freeze_tlv_delay_cnt() - function to configure freeze TLV delay
291  * count threshold
292  * @vdev: pointer to vdev object
293  * @params: user config
294  *
295  * Return: status
296  */
297 QDF_STATUS
298 ucfg_cfr_set_freeze_tlv_delay_cnt(struct wlan_objmgr_vdev *vdev,
299 				  struct cfr_wlanconfig_param *params);
300 
301 /**
302  * ucfg_cfr_committed_rcc_config() - function to commit user config
303  * @vdev: pointer to vdev object
304  *
305  * Return: status
306  */
307 QDF_STATUS ucfg_cfr_committed_rcc_config(struct wlan_objmgr_vdev *vdev);
308 
309 /**
310  * ucfg_cfr_get_cfg() - function to display user config
311  * @vdev: pointer to vdev object
312  *
313  * Return: status
314  */
315 QDF_STATUS ucfg_cfr_get_cfg(struct wlan_objmgr_vdev *vdev);
316 
317 /**
318  * ucfg_cfr_rcc_dump_dbg_counters() - function to display PPDU counters
319  * @vdev: pointer to vdev object
320  *
321  * Return: status
322  */
323 QDF_STATUS ucfg_cfr_rcc_dump_dbg_counters(struct wlan_objmgr_vdev *vdev);
324 
325 /**
326  * ucfg_cfr_rcc_clr_dbg_counters() - function to clear CFR PPDU counters
327  * @vdev: pointer to vdev object
328  *
329  * Return: status
330  */
331 QDF_STATUS ucfg_cfr_rcc_clr_dbg_counters(struct wlan_objmgr_vdev *vdev);
332 
333 /**
334  * ucfg_cfr_rcc_dump_lut() - function to display lookup table
335  * @vdev: pointer to vdev object
336  *
337  * Return: status
338  */
339 QDF_STATUS ucfg_cfr_rcc_dump_lut(struct wlan_objmgr_vdev *vdev);
340 
341 /**
342  * ucfg_cfr_subscribe_ppdu_desc() - User space interface to
343  * subscribe/unsubscribe WDI PPDU desc event
344  * @pdev: pointer to pdev_object
345  * @is_subscribe: subscribe or unsubscribei
346  *
347  * return QDF status
348  */
349 QDF_STATUS ucfg_cfr_subscribe_ppdu_desc(struct wlan_objmgr_pdev *pdev,
350 					bool is_subscribe);
351 
352 #ifdef WLAN_CFR_PM
353 /**
354  * ucfg_cfr_suspend() - User space interface to
355  * set suspend status to CFR
356  * @pdev: pointer to pdev_object
357  *
358  * return QDF status
359  */
360 QDF_STATUS ucfg_cfr_suspend(struct wlan_objmgr_pdev *pdev);
361 
362 /**
363  * ucfg_cfr_resume() - User space interface to
364  * set resume status to CFR
365  * @pdev: pointer to pdev_object
366  *
367  * return QDF status
368  */
369 QDF_STATUS ucfg_cfr_resume(struct wlan_objmgr_pdev *pdev);
370 #else
371 static inline QDF_STATUS
ucfg_cfr_suspend(struct wlan_objmgr_pdev * pdev)372 ucfg_cfr_suspend(struct wlan_objmgr_pdev *pdev)
373 {
374 	return QDF_STATUS_E_NOSUPPORT;
375 }
376 
377 static inline QDF_STATUS
ucfg_cfr_resume(struct wlan_objmgr_pdev * pdev)378 ucfg_cfr_resume(struct wlan_objmgr_pdev *pdev)
379 {
380 	return QDF_STATUS_E_NOSUPPORT;
381 }
382 #endif /* end of WLAN_CFR_PM */
383 #endif
384 #endif
385