xref: /wlan-dirver/qca-wifi-host-cmn/umac/scan/dispatcher/inc/wlan_scan_api.h (revision 97f44cd39e4ff816eaa1710279d28cf6b9e65ad9)
1 /*
2  * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /*
20  * DOC: contains scan api
21  */
22 
23 #ifndef _WLAN_SCAN_API_H_
24 #define _WLAN_SCAN_API_H_
25 
26 #include <wlan_objmgr_psoc_obj.h>
27 #include <wlan_objmgr_pdev_obj.h>
28 #include <wlan_objmgr_vdev_obj.h>
29 #include "../../core/src/wlan_scan_main.h"
30 
31 /**
32  * wlan_scan_cfg_set_active_2g_dwelltime() - API to set scan active 2g dwelltime
33  * @psoc: pointer to psoc object
34  * @dwell_time: scan active dwell time
35  *
36  * Return: none
37  */
38 void wlan_scan_cfg_set_active_2g_dwelltime(struct wlan_objmgr_psoc *psoc,
39 					   uint32_t dwell_time);
40 
41 /**
42  * wlan_scan_cfg_get_active_2g_dwelltime() - API to get active 2g dwelltime
43  * @psoc: pointer to psoc object
44  * @dwell_time: scan active dwelltime
45  *
46  * Return: scan active dwell time
47  */
48 void wlan_scan_cfg_get_active_2g_dwelltime(struct wlan_objmgr_psoc *psoc,
49 					   uint32_t *dwell_time);
50 
51 #ifdef CONFIG_BAND_6GHZ
52 /**
53  * wlan_scan_cfg_set_active_6g_dwelltime() - API to set scan active 6g dwelltime
54  * @psoc: pointer to psoc object
55  * @dwell_time: scan active dwell time
56  *
57  * Return: QDF_STATUS
58  */
59 QDF_STATUS wlan_scan_cfg_set_active_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
60 						 uint32_t dwell_time);
61 
62 /**
63  * wlan_scan_cfg_get_active_6g_dwelltime() - API to get active 6g dwelltime
64  * @psoc: pointer to psoc object
65  * @dwell_time: scan active dwelltime
66  *
67  * Return: QDF_STATUS
68  */
69 QDF_STATUS wlan_scan_cfg_get_active_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
70 						 uint32_t *dwell_time);
71 
72 /**
73  * wlan_scan_cfg_set_passive_6g_dwelltime() - API to set scan passive 6g
74  *                                            dwelltime
75  * @psoc: pointer to psoc object
76  * @dwell_time: scan passive dwell time
77  *
78  * Return: QDF_STATUS
79  */
80 QDF_STATUS wlan_scan_cfg_set_passive_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
81 						  uint32_t dwell_time);
82 
83 /**
84  * wlan_scan_cfg_get_passive_6g_dwelltime() - API to get passive 6g dwelltime
85  * @psoc: pointer to psoc object
86  * @dwell_time: scan passive dwelltime
87  *
88  * Return: QDF_STATUS
89  */
90 QDF_STATUS wlan_scan_cfg_get_passive_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
91 						  uint32_t *dwell_time);
92 #endif
93 
94 /**
95  * wlan_scan_cfg_set_active_dwelltime() - API to set scan active dwelltime
96  * @psoc: pointer to psoc object
97  * @dwell_time: scan active dwell time
98  *
99  * Return: none
100  */
101 void wlan_scan_cfg_set_active_dwelltime(struct wlan_objmgr_psoc *psoc,
102 					uint32_t dwell_time);
103 /**
104  * wlan_scan_cfg_get_active_dwelltime() - API to get active dwelltime
105  * @psoc: pointer to psoc object
106  * @dwell_time: scan active dwelltime
107  *
108  * Return: scan active dwell time
109  */
110 void wlan_scan_cfg_get_active_dwelltime(struct wlan_objmgr_psoc *psoc,
111 					uint32_t *dwell_time);
112 
113 /**
114  * wlan_scan_cfg_set_passive_dwelltime() - API to set scan passive dwelltime
115  * @psoc: pointer to psoc object
116  * @dwell_time: scan passive dwell time
117  *
118  * Return: none
119  */
120 void wlan_scan_cfg_set_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
121 					 uint32_t dwell_time);
122 /**
123  * wlan_scan_cfg_get_passive_dwelltime() - API to get passive dwelltime
124  * @psoc: pointer to psoc object
125  * @dwell_time: scan passive dwelltime
126  *
127  * Return: scan passive dwell time
128  */
129 void wlan_scan_cfg_get_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
130 					 uint32_t *dwell_time);
131 
132 /**
133  * wlan_scan_cfg_get_conc_active_dwelltime() - Get concurrent active dwelltime
134  * @psoc: pointer to psoc object
135  * @dwell_time: scan active dwelltime
136  *
137  * Return: scan concurrent active dwell time
138  */
139 void wlan_scan_cfg_get_conc_active_dwelltime(struct wlan_objmgr_psoc *psoc,
140 					     uint32_t *dwell_time);
141 
142 /**
143  * wlan_scan_cfg_set_conc_active_dwelltime() - Set concurrent active dwelltime
144  * @psoc: pointer to psoc object
145  * @dwell_time: scan active dwelltime
146  *
147  * Return: scan concurrent active dwell time
148  */
149 void wlan_scan_cfg_set_conc_active_dwelltime(struct wlan_objmgr_psoc *psoc,
150 					     uint32_t dwell_time);
151 
152 /**
153  * wlan_scan_cfg_get_conc_passive_dwelltime() - Get passive concurrent dwelltime
154  * @psoc: pointer to psoc object
155  * @dwell_time: scan passive dwelltime
156  *
157  * Return: scan concurrent passive dwell time
158  */
159 void wlan_scan_cfg_get_conc_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
160 					      uint32_t *dwell_time);
161 
162 /**
163  * wlan_scan_cfg_set_conc_passive_dwelltime() - Set passive concurrent dwelltime
164  * @psoc: pointer to psoc object
165  * @dwell_time: scan passive dwelltime
166  *
167  * Return: scan concurrent passive dwell time
168  */
169 void wlan_scan_cfg_set_conc_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
170 					      uint32_t dwell_time);
171 
172 /**
173  * wlan_scan_cfg_honour_nl_scan_policy_flags() - API to get nl scan policy
174  * flags honoured
175  * @psoc: pointer to psoc object
176  *
177  * Return: nl scan policy flags honoured or not
178  */
179 bool wlan_scan_cfg_honour_nl_scan_policy_flags(struct wlan_objmgr_psoc *psoc);
180 
181 /**
182  * wlan_scan_cfg_get_conc_max_resttime() - API to get max rest time
183  * @psoc: pointer to psoc object
184  * @rest_time: scan concurrent max resttime
185  *
186  * Return: scan concurrent max rest time
187  */
188 void wlan_scan_cfg_get_conc_max_resttime(struct wlan_objmgr_psoc *psoc,
189 					 uint32_t *rest_time);
190 
191 /**
192  * wlan_scan_cfg_get_dfs_chan_scan_allowed() - API to get dfs scan enabled
193  * @psoc: pointer to psoc object
194  * @enable_dfs_scan: DFS scan enabled or not.
195  *
196  * Return: None
197  */
198 void wlan_scan_cfg_get_dfs_chan_scan_allowed(struct wlan_objmgr_psoc *psoc,
199 					     bool *enable_dfs_scan);
200 
201 /**
202  * wlan_scan_cfg_set_dfs_chan_scan_allowed() - API to set dfs scan enabled.
203  * @psoc: pointer to psoc object
204  * @enable_dfs_scan: Set dfs scan enabled or not.
205  *
206  * Return: None
207  */
208 void wlan_scan_cfg_set_dfs_chan_scan_allowed(struct wlan_objmgr_psoc *psoc,
209 					     bool enable_dfs_scan);
210 
211 /**
212  * wlan_scan_cfg_get_conc_min_resttime() - API to get concurrent min rest time
213  * @psoc: pointer to psoc object
214  * @rest_time: scan concurrent min rest time
215  *
216  * Return: scan concurrent min rest time
217  */
218 void wlan_scan_cfg_get_conc_min_resttime(struct wlan_objmgr_psoc *psoc,
219 					 uint32_t *rest_time);
220 
221 /**
222  * wlan_scan_is_snr_monitor_enabled() - API to get SNR monitoring enabled or not
223  * @psoc: pointer to psoc object
224  *
225  * Return: enable/disable snr monitor mode.
226  */
227 bool wlan_scan_is_snr_monitor_enabled(struct wlan_objmgr_psoc *psoc);
228 
229 /**
230  * wlan_scan_process_bcn_probe_rx_sync() - handle bcn without posting to
231  * scheduler thread
232  * @psoc: psoc context
233  * @buf: frame buf
234  * @params: rx event params
235  * @frm_type: frame type
236  *
237  * handle bcn without posting to scheduler thread, this should be called
238  * while caller is already in scheduler thread context
239  *
240  * Return: success or error code.
241  */
242 QDF_STATUS
243 wlan_scan_process_bcn_probe_rx_sync(struct wlan_objmgr_psoc *psoc,
244 				    qdf_nbuf_t buf,
245 				    struct mgmt_rx_event_params *rx_param,
246 				    enum mgmt_frame_type frm_type);
247 
248 /**
249  * wlan_scan_get_aging_time  - Get the scan aging time config
250  * @psoc: psoc context
251  *
252  * Return: Scan aging time config
253  */
254 qdf_time_t wlan_scan_get_aging_time(struct wlan_objmgr_psoc *psoc);
255 
256 /**
257  * wlan_scan_purge_results() - purge the scan list
258  * @scan_list: scan list to be purged
259  *
260  * This function purge the temp scan list
261  *
262  * Return: QDF_STATUS
263  */
264 static inline QDF_STATUS wlan_scan_purge_results(qdf_list_t *scan_list)
265 {
266 	return scm_purge_scan_results(scan_list);
267 }
268 
269 /**
270  * wlan_scan_get_result() - The Public API to get scan results
271  * @pdev: pdev info
272  * @filter: Filters
273  *
274  * This function fetches scan result
275  *
276  * Return: scan list pointer
277  */
278 static inline qdf_list_t *wlan_scan_get_result(struct wlan_objmgr_pdev *pdev,
279 					       struct scan_filter *filter)
280 {
281 	return scm_get_scan_result(pdev, filter);
282 }
283 
284 /**
285  * wlan_scan_update_mlme_by_bssinfo() - The Public API to update mlme
286  * info in the scan entry
287  * @pdev: pdev object
288  * @bss_info: bssid info to find the matching scan entry
289  * @mlme_info: mlme info to be updated.
290  *
291  * Return: QDF_STATUS
292  */
293 static inline QDF_STATUS
294 wlan_scan_update_mlme_by_bssinfo(struct wlan_objmgr_pdev *pdev,
295 				 struct bss_info *bss_info,
296 				 struct mlme_info *mlme_info)
297 {
298 	return scm_scan_update_mlme_by_bssinfo(pdev, bss_info, mlme_info);
299 }
300 
301 /**
302  * wlan_scan_start() - Public API to start a scan
303  * @req: start scan req params
304  *
305  * The Public API to start a scan. Post a msg to target_if queue
306  *
307  * Return: QDF_STATUS.
308  */
309 QDF_STATUS wlan_scan_start(struct scan_start_request *req);
310 
311 /**
312  * wlan_scan_cancel() - Public API to stop a scan
313  * @req: stop scan request params
314  *
315  * The Public API to stop a scan. Post a msg to target_if queue
316  *
317  * Return: QDF_STATUS.
318  */
319 QDF_STATUS wlan_scan_cancel(struct scan_cancel_request *req);
320 
321 /**
322  * wlan_scan_get_scan_id() - Public API to allocate scan ID
323  * @psoc: psoc object
324  *
325  * Public API, allocates a new scan id for caller
326  *
327  * Return: newly allocated scan ID
328  */
329 wlan_scan_id
330 wlan_scan_get_scan_id(struct wlan_objmgr_psoc *psoc);
331 
332 /**
333  * wlan_scan_init_default_params() - Public API to initialize scan params
334  * @vdev: vdev object
335  * @req: scan request object
336  *
337  * Public API to initialize scan start request with defaults scan params
338  *
339  * Return: QDF_STATUS_SUCCESS or error code
340  */
341 QDF_STATUS
342 wlan_scan_init_default_params(struct wlan_objmgr_vdev *vdev,
343 			      struct scan_start_request *req);
344 
345 /**
346  * wlan_scan_register_requester() - Public API, assigns requester ID
347  * to caller and registers scan event call back handler
348  * @psoc:       psoc object
349  * @module_name:name of requester module
350  * @event_cb:   event callback function pointer
351  * @arg:        argument to @event_cb
352  *
353  * API, allows other components to allocate requester id.
354  * Normally used by modules at init time to register their callback
355  * and get one requester id. @event_cb will be invoked for
356  * all scan events whose requester id matches with @requester.
357  *
358  * Return: assigned non zero requester id for success
359  *         zero (0) for failure
360  */
361 wlan_scan_requester
362 wlan_scan_register_requester(struct wlan_objmgr_psoc *psoc,
363 			     uint8_t *module_name,
364 			     scan_event_handler event_cb,
365 			     void *arg);
366 
367 /**
368  * wlan_scan_unregister_requester() -Public API, reclaims previously
369  * allocated requester ID
370  * @psoc:       psoc object
371  * @requester:  requester ID to reclaim.
372  *
373  * API, reclaims previously allocated requester id.
374  *
375  * Return: void
376  */
377 void
378 wlan_scan_unregister_requester(struct wlan_objmgr_psoc *psoc,
379 			       wlan_scan_requester requester);
380 
381 #endif
382