xref: /wlan-dirver/qca-wifi-host-cmn/umac/scan/dispatcher/inc/wlan_scan_api.h (revision d0c05845839e5f2ba5a8dcebe0cd3e4cd4e8dfcf) !
1 /*
2  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 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 /*
21  * DOC: contains scan api
22  */
23 
24 #ifndef _WLAN_SCAN_API_H_
25 #define _WLAN_SCAN_API_H_
26 
27 #include <wlan_objmgr_psoc_obj.h>
28 #include <wlan_objmgr_pdev_obj.h>
29 #include <wlan_objmgr_vdev_obj.h>
30 #include "../../core/src/wlan_scan_main.h"
31 
32 /**
33  * wlan_scan_cfg_set_active_2g_dwelltime() - API to set scan active 2g dwelltime
34  * @psoc: pointer to psoc object
35  * @dwell_time: scan active dwell time
36  *
37  * Return: none
38  */
39 void wlan_scan_cfg_set_active_2g_dwelltime(struct wlan_objmgr_psoc *psoc,
40 					   uint32_t dwell_time);
41 
42 /**
43  * wlan_scan_cfg_get_active_2g_dwelltime() - API to get active 2g dwelltime
44  * @psoc: pointer to psoc object
45  * @dwell_time: scan active dwelltime
46  *
47  * Return: scan active dwell time
48  */
49 void wlan_scan_cfg_get_active_2g_dwelltime(struct wlan_objmgr_psoc *psoc,
50 					   uint32_t *dwell_time);
51 
52 #ifdef CONFIG_BAND_6GHZ
53 /**
54  * wlan_scan_cfg_set_active_6g_dwelltime() - API to set scan active 6g dwelltime
55  * @psoc: pointer to psoc object
56  * @dwell_time: scan active dwell time
57  *
58  * Return: QDF_STATUS
59  */
60 QDF_STATUS wlan_scan_cfg_set_active_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
61 						 uint32_t dwell_time);
62 
63 /**
64  * wlan_scan_cfg_get_active_6g_dwelltime() - API to get active 6g dwelltime
65  * @psoc: pointer to psoc object
66  * @dwell_time: scan active dwelltime
67  *
68  * Return: QDF_STATUS
69  */
70 QDF_STATUS wlan_scan_cfg_get_active_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
71 						 uint32_t *dwell_time);
72 
73 /**
74  * wlan_scan_cfg_set_passive_6g_dwelltime() - API to set scan passive 6g
75  *                                            dwelltime
76  * @psoc: pointer to psoc object
77  * @dwell_time: scan passive dwell time
78  *
79  * Return: QDF_STATUS
80  */
81 QDF_STATUS wlan_scan_cfg_set_passive_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
82 						  uint32_t dwell_time);
83 
84 /**
85  * wlan_scan_cfg_get_passive_6g_dwelltime() - API to get passive 6g dwelltime
86  * @psoc: pointer to psoc object
87  * @dwell_time: scan passive dwelltime
88  *
89  * Return: QDF_STATUS
90  */
91 QDF_STATUS wlan_scan_cfg_get_passive_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
92 						  uint32_t *dwell_time);
93 
94 /**
95  * wlan_scan_cfg_get_min_dwelltime_6g() - API to get minimum 6g dwelltime
96  * @psoc: pointer to psoc object
97  * @min_dwell_time_6ghz: minimum dwelltime 6g
98  *
99  * Return: QDF_STATUS
100  */
101 void wlan_scan_cfg_get_min_dwelltime_6g(struct wlan_objmgr_psoc *psoc,
102 					uint32_t *min_dwell_time_6ghz);
103 #else
104 static inline
105 void wlan_scan_cfg_get_min_dwelltime_6g(struct wlan_objmgr_psoc *psoc,
106 					uint32_t *min_dwell_time_6ghz)
107 {
108 }
109 #endif
110 
111 /**
112  * wlan_scan_cfg_set_active_dwelltime() - API to set scan active dwelltime
113  * @psoc: pointer to psoc object
114  * @dwell_time: scan active dwell time
115  *
116  * Return: none
117  */
118 void wlan_scan_cfg_set_active_dwelltime(struct wlan_objmgr_psoc *psoc,
119 					uint32_t dwell_time);
120 /**
121  * wlan_scan_cfg_get_active_dwelltime() - API to get active dwelltime
122  * @psoc: pointer to psoc object
123  * @dwell_time: scan active dwelltime
124  *
125  * Return: scan active dwell time
126  */
127 void wlan_scan_cfg_get_active_dwelltime(struct wlan_objmgr_psoc *psoc,
128 					uint32_t *dwell_time);
129 
130 /**
131  * wlan_scan_cfg_set_passive_dwelltime() - API to set scan passive dwelltime
132  * @psoc: pointer to psoc object
133  * @dwell_time: scan passive dwell time
134  *
135  * Return: none
136  */
137 void wlan_scan_cfg_set_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
138 					 uint32_t dwell_time);
139 /**
140  * wlan_scan_cfg_get_passive_dwelltime() - API to get passive dwelltime
141  * @psoc: pointer to psoc object
142  * @dwell_time: scan passive dwelltime
143  *
144  * Return: scan passive dwell time
145  */
146 void wlan_scan_cfg_get_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
147 					 uint32_t *dwell_time);
148 
149 #ifdef WLAN_POLICY_MGR_ENABLE
150 /*
151  * wlan_scan_update_pno_dwell_time() - update active and passive dwell time
152  * depending on active concurrency modes
153  * @vdev: vdev object pointer
154  * @req: scan request
155  *
156  * Return: void
157  */
158 void wlan_scan_update_pno_dwell_time(struct wlan_objmgr_vdev *vdev,
159 				     struct pno_scan_req_params *req,
160 				     struct scan_default_params *scan_def);
161 #endif
162 
163 /**
164  * wlan_scan_cfg_get_conc_active_dwelltime() - Get concurrent active dwelltime
165  * @psoc: pointer to psoc object
166  * @dwell_time: scan active dwelltime
167  *
168  * Return: scan concurrent active dwell time
169  */
170 void wlan_scan_cfg_get_conc_active_dwelltime(struct wlan_objmgr_psoc *psoc,
171 					     uint32_t *dwell_time);
172 
173 /**
174  * wlan_scan_cfg_set_conc_active_dwelltime() - Set concurrent active dwelltime
175  * @psoc: pointer to psoc object
176  * @dwell_time: scan active dwelltime
177  *
178  * Return: scan concurrent active dwell time
179  */
180 void wlan_scan_cfg_set_conc_active_dwelltime(struct wlan_objmgr_psoc *psoc,
181 					     uint32_t dwell_time);
182 
183 /**
184  * wlan_scan_cfg_get_conc_passive_dwelltime() - Get passive concurrent dwelltime
185  * @psoc: pointer to psoc object
186  * @dwell_time: scan passive dwelltime
187  *
188  * Return: scan concurrent passive dwell time
189  */
190 void wlan_scan_cfg_get_conc_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
191 					      uint32_t *dwell_time);
192 
193 /**
194  * wlan_scan_cfg_set_conc_passive_dwelltime() - Set passive concurrent dwelltime
195  * @psoc: pointer to psoc object
196  * @dwell_time: scan passive dwelltime
197  *
198  * Return: scan concurrent passive dwell time
199  */
200 void wlan_scan_cfg_set_conc_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
201 					      uint32_t dwell_time);
202 
203 /**
204  * wlan_scan_cfg_honour_nl_scan_policy_flags() - API to get nl scan policy
205  * flags honoured
206  * @psoc: pointer to psoc object
207  *
208  * Return: nl scan policy flags honoured or not
209  */
210 bool wlan_scan_cfg_honour_nl_scan_policy_flags(struct wlan_objmgr_psoc *psoc);
211 
212 /**
213  * wlan_scan_cfg_get_conc_max_resttime() - API to get max rest time
214  * @psoc: pointer to psoc object
215  * @rest_time: scan concurrent max resttime
216  *
217  * Return: scan concurrent max rest time
218  */
219 void wlan_scan_cfg_get_conc_max_resttime(struct wlan_objmgr_psoc *psoc,
220 					 uint32_t *rest_time);
221 
222 /**
223  * wlan_scan_cfg_get_dfs_chan_scan_allowed() - API to get dfs scan enabled
224  * @psoc: pointer to psoc object
225  * @enable_dfs_scan: DFS scan enabled or not.
226  *
227  * Return: None
228  */
229 void wlan_scan_cfg_get_dfs_chan_scan_allowed(struct wlan_objmgr_psoc *psoc,
230 					     bool *enable_dfs_scan);
231 
232 /**
233  * wlan_scan_cfg_set_dfs_chan_scan_allowed() - API to set dfs scan enabled.
234  * @psoc: pointer to psoc object
235  * @enable_dfs_scan: Set dfs scan enabled or not.
236  *
237  * Return: None
238  */
239 void wlan_scan_cfg_set_dfs_chan_scan_allowed(struct wlan_objmgr_psoc *psoc,
240 					     bool enable_dfs_scan);
241 
242 /**
243  * wlan_scan_cfg_get_conc_min_resttime() - API to get concurrent min rest time
244  * @psoc: pointer to psoc object
245  * @rest_time: scan concurrent min rest time
246  *
247  * Return: scan concurrent min rest time
248  */
249 void wlan_scan_cfg_get_conc_min_resttime(struct wlan_objmgr_psoc *psoc,
250 					 uint32_t *rest_time);
251 
252 /**
253  * wlan_scan_is_snr_monitor_enabled() - API to get SNR monitoring enabled or not
254  * @psoc: pointer to psoc object
255  *
256  * Return: enable/disable snr monitor mode.
257  */
258 bool wlan_scan_is_snr_monitor_enabled(struct wlan_objmgr_psoc *psoc);
259 
260 /**
261  * wlan_scan_process_bcn_probe_rx_sync() - handle bcn without posting to
262  * scheduler thread
263  * @psoc: psoc context
264  * @buf: frame buf
265  * @params: rx event params
266  * @frm_type: frame type
267  *
268  * handle bcn without posting to scheduler thread, this should be called
269  * while caller is already in scheduler thread context
270  *
271  * Return: success or error code.
272  */
273 QDF_STATUS
274 wlan_scan_process_bcn_probe_rx_sync(struct wlan_objmgr_psoc *psoc,
275 				    qdf_nbuf_t buf,
276 				    struct mgmt_rx_event_params *rx_param,
277 				    enum mgmt_frame_type frm_type);
278 
279 /**
280  * wlan_scan_get_aging_time  - Get the scan aging time config
281  * @psoc: psoc context
282  *
283  * Return: Scan aging time config
284  */
285 qdf_time_t wlan_scan_get_aging_time(struct wlan_objmgr_psoc *psoc);
286 
287 /**
288  * wlan_scan_set_aging_time  - Set the scan aging time config
289  * @psoc: psoc context
290  * @time: scan aging time
291  *
292  * Return: success or error code.
293  */
294 QDF_STATUS wlan_scan_set_aging_time(struct wlan_objmgr_psoc *psoc,
295 				    qdf_time_t time);
296 
297 /**
298  * wlan_scan_purge_results() - purge the scan list
299  * @scan_list: scan list to be purged
300  *
301  * This function purge the temp scan list
302  *
303  * Return: QDF_STATUS
304  */
305 static inline QDF_STATUS wlan_scan_purge_results(qdf_list_t *scan_list)
306 {
307 	return scm_purge_scan_results(scan_list);
308 }
309 
310 /**
311  * wlan_scan_get_result() - The Public API to get scan results
312  * @pdev: pdev info
313  * @filter: Filters
314  *
315  * This function fetches scan result
316  *
317  * Return: scan list pointer
318  */
319 static inline qdf_list_t *wlan_scan_get_result(struct wlan_objmgr_pdev *pdev,
320 					       struct scan_filter *filter)
321 {
322 	return scm_get_scan_result(pdev, filter);
323 }
324 
325 /**
326  * wlan_scan_update_mlme_by_bssinfo() - The Public API to update mlme
327  * info in the scan entry
328  * @pdev: pdev object
329  * @bss_info: bssid info to find the matching scan entry
330  * @mlme_info: mlme info to be updated.
331  *
332  * Return: QDF_STATUS
333  */
334 static inline QDF_STATUS
335 wlan_scan_update_mlme_by_bssinfo(struct wlan_objmgr_pdev *pdev,
336 				 struct bss_info *bss_info,
337 				 struct mlme_info *mlme_info)
338 {
339 	return scm_scan_update_mlme_by_bssinfo(pdev, bss_info, mlme_info);
340 }
341 
342 /**
343  * wlan_scan_start() - Public API to start a scan
344  * @req: start scan req params
345  *
346  * The Public API to start a scan. Post a msg to target_if queue
347  *
348  * Return: QDF_STATUS.
349  */
350 QDF_STATUS wlan_scan_start(struct scan_start_request *req);
351 
352 /**
353  * wlan_scan_cancel() - Public API to stop a scan
354  * @req: stop scan request params
355  *
356  * The Public API to stop a scan. Post a msg to target_if queue
357  *
358  * Return: QDF_STATUS.
359  */
360 QDF_STATUS wlan_scan_cancel(struct scan_cancel_request *req);
361 
362 /**
363  * wlan_scan_get_scan_id() - Public API to allocate scan ID
364  * @psoc: psoc object
365  *
366  * Public API, allocates a new scan id for caller
367  *
368  * Return: newly allocated scan ID
369  */
370 wlan_scan_id
371 wlan_scan_get_scan_id(struct wlan_objmgr_psoc *psoc);
372 
373 /**
374  * wlan_scan_init_default_params() - Public API to initialize scan params
375  * @vdev: vdev object
376  * @req: scan request object
377  *
378  * Public API to initialize scan start request with defaults scan params
379  *
380  * Return: QDF_STATUS_SUCCESS or error code
381  */
382 QDF_STATUS
383 wlan_scan_init_default_params(struct wlan_objmgr_vdev *vdev,
384 			      struct scan_start_request *req);
385 
386 /**
387  * wlan_scan_register_requester() - Public API, assigns requester ID
388  * to caller and registers scan event call back handler
389  * @psoc:       psoc object
390  * @module_name:name of requester module
391  * @event_cb:   event callback function pointer
392  * @arg:        argument to @event_cb
393  *
394  * API, allows other components to allocate requester id.
395  * Normally used by modules at init time to register their callback
396  * and get one requester id. @event_cb will be invoked for
397  * all scan events whose requester id matches with @requester.
398  *
399  * Return: assigned non zero requester id for success
400  *         zero (0) for failure
401  */
402 wlan_scan_requester
403 wlan_scan_register_requester(struct wlan_objmgr_psoc *psoc,
404 			     uint8_t *module_name,
405 			     scan_event_handler event_cb,
406 			     void *arg);
407 
408 /**
409  * wlan_scan_unregister_requester() -Public API, reclaims previously
410  * allocated requester ID
411  * @psoc:       psoc object
412  * @requester:  requester ID to reclaim.
413  *
414  * API, reclaims previously allocated requester id.
415  *
416  * Return: void
417  */
418 void
419 wlan_scan_unregister_requester(struct wlan_objmgr_psoc *psoc,
420 			       wlan_scan_requester requester);
421 
422 /**
423  * wlan_scan_cfg_skip_6g_and_indoor_freq() - API to get 6g and indoor freq
424  * scan ini val
425  * @psoc: psoc object
426  *
427  * Return: skip 6g and indoor freq scan or not
428  */
429 bool wlan_scan_cfg_skip_6g_and_indoor_freq(
430 			struct wlan_objmgr_psoc *psoc);
431 #endif
432