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