1 /*
2  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2024 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 north bound interface api
22  */
23 
24 #ifndef _WLAN_SCAN_UCFG_API_H_
25 #define _WLAN_SCAN_UCFG_API_H_
26 
27 #include <scheduler_api.h>
28 #include <wlan_objmgr_psoc_obj.h>
29 #include <wlan_objmgr_pdev_obj.h>
30 #include <wlan_objmgr_vdev_obj.h>
31 #include <wlan_scan_public_structs.h>
32 #include "wlan_scan_api.h"
33 
34 /**
35  * ucfg_scan_register_requester() - Public ucfg API, assigns requester ID
36  * to caller and registers scan event call back handler
37  * @psoc:       psoc object
38  * @module_name:name of requester module
39  * @event_cb:   event callback function pointer
40  * @arg:        argument to @event_cb
41  *
42  * API, allows other components to allocate requester id.
43  * Normally used by modules at init time to register their callback
44  * and get one requester id. @event_cb will be invoked for
45  * all scan events whose requester id matches with @requester.
46  *
47  * Return: assigned non zero requester id for success
48  *         zero (0) for failure
49  */
50 static inline wlan_scan_requester
ucfg_scan_register_requester(struct wlan_objmgr_psoc * psoc,uint8_t * module_name,scan_event_handler event_cb,void * arg)51 ucfg_scan_register_requester(struct wlan_objmgr_psoc *psoc,
52 	uint8_t *module_name, scan_event_handler event_cb, void *arg)
53 {
54 	return wlan_scan_register_requester(psoc, module_name, event_cb, arg);
55 }
56 
57 /**
58  * ucfg_scan_unregister_requester() -Public ucfg API, reclaims previously
59  * allocated requester ID
60  * @psoc:       psoc object
61  * @requester:  requester ID to reclaim.
62  *
63  * API, reclaims previously allocated requester id.
64  *
65  * Return: void
66  */
67 static inline
ucfg_scan_unregister_requester(struct wlan_objmgr_psoc * psoc,wlan_scan_requester requester)68 void ucfg_scan_unregister_requester(struct wlan_objmgr_psoc *psoc,
69 	wlan_scan_requester requester)
70 {
71 	return wlan_scan_unregister_requester(psoc, requester);
72 }
73 
74 /**
75  * ucfg_get_scan_requester_name()- returns module name of requester ID owner
76  * @psoc:       psoc object
77  * @requester:  requester ID
78  *
79  * API, returns module name of requester id owner
80  *
81  * Return: pointer to module name or "unknown" if requester id not found.
82  */
83 uint8_t *ucfg_get_scan_requester_name(struct wlan_objmgr_psoc *psoc,
84 	wlan_scan_requester requester);
85 
86 /**
87  * ucfg_scan_get_scan_id() - Public ucfg API to allocate scan ID
88  * @psoc: psoc object
89  *
90  * Public ucfg API, allocates a new scan id for caller
91  *
92  * Return: newly allocated scan ID
93  */
94 static inline
ucfg_scan_get_scan_id(struct wlan_objmgr_psoc * psoc)95 wlan_scan_id ucfg_scan_get_scan_id(struct wlan_objmgr_psoc *psoc)
96 {
97 	return wlan_scan_get_scan_id(psoc);
98 }
99 
100 /**
101  * ucfg_scan_get_entry_frame_len() - API to get scan entry frame length
102  * @scan_entry: Scan entry
103  *
104  * Return: scan entry frame length
105  */
106 uint32_t ucfg_scan_get_entry_frame_len(struct scan_cache_entry *scan_entry);
107 
108 #ifdef FEATURE_WLAN_SCAN_PNO
109 /**
110  * ucfg_scan_pno_start() - Public API to start PNO
111  * @vdev: vdev pointer
112  * @req: pno req params
113  *
114  * Return: 0 for success or error code.
115  */
116 QDF_STATUS ucfg_scan_pno_start(struct wlan_objmgr_vdev *vdev,
117 			       struct pno_scan_req_params *req);
118 
119 /**
120  * ucfg_scan_add_flags_to_pno_chan_list() - This API to update flags for all 6g
121  * channels in pno scan request
122  * @vdev: vdev pointer
123  * @req: pno req params
124  * @num_chan: number of channels
125  * @short_ssid: short ssid
126  * @list_idx: index of network_list in pno request
127  *
128  * Return: None
129  */
130 void ucfg_scan_add_flags_to_pno_chan_list(struct wlan_objmgr_vdev *vdev,
131 					  struct pno_scan_req_params *req,
132 					  uint8_t *num_chan,
133 					  uint32_t short_ssid,
134 					  int list_idx);
135 
136 /**
137  * ucfg_is_6ghz_pno_scan_optimization_supported() - Public API to check
138  * 6 GHz pno scan optimization supported in fw
139  * @psoc: psoc object
140  *
141  * Return: 0 for success.
142  */
143 bool
144 ucfg_is_6ghz_pno_scan_optimization_supported(struct wlan_objmgr_psoc *psoc);
145 
146 /**
147  * ucfg_scan_pno_stop() - Public API to stop PNO
148  * @vdev: vdev pointer
149  *
150  * Return: 0 for success or error code.
151  */
152 QDF_STATUS ucfg_scan_pno_stop(struct wlan_objmgr_vdev *vdev);
153 
154 /**
155  * ucfg_scan_get_pno_in_progress() - Public API to check if pno is in progress
156  * @vdev: vdev pointer
157  *
158  * Return: true if pno in progress else false.
159  */
160 bool ucfg_scan_get_pno_in_progress(struct wlan_objmgr_vdev *vdev);
161 
162 /**
163  * ucfg_scan_get_pno_match() - Public API to check if pno matched
164  * @vdev: vdev pointer
165  *
166  * Return: true if pno matched else false.
167  */
168 bool ucfg_scan_get_pno_match(struct wlan_objmgr_vdev *vdev);
169 
170 /**
171  * ucfg_scan_register_pno_cb() - register pno cb
172  * @psoc: psoc object
173  * @event_cb: callback function pointer
174  * @arg: argument to @event_cb
175  *
176  * Return: QDF_STATUS
177  */
178 QDF_STATUS
179 ucfg_scan_register_pno_cb(struct wlan_objmgr_psoc *psoc,
180 	scan_event_handler event_cb, void *arg);
181 
182 /**
183  * ucfg_scan_get_pno_def_params() - get the defaults pno params
184  * @vdev: vdev object
185  * @req: pno request object
186  *
187  * Return: QDF_STATUS_SUCCESS or error code
188  */
189 QDF_STATUS
190 ucfg_scan_get_pno_def_params(struct wlan_objmgr_vdev *vdev,
191 	struct pno_scan_req_params *req);
192 
193 #else
194 
195 static inline bool
ucfg_scan_get_pno_in_progress(struct wlan_objmgr_vdev * vdev)196 ucfg_scan_get_pno_in_progress(struct wlan_objmgr_vdev *vdev)
197 {
198 	return false;
199 }
200 
201 static inline bool
ucfg_scan_get_pno_match(struct wlan_objmgr_vdev * vdev)202 ucfg_scan_get_pno_match(struct wlan_objmgr_vdev *vdev)
203 {
204 	return false;
205 }
206 #endif /* FEATURE_WLAN_SCAN_PNO */
207 /**
208  * ucfg_scm_scan_free_scan_request_mem() - Free scan request memory
209  * @req: scan_start_request object
210  *
211  * Return: QDF_STATUS
212  */
213 QDF_STATUS ucfg_scm_scan_free_scan_request_mem(struct scan_start_request *req);
214 
215 /**
216  * ucfg_scan_start() - ucfg Public API to start a scan
217  * @req: start scan req params
218  *
219  * The ucfg public API to start a scan. Post a msg to target_if queue
220  *
221  * Return: QDF_STATUS
222  */
ucfg_scan_start(struct scan_start_request * req)223 static inline QDF_STATUS ucfg_scan_start(struct scan_start_request *req)
224 {
225 	return wlan_scan_start(req);
226 }
227 
228 /**
229  * ucfg_scan_psoc_set_enable() - Public API to enable scans for psoc
230  * @psoc: psoc on which scans need to be disabled
231  * @reason: reason for enable/disabled
232  *
233  * Return: QDF_STATUS.
234  */
235 QDF_STATUS ucfg_scan_psoc_set_enable(struct wlan_objmgr_psoc *psoc,
236 				     enum scan_disable_reason reason);
237 
238 /**
239  * ucfg_scan_psoc_set_disable() - Public API to disable scans for psoc
240  * @psoc: psoc on which scans need to be disabled
241  * @reason: reason for enable/disabled
242  *
243  * Return: QDF_STATUS.
244  */
245 QDF_STATUS ucfg_scan_psoc_set_disable(struct wlan_objmgr_psoc *psoc,
246 				      enum scan_disable_reason reason);
247 
248 /**
249  * ucfg_scan_vdev_set_enable() - Public API to enable scans for vdev
250  * @vdev: vdev on which scans need to be disabled
251  * @reason: reason for enable/disabled
252  *
253  * Return: QDF_STATUS.
254  */
255 QDF_STATUS ucfg_scan_vdev_set_enable(struct wlan_objmgr_vdev *vdev,
256 				     enum scan_disable_reason reason);
257 
258 /**
259  * ucfg_scan_vdev_set_disable() - Public API to disable scans for vdev
260  * @vdev: vdev on which scans need to be disabled
261  * @reason: reason for enable/disabled
262  *
263  * Return: QDF_STATUS.
264  */
265 QDF_STATUS ucfg_scan_vdev_set_disable(struct wlan_objmgr_vdev *vdev,
266 				      enum scan_disable_reason reason);
267 
268 /**
269  * ucfg_scan_set_miracast() - Public API to disable/enable miracast flag
270  * @psoc: psoc pointer
271  * @enable: enable miracast if true disable is false
272  *
273  * Return: QDF_STATUS.
274  */
275 QDF_STATUS ucfg_scan_set_miracast(
276 		struct wlan_objmgr_psoc *psoc, bool enable);
277 
278 /**
279  * ucfg_scan_set_global_config() - Public API to set global scan config
280  * @psoc: psoc context
281  * @config: config to set
282  * @val: new config value
283  *
284  * Return: QDF_STATUS.
285  */
286 QDF_STATUS
287 ucfg_scan_set_global_config(struct wlan_objmgr_psoc *psoc,
288 		enum scan_config config, uint32_t val);
289 
290 /**
291  * ucfg_scan_get_global_config() - Public API to get global scan config
292  * @psoc: psoc context
293  * @config: config to set
294  * @val: uint32* to hold returned config value
295  *
296  * Return: QDF_STATUS.
297  */
298 QDF_STATUS
299 ucfg_scan_get_global_config(struct wlan_objmgr_psoc *psoc,
300 		enum scan_config config, uint32_t *val);
301 
302 /**
303  * ucfg_scan_set_obss_scan_offload() - Public API to set obss scan flag
304  * @psoc: psoc context
305  * @value: the value to be set
306  *
307  * Return: void.
308  */
309 void ucfg_scan_set_obss_scan_offload(struct wlan_objmgr_psoc *psoc, bool value);
310 
311 /**
312  * ucfg_scan_set_wide_band_scan() - Public API to disable/enable wide band scan
313  * @pdev: psoc on which scans need to be disabled
314  * @enable: enable wide band scan if @enable is true, disable otherwise
315  *
316  * Return: QDF_STATUS.
317  */
318 QDF_STATUS ucfg_scan_set_wide_band_scan(
319 		struct wlan_objmgr_pdev *pdev, bool enable);
320 
321 /**
322  * ucfg_scan_get_wide_band_scan() - Public API to check if
323  * wide band scan is enabled or disabled
324  * @pdev: psoc on which scans status need to be checked
325  *
326  * Return: true if enabled else false.
327  */
328 bool ucfg_scan_get_wide_band_scan(struct wlan_objmgr_pdev *pdev);
329 
330 /**
331  * ucfg_scan_set_custom_scan_chan_list() - Public API to restrict scan
332  * to few pre configured channels
333  * @pdev: psoc on which scans need to be disabled
334  * @chan_list: list of channels to scan if set
335  *
336  * Return: QDF_STATUS.
337  */
338 QDF_STATUS ucfg_scan_set_custom_scan_chan_list(
339 		struct wlan_objmgr_pdev *pdev, struct chan_list *chan_list);
340 
341 /**
342  * ucfg_scan_config_hidden_ssid_for_bssid() - API to configure
343  * ssid, bssid of hidden beacon
344  * @pdev: psoc on which ssid bssid need to configure
345  * @bssid: bssid of the hidden AP
346  * @ssid: desired ssid
347  *
348  * Return: QDF_STATUS.
349  */
350 #ifdef WLAN_DFS_CHAN_HIDDEN_SSID
351 QDF_STATUS
352 ucfg_scan_config_hidden_ssid_for_bssid(struct wlan_objmgr_pdev *pdev,
353 				       uint8_t *bssid,
354 				       struct wlan_ssid *ssid);
355 #else
356 static inline QDF_STATUS
ucfg_scan_config_hidden_ssid_for_bssid(struct wlan_objmgr_pdev * pdev,uint8_t * bssid,struct wlan_ssid * ssid)357 ucfg_scan_config_hidden_ssid_for_bssid(struct wlan_objmgr_pdev *pdev,
358 				       uint8_t *bssid,
359 				       struct wlan_ssid *ssid)
360 {
361 	return QDF_STATUS_SUCCESS;
362 }
363 #endif /* WLAN_DFS_CHAN_HIDDEN_SSID */
364 
365 /**
366  * ucfg_scan_cancel() - ucfg Public API to cancel the scan
367  * @req: stop scan request params
368  *
369  * The ucfg public API to stop a scan. Post a msg to target_if queue
370  *
371  * Return: QDF_STATUS.
372  */
ucfg_scan_cancel(struct scan_cancel_request * req)373 static inline QDF_STATUS ucfg_scan_cancel(struct scan_cancel_request *req)
374 {
375 	return wlan_scan_cancel(req);
376 }
377 
378 /**
379  * ucfg_scan_cancel_sync() - Public API to stop a scan and wait
380  * till all scan are completed
381  * @req: stop scan request params
382  *
383  * The Public API to stop a scan and wait
384  * till all scan are completed
385  *
386  * Return: 0 for success or error code.
387  */
388 QDF_STATUS
389 ucfg_scan_cancel_sync(struct scan_cancel_request *req);
390 
391 /**
392  * ucfg_scan_get_result() - The Public API to get scan results
393  * @pdev: pdev info
394  * @filter: Filters
395  *
396  * This function fetches scan result
397  *
398  * Return: scan list pointer
399  */
400 qdf_list_t *ucfg_scan_get_result(struct wlan_objmgr_pdev *pdev,
401 	struct scan_filter *filter);
402 
403 /**
404  * ucfg_scan_purge_results() - purge the scan list
405  * @scan_list: scan list to be purged
406  *
407  * This function purge the temp scan list
408  *
409  * Return: QDF_STATUS
410  */
411 QDF_STATUS ucfg_scan_purge_results(qdf_list_t *scan_list);
412 
413 /**
414  * ucfg_scan_flush_results() - The Public API to flush scan result
415  * @pdev: pdev object
416  * @filter: filter to flush the scan entries
417  *
418  * The Public API to flush scan result.
419  *
420  * Return: 0 for success or error code.
421  */
422 QDF_STATUS ucfg_scan_flush_results(struct wlan_objmgr_pdev *pdev,
423 	struct scan_filter *filter);
424 
425 /**
426  * ucfg_scan_filter_valid_channel() - The Public API to filter scan result
427  * based on valid channel list
428  * @pdev: pdev object
429  * @chan_freq_list: valid channel frequency (in MHz) list
430  * @num_chan: number of valid channels
431  *
432  * The Public API to to filter scan result
433  * based on valid channel list.
434  *
435  * Return: void.
436  */
437 void ucfg_scan_filter_valid_channel(struct wlan_objmgr_pdev *pdev,
438 	uint32_t *chan_freq_list, uint32_t num_chan);
439 
440 /**
441  * ucfg_scan_db_iterate() - function to iterate scan table
442  * @pdev: pdev object
443  * @func: iterator function pointer
444  * @arg: argument to be passed to func()
445  *
446  * API, this API iterates scan table and invokes func
447  * on each scan enetry by passing scan entry and arg.
448  *
449  * Return: QDF_STATUS
450  */
451 QDF_STATUS
452 ucfg_scan_db_iterate(struct wlan_objmgr_pdev *pdev,
453 	scan_iterator_func func, void *arg);
454 
455 /**
456  * ucfg_scan_register_event_handler() - The Public API to register
457  * an event cb handler
458  * @pdev: pdev object
459  * @event_cb: callback function to register
460  * @arg: component specific priv argument to @event_cb callback function
461  *
462  * The Public API to register a event cb handler. This cb is called whenever
463  * any scan event is received on @pdev.
464  *
465  * Return: 0 for success or error code.
466  */
467 
468 QDF_STATUS
469 ucfg_scan_register_event_handler(struct wlan_objmgr_pdev *pdev,
470 	scan_event_handler event_cb, void *arg);
471 
472 /**
473  * ucfg_scan_unregister_event_handler() - Public API to unregister
474  * event cb handler
475  * @pdev: pdev object
476  * @event_cb: callback function to unregister
477  * @arg: component specific priv argument to @event_cb callback function
478  *
479  * Unregister a event cb handler. cb and arg will be used to
480  * find the callback.
481  *
482  * Return: void
483  */
484 
485 void
486 ucfg_scan_unregister_event_handler(struct wlan_objmgr_pdev *pdev,
487 	scan_event_handler event_cb, void *arg);
488 
489 /**
490  * ucfg_scan_init_default_params() - Public ucfg API to initialize scan params
491  * @vdev: vdev object
492  * @req: scan request object
493  *
494  * Public ucfg API to initialize scan start request with defaults scan params
495  *
496  * Return: QDF_STATUS_SUCCESS or error code
497  */
498 static inline QDF_STATUS
ucfg_scan_init_default_params(struct wlan_objmgr_vdev * vdev,struct scan_start_request * req)499 ucfg_scan_init_default_params(struct wlan_objmgr_vdev *vdev,
500 	struct scan_start_request *req)
501 {
502 	return wlan_scan_init_default_params(vdev, req);
503 }
504 
505 /**
506  * ucfg_scan_init_ssid_params() - initialize scan request ssid list
507  *
508  * @scan_req: scan request object
509  * @num_ssid: number of ssid's in ssid list
510  * @ssid_list: ssid list
511  *
512  * Return: QDF_STATUS_SUCCESS for success or error code
513  */
514 QDF_STATUS
515 ucfg_scan_init_ssid_params(struct scan_start_request *scan_req,
516 	uint32_t num_ssid, struct wlan_ssid *ssid_list);
517 
518 /**
519  * ucfg_scan_init_bssid_params() - initialize scan request bssid list
520  * @scan_req: scan request object
521  * @num_ssid: number of bssid's in bssid list
522  * @bssid_list: bssid list
523  *
524  * Return: QDF_STATUS_SUCCESS for success or error code
525  */
526 QDF_STATUS
527 ucfg_scan_init_bssid_params(struct scan_start_request *scan_req,
528 	uint32_t num_ssid, struct qdf_mac_addr *bssid_list);
529 
530 /**
531  * ucfg_scan_init_chanlist_params() - initialize scan request channel list
532  * @scan_req: scan request object
533  * @num_chans: number of channels in channel list
534  * @chan_list: channel list
535  * @phymode: phymode in which scan shall be done
536  *
537  * Return: QDF_STATUS_SUCCESS for success or error code
538  */
539 QDF_STATUS
540 ucfg_scan_init_chanlist_params(struct scan_start_request *scan_req,
541 	uint32_t num_chans, uint32_t *chan_list, uint32_t *phymode);
542 
543 /**
544  * ucfg_scan_get_vdev_status() - API to check vdev scan status
545  * @vdev: vdev object
546  *
547  * Return: enum scm_scan_status
548  */
549 enum scm_scan_status
550 ucfg_scan_get_vdev_status(struct wlan_objmgr_vdev *vdev);
551 
552 /**
553  * ucfg_scan_get_pdev_status() - API to check pdev scan status
554  * @pdev: pdev object
555  *
556  * Return: enum scm_scan_status
557  */
558 enum scm_scan_status
559 ucfg_scan_get_pdev_status(struct wlan_objmgr_pdev *pdev);
560 
561 /**
562  * ucfg_scan_register_bcn_cb() - API to register api
563  * to inform/update bcn/probe as soon as they are received
564  * @psoc: psoc
565  * @cb: callback to be registered
566  * @type: Type of callback to be registered
567  *
568  * Return: enum scm_scan_status
569  */
570 QDF_STATUS ucfg_scan_register_bcn_cb(struct wlan_objmgr_psoc *psoc,
571 	update_beacon_cb cb, enum scan_cb_type type);
572 
573 /**
574  * ucfg_scan_update_user_config() - Update scan cache user config
575  * @psoc: psoc
576  * @scan_cfg: scan user config
577  *
578  * Return: QDF_STATUS
579  */
580 QDF_STATUS ucfg_scan_update_user_config(struct wlan_objmgr_psoc *psoc,
581 	struct scan_user_cfg *scan_cfg);
582 
583 /**
584  * ucfg_scan_init() - Scan module initialization API
585  *
586  * Return: QDF_STATUS
587  */
588 QDF_STATUS ucfg_scan_init(void);
589 
590 /**
591  * ucfg_scan_deinit() - Scan module deinitialization API
592  *
593  * Return: QDF_STATUS
594  */
595 QDF_STATUS ucfg_scan_deinit(void);
596 
597 /**
598  * ucfg_scan_psoc_enable() - Scan module enable API
599  * @psoc: psoc object
600  *
601  * Return: QDF_STATUS
602  */
603 QDF_STATUS ucfg_scan_psoc_enable(struct wlan_objmgr_psoc *psoc);
604 
605 /**
606  * ucfg_scan_psoc_disable() - Scan module disable API
607  * @psoc: psoc object
608  *
609  * Return: QDF_STATUS
610  */
611 QDF_STATUS ucfg_scan_psoc_disable(struct wlan_objmgr_psoc *psoc);
612 
613 /**
614  * ucfg_scan_psoc_open() - Scan module psoc open API
615  * @psoc: psoc object
616  *
617  * Return: QDF_STATUS
618  */
619 QDF_STATUS ucfg_scan_psoc_open(struct wlan_objmgr_psoc *psoc);
620 
621 /**
622  * ucfg_scan_psoc_close() - Scan module psoc close API
623  * @psoc: psoc object
624  *
625  * Return: QDF_STATUS
626  */
627 QDF_STATUS ucfg_scan_psoc_close(struct wlan_objmgr_psoc *psoc);
628 
629 /**
630  * ucfg_scan_get_max_active_scans() - API to get max active scans
631  * supported on this psoc
632  * @psoc: psoc object
633  *
634  * Return: uint32_t
635  */
636 uint32_t ucfg_scan_get_max_active_scans(struct wlan_objmgr_psoc *psoc);
637 
638 /**
639  * ucfg_ie_allowlist_enabled() - Checks for IE allowlisting enable
640  * @psoc: pointer to psoc object
641  * @vdev: pointer to vdev
642  *
643  * This function is used to check whether IE allowlisting is enabled or not
644  *
645  * Return: If enabled returns true else returns false
646  */
647 bool ucfg_ie_allowlist_enabled(struct wlan_objmgr_psoc *psoc,
648 			       struct wlan_objmgr_vdev *vdev);
649 
650 /**
651  * ucfg_copy_ie_allowlist_attrs() - Populate probe req IE allowlist attrs
652  * @psoc: pointer to psoc object
653  * @ie_allowlist: output parameter to hold ie allowlist attrs
654  *
655  * If IE allowlisting is enabled then invoke this function to copy
656  * IE allowlisting attrs from wlan scan object
657  *
658  * Return: true - successful copy
659  *         false - copy failed
660  */
661 bool
662 ucfg_copy_ie_allowlist_attrs(struct wlan_objmgr_psoc *psoc,
663 			     struct probe_req_allowlist_attr *ie_allowlist);
664 
665 /**
666  * ucfg_scan_set_bt_activity() - API to set bt activity
667  * @psoc: pointer to psoc object
668  * @bt_a2dp_active: bt activiy value
669  *
670  * Return: None
671  */
672 void ucfg_scan_set_bt_activity(struct wlan_objmgr_psoc *psoc,
673 			       bool bt_a2dp_active);
674 /**
675  * ucfg_scan_get_bt_activity() - API to get bt activity
676  * @psoc: pointer to psoc object
677  *
678  * Return: true if enabled else false.
679  */
680 bool ucfg_scan_get_bt_activity(struct wlan_objmgr_psoc *psoc);
681 
682 /**
683  * ucfg_scan_is_mac_spoofing_enabled() - API to check if mac spoofing is enabled
684  * @psoc: pointer to psoc object
685  *
686  * Return: true if enabled else false.
687  */
688 bool ucfg_scan_is_mac_spoofing_enabled(struct wlan_objmgr_psoc *psoc);
689 
690 /**
691  * ucfg_scan_get_extscan_adaptive_dwell_mode() - API to get the adaptive dwell
692  * mode during ext scan
693  * @psoc: pointer to psoc object
694  *
695  * Return: value of type enum scan_dwelltime_adaptive_mode
696  */
697 enum scan_dwelltime_adaptive_mode
698 ucfg_scan_get_extscan_adaptive_dwell_mode(struct wlan_objmgr_psoc *psoc);
699 
700 /**
701  * ucfg_scan_cfg_set_active_dwelltime() - API to set scan active dwelltime
702  * @psoc: pointer to psoc object
703  * @dwell_time: scan active dwell time
704  *
705  * Return: none
706  */
707 static inline
ucfg_scan_cfg_set_active_dwelltime(struct wlan_objmgr_psoc * psoc,uint32_t dwell_time)708 void ucfg_scan_cfg_set_active_dwelltime(struct wlan_objmgr_psoc *psoc,
709 					uint32_t dwell_time)
710 {
711 	return wlan_scan_cfg_set_active_dwelltime(psoc, dwell_time);
712 }
713 
714 /**
715  * ucfg_scan_cfg_set_active_2g_dwelltime() - API to set scan active 2g dwelltime
716  * @psoc: pointer to psoc object
717  * @dwell_time: scan active dwell time
718  *
719  * Return: none
720  */
721 static inline
ucfg_scan_cfg_set_active_2g_dwelltime(struct wlan_objmgr_psoc * psoc,uint32_t dwell_time)722 void ucfg_scan_cfg_set_active_2g_dwelltime(struct wlan_objmgr_psoc *psoc,
723 					   uint32_t dwell_time)
724 {
725 	return wlan_scan_cfg_set_active_2g_dwelltime(psoc, dwell_time);
726 }
727 
728 /**
729  * ucfg_scan_cfg_get_active_dwelltime() - API to get active dwelltime
730  * @psoc: pointer to psoc object
731  * @dwell_time: scan active dwelltime
732  *
733  * Return: scan active dwell time
734  */
735 static inline
ucfg_scan_cfg_get_active_dwelltime(struct wlan_objmgr_psoc * psoc,uint32_t * dwell_time)736 void ucfg_scan_cfg_get_active_dwelltime(struct wlan_objmgr_psoc *psoc,
737 					uint32_t *dwell_time)
738 {
739 	return wlan_scan_cfg_get_active_dwelltime(psoc, dwell_time);
740 }
741 
742 /**
743  * ucfg_scan_cfg_set_passive_dwelltime() - API to set scan passive dwelltime
744  * @psoc: pointer to psoc object
745  * @dwell_time: scan passive dwell time
746  *
747  * Return: none
748  */
749 static inline
ucfg_scan_cfg_set_passive_dwelltime(struct wlan_objmgr_psoc * psoc,uint32_t dwell_time)750 void ucfg_scan_cfg_set_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
751 					 uint32_t dwell_time)
752 {
753 	return wlan_scan_cfg_set_passive_dwelltime(psoc, dwell_time);
754 }
755 /**
756  * ucfg_scan_cfg_get_passive_dwelltime() - API to get passive dwelltime
757  * @psoc: pointer to psoc object
758  * @dwell_time: scan passive dwelltime
759  *
760  * Return: scan passive dwell time
761  */
762 static inline
ucfg_scan_cfg_get_passive_dwelltime(struct wlan_objmgr_psoc * psoc,uint32_t * dwell_time)763 void ucfg_scan_cfg_get_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
764 					 uint32_t *dwell_time)
765 {
766 	return wlan_scan_cfg_get_passive_dwelltime(psoc, dwell_time);
767 }
768 
769 /**
770  * ucfg_scan_cfg_get_active_2g_dwelltime() - API to get active 2g dwelltime
771  * @psoc: pointer to psoc object
772  * @dwell_time: scan active 2g dwelltime
773  *
774  * Return: scan active 2g dwelltime
775  */
776 static inline
ucfg_scan_cfg_get_active_2g_dwelltime(struct wlan_objmgr_psoc * psoc,uint32_t * dwell_time)777 void ucfg_scan_cfg_get_active_2g_dwelltime(struct wlan_objmgr_psoc *psoc,
778 					   uint32_t *dwell_time)
779 {
780 	return wlan_scan_cfg_get_active_2g_dwelltime(psoc, dwell_time);
781 }
782 
783 #ifdef CONFIG_BAND_6GHZ
784 /**
785  * ucfg_scan_cfg_set_active_6g_dwelltime() - API to set scan active 6g dwelltime
786  * @psoc: pointer to psoc object
787  * @dwell_time: scan active dwell time
788  *
789  * Return: QDF_STATUS
790  */
791 static inline
ucfg_scan_cfg_set_active_6g_dwelltime(struct wlan_objmgr_psoc * psoc,uint32_t dwell_time)792 QDF_STATUS ucfg_scan_cfg_set_active_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
793 						 uint32_t dwell_time)
794 {
795 	return wlan_scan_cfg_set_active_6g_dwelltime(psoc, dwell_time);
796 }
797 
798 /**
799  * ucfg_scan_cfg_get_passive_6g_dwelltime() - API to get passive 6g dwelltime
800  * @psoc: pointer to psoc object
801  * @dwell_time: scan passive 6g dwelltime
802  *
803  * Return: QDF_STATUS
804  */
805 static inline
ucfg_scan_cfg_get_passive_6g_dwelltime(struct wlan_objmgr_psoc * psoc,uint32_t * dwell_time)806 QDF_STATUS ucfg_scan_cfg_get_passive_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
807 						  uint32_t *dwell_time)
808 {
809 	return wlan_scan_cfg_get_passive_6g_dwelltime(psoc, dwell_time);
810 }
811 
812 /**
813  * ucfg_scan_cfg_set_passive_6g_dwelltime() - API to set scan passive 6g
814  *                                            dwelltime
815  * @psoc: pointer to psoc object
816  * @dwell_time: scan passive dwell time
817  *
818  * Return: QDF_STATUS
819  */
820 static inline
ucfg_scan_cfg_set_passive_6g_dwelltime(struct wlan_objmgr_psoc * psoc,uint32_t dwell_time)821 QDF_STATUS ucfg_scan_cfg_set_passive_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
822 						  uint32_t dwell_time)
823 {
824 	return wlan_scan_cfg_set_passive_6g_dwelltime(psoc, dwell_time);
825 }
826 
827 /**
828  * ucfg_scan_cfg_get_active_6g_dwelltime() - API to get active 6g dwelltime
829  * @psoc: pointer to psoc object
830  * @dwell_time: scan active 6g dwelltime
831  *
832  * Return: QDF_STATUS
833  */
834 static inline
ucfg_scan_cfg_get_active_6g_dwelltime(struct wlan_objmgr_psoc * psoc,uint32_t * dwell_time)835 QDF_STATUS ucfg_scan_cfg_get_active_6g_dwelltime(struct wlan_objmgr_psoc *psoc,
836 						 uint32_t *dwell_time)
837 {
838 	return wlan_scan_cfg_get_active_6g_dwelltime(psoc, dwell_time);
839 }
840 #endif
841 
842 /**
843  * ucfg_scan_cfg_get_conc_active_dwelltime() - Get concurrent active dwelltime
844  * @psoc: pointer to psoc object
845  * @dwell_time: scan active dwelltime
846  *
847  * Return: scan concurrent active dwell time
848  */
849 static inline
ucfg_scan_cfg_get_conc_active_dwelltime(struct wlan_objmgr_psoc * psoc,uint32_t * dwell_time)850 void ucfg_scan_cfg_get_conc_active_dwelltime(struct wlan_objmgr_psoc *psoc,
851 					     uint32_t *dwell_time)
852 {
853 	return wlan_scan_cfg_get_conc_active_dwelltime(psoc, dwell_time);
854 }
855 
856 /**
857  * ucfg_scan_cfg_set_conc_active_dwelltime() - Set concurrent active dwelltime
858  * @psoc: pointer to psoc object
859  * @dwell_time: scan active dwelltime
860  *
861  * Return: scan concurrent active dwell time
862  */
863 static inline
ucfg_scan_cfg_set_conc_active_dwelltime(struct wlan_objmgr_psoc * psoc,uint32_t dwell_time)864 void ucfg_scan_cfg_set_conc_active_dwelltime(struct wlan_objmgr_psoc *psoc,
865 					     uint32_t dwell_time)
866 {
867 	return wlan_scan_cfg_set_conc_active_dwelltime(psoc, dwell_time);
868 }
869 
870 /**
871  * ucfg_scan_cfg_get_conc_passive_dwelltime() - Get passive concurrent dwelltime
872  * @psoc: pointer to psoc object
873  * @dwell_time: scan passive dwelltime
874  *
875  * Return: scan concurrent passive dwell time
876  */
877 static inline
ucfg_scan_cfg_get_conc_passive_dwelltime(struct wlan_objmgr_psoc * psoc,uint32_t * dwell_time)878 void ucfg_scan_cfg_get_conc_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
879 					      uint32_t *dwell_time)
880 {
881 	return wlan_scan_cfg_get_conc_passive_dwelltime(psoc, dwell_time);
882 }
883 
884 /**
885  * ucfg_scan_cfg_set_conc_passive_dwelltime() - Set passive concurrent dwelltime
886  * @psoc: pointer to psoc object
887  * @dwell_time: scan passive dwelltime
888  *
889  * Return: scan concurrent passive dwell time
890  */
891 static inline
ucfg_scan_cfg_set_conc_passive_dwelltime(struct wlan_objmgr_psoc * psoc,uint32_t dwell_time)892 void ucfg_scan_cfg_set_conc_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
893 					      uint32_t dwell_time)
894 {
895 	return wlan_scan_cfg_set_conc_passive_dwelltime(psoc, dwell_time);
896 }
897 
898 /**
899  * ucfg_scan_cfg_get_dfs_chan_scan_allowed() - API to get dfs scan enabled
900  * @psoc: pointer to psoc object
901  * @dfs_scan_enable: Set DFS scan enabled or not.
902  *
903  * Return: None
904  */
905 static inline
ucfg_scan_cfg_get_dfs_chan_scan_allowed(struct wlan_objmgr_psoc * psoc,bool * dfs_scan_enable)906 void ucfg_scan_cfg_get_dfs_chan_scan_allowed(struct wlan_objmgr_psoc *psoc,
907 					     bool *dfs_scan_enable)
908 {
909 	return wlan_scan_cfg_get_dfs_chan_scan_allowed(psoc, dfs_scan_enable);
910 }
911 
912 /**
913  * ucfg_scan_cfg_set_dfs_chan_scan_allowed() - API to set dfs scan enabled
914  * @psoc: pointer to psoc object
915  * @dfs_scan_enable: Set DFS scan enabled or not.
916  *
917  * Return: None
918  */
919 static inline
ucfg_scan_cfg_set_dfs_chan_scan_allowed(struct wlan_objmgr_psoc * psoc,bool dfs_scan_enable)920 void ucfg_scan_cfg_set_dfs_chan_scan_allowed(struct wlan_objmgr_psoc *psoc,
921 					     bool dfs_scan_enable)
922 {
923 	return wlan_scan_cfg_set_dfs_chan_scan_allowed(psoc, dfs_scan_enable);
924 }
925 
926 /**
927  * ucfg_scan_wake_lock_in_user_scan() - API to determine if wake lock in user
928  * scan is used.
929  * @psoc: pointer to psoc object
930  *
931  * Return: true if wake lock in user scan is required
932  */
933 bool ucfg_scan_wake_lock_in_user_scan(struct wlan_objmgr_psoc *psoc);
934 
935 /**
936  * ucfg_scan_cfg_honour_nl_scan_policy_flags() - API to get nl scan policy
937  * flags honoured.
938  * @psoc: pointer to psoc object
939  *
940  * Return: nl scan flags is honoured or not
941  */
942 static inline
ucfg_scan_cfg_honour_nl_scan_policy_flags(struct wlan_objmgr_psoc * psoc)943 bool ucfg_scan_cfg_honour_nl_scan_policy_flags(struct wlan_objmgr_psoc *psoc)
944 {
945 	return wlan_scan_cfg_honour_nl_scan_policy_flags(psoc);
946 }
947 
948 /**
949  * ucfg_scan_cfg_get_conc_max_resttime() - API to get max rest time
950  * @psoc: pointer to psoc object
951  * @rest_time: scan concurrent max resttime
952  *
953  * Return: scan concurrent max rest time
954  */
955 static inline
ucfg_scan_cfg_get_conc_max_resttime(struct wlan_objmgr_psoc * psoc,uint32_t * rest_time)956 void ucfg_scan_cfg_get_conc_max_resttime(struct wlan_objmgr_psoc *psoc,
957 					 uint32_t *rest_time)
958 {
959 	return wlan_scan_cfg_get_conc_max_resttime(psoc, rest_time);
960 }
961 
962 /**
963  * ucfg_scan_cfg_get_conc_min_resttime() - API to get concurrent min rest time
964  * @psoc: pointer to psoc object
965  * @rest_time: scan concurrent min rest time
966  *
967  * Return: scan concurrent min rest time
968  */
969 static inline
ucfg_scan_cfg_get_conc_min_resttime(struct wlan_objmgr_psoc * psoc,uint32_t * rest_time)970 void ucfg_scan_cfg_get_conc_min_resttime(struct wlan_objmgr_psoc *psoc,
971 					 uint32_t *rest_time)
972 {
973 	return wlan_scan_cfg_get_conc_min_resttime(psoc, rest_time);
974 }
975 
976 #ifdef FEATURE_WLAN_SCAN_PNO
977 /**
978  * ucfg_scan_is_pno_offload_enabled() - Check if pno offload is enabled
979  * @psoc: pointer to psoc object
980  *
981  * Return: pno_offload_enabled flag
982  */
983 bool ucfg_scan_is_pno_offload_enabled(struct wlan_objmgr_psoc *psoc);
984 
985 /**
986  * ucfg_scan_set_pno_offload() - API to set pno offload flag based on the
987  * capability received from the firmware.
988  * @psoc: pointer to psoc object
989  * @value: pno offload flag value
990  *
991  * Return: scan concurrent min rest time
992  */
993 void ucfg_scan_set_pno_offload(struct wlan_objmgr_psoc *psoc, bool value);
994 
995 /**
996  * ucfg_scan_get_pno_scan_support() - Check if pno scan support is enabled
997  * @psoc: pointer to psoc object
998  *
999  * Return: scan_support_enabled flag
1000  */
1001 bool ucfg_scan_get_pno_scan_support(struct wlan_objmgr_psoc *psoc);
1002 
1003 /**
1004  * ucfg_get_scan_backoff_multiplier() - get scan backoff multiplier value
1005  * @psoc: pointer to psoc object
1006  *
1007  * Return: scan_support_enabled flag
1008  */
1009 uint8_t ucfg_get_scan_backoff_multiplier(struct wlan_objmgr_psoc *psoc);
1010 
1011 /**
1012  * ucfg_scan_is_dfs_chnl_scan_enabled() - Check if PNO dfs channel scan support
1013  * is enabled
1014  * @psoc: pointer to psoc object
1015  *
1016  * Return: dfs_chnl_scan_enabled flag
1017  */
1018 bool ucfg_scan_is_dfs_chnl_scan_enabled(struct wlan_objmgr_psoc *psoc);
1019 
1020 /**
1021  * ucfg_scan_get_scan_timer_repeat_value() - API to get PNO scan timer repeat
1022  * value
1023  * @psoc: pointer to psoc object
1024  *
1025  * Return: scan_timer_repeat_value
1026  */
1027 uint32_t ucfg_scan_get_scan_timer_repeat_value(struct wlan_objmgr_psoc *psoc);
1028 
1029 /**
1030  * ucfg_scan_get_slow_scan_multiplier() - API to get PNO slow scan multiplier
1031  * value
1032  * @psoc: pointer to psoc object
1033  *
1034  * Return: slow_scan_multiplier value
1035  */
1036 uint32_t ucfg_scan_get_slow_scan_multiplier(struct wlan_objmgr_psoc *psoc);
1037 
1038 /**
1039  * ucfg_scan_get_max_sched_scan_plan_interval() - API to get maximum scheduled
1040  * scan plan interval
1041  * @psoc: pointer to psoc object
1042  *
1043  * Return: max_sched_scan_plan_interval value.
1044  */
1045 uint32_t
1046 ucfg_scan_get_max_sched_scan_plan_interval(struct wlan_objmgr_psoc *psoc);
1047 
1048 /**
1049  * ucfg_scan_get_max_sched_scan_plan_iterations() - API to get maximum scheduled
1050  * scan plan iterations
1051  * @psoc: pointer to psoc object
1052  *
1053  * Return: value.
1054  */
1055 uint32_t
1056 ucfg_scan_get_max_sched_scan_plan_iterations(struct wlan_objmgr_psoc *psoc);
1057 
1058 /**
1059  * ucfg_scan_get_user_config_sched_scan_plan() - API to get user config sched
1060  * scan plan configuration value
1061  * @psoc: pointer to psoc object
1062  *
1063  * Return: value.
1064  */
1065 bool
1066 ucfg_scan_get_user_config_sched_scan_plan(struct wlan_objmgr_psoc *psoc);
1067 
1068 #ifdef WLAN_POLICY_MGR_ENABLE
1069 /**
1070  * ucfg_scan_update_pno_dwell_time() - update active and passive dwell time
1071  * depending on active concurrency modes
1072  * @vdev: vdev object pointer
1073  * @req: pno scan request parameters
1074  * @scan_def: scan default parameters
1075  *
1076  * Return: void
1077  */
1078 static inline
ucfg_scan_update_pno_dwell_time(struct wlan_objmgr_vdev * vdev,struct pno_scan_req_params * req,struct scan_default_params * scan_def)1079 void ucfg_scan_update_pno_dwell_time(struct wlan_objmgr_vdev *vdev,
1080 				     struct pno_scan_req_params *req,
1081 				     struct scan_default_params *scan_def)
1082 {
1083 	wlan_scan_update_pno_dwell_time(vdev, req, scan_def);
1084 }
1085 
1086 #else
1087 static inline
ucfg_scan_update_pno_dwell_time(struct wlan_objmgr_vdev * vdev,struct pno_scan_req_params * req,struct scan_default_params * scan_def)1088 void ucfg_scan_update_pno_dwell_time(struct wlan_objmgr_vdev *vdev,
1089 				     struct pno_scan_req_params *req,
1090 				     struct scan_default_params *scan_def)
1091 {}
1092 
1093 #endif
1094 
1095 #else
1096 static inline
ucfg_scan_is_pno_offload_enabled(struct wlan_objmgr_psoc * psoc)1097 bool ucfg_scan_is_pno_offload_enabled(struct wlan_objmgr_psoc *psoc)
1098 {
1099 	return 0;
1100 }
1101 
1102 static inline
ucfg_scan_set_pno_offload(struct wlan_objmgr_psoc * psoc,bool value)1103 void ucfg_scan_set_pno_offload(struct wlan_objmgr_psoc *psoc, bool value)
1104 {
1105 }
1106 
1107 static inline
ucfg_scan_get_pno_scan_support(struct wlan_objmgr_psoc * psoc)1108 bool ucfg_scan_get_pno_scan_support(struct wlan_objmgr_psoc *psoc)
1109 {
1110 	return 0;
1111 }
1112 
1113 static inline
ucfg_get_scan_backoff_multiplier(struct wlan_objmgr_psoc * psoc)1114 uint8_t ucfg_get_scan_backoff_multiplier(struct wlan_objmgr_psoc *psoc)
1115 {
1116 	return 0;
1117 }
1118 
1119 static inline
ucfg_scan_is_dfs_chnl_scan_enabled(struct wlan_objmgr_psoc * psoc)1120 bool ucfg_scan_is_dfs_chnl_scan_enabled(struct wlan_objmgr_psoc *psoc)
1121 {
1122 	return 0;
1123 }
1124 
1125 static inline
ucfg_scan_get_scan_timer_repeat_value(struct wlan_objmgr_psoc * psoc)1126 uint32_t ucfg_scan_get_scan_timer_repeat_value(struct wlan_objmgr_psoc *psoc)
1127 {
1128 	return 0;
1129 }
1130 
1131 static inline
ucfg_scan_get_slow_scan_multiplier(struct wlan_objmgr_psoc * psoc)1132 uint32_t ucfg_scan_get_slow_scan_multiplier(struct wlan_objmgr_psoc *psoc)
1133 {
1134 	return 0;
1135 }
1136 
1137 static inline uint32_t
ucfg_scan_get_max_sched_scan_plan_interval(struct wlan_objmgr_psoc * psoc)1138 ucfg_scan_get_max_sched_scan_plan_interval(struct wlan_objmgr_psoc *psoc)
1139 {
1140 	return 0;
1141 }
1142 
1143 static inline uint32_t
ucfg_scan_get_max_sched_scan_plan_iterations(struct wlan_objmgr_psoc * psoc)1144 ucfg_scan_get_max_sched_scan_plan_iterations(struct wlan_objmgr_psoc *psoc)
1145 {
1146 	return 0;
1147 }
1148 
1149 static inline bool
ucfg_scan_get_user_config_sched_scan_plan(struct wlan_objmgr_psoc * psoc)1150 ucfg_scan_get_user_config_sched_scan_plan(struct wlan_objmgr_psoc *psoc)
1151 {
1152 	return true;
1153 }
1154 
1155 #endif /* FEATURE_WLAN_SCAN_PNO */
1156 
1157 /**
1158  * ucfg_scan_is_connected_scan_enabled() - API to get scan enabled after connect
1159  * @psoc: pointer to psoc object
1160  *
1161  * Return: value.
1162  */
1163 bool ucfg_scan_is_connected_scan_enabled(struct wlan_objmgr_psoc *psoc);
1164 
1165 /**
1166  * ucfg_scan_is_snr_monitor_enabled() - API to get SNR monitoring enabled or not
1167  * @psoc: pointer to psoc object
1168  *
1169  * Return: value.
1170  */
1171 static inline
ucfg_scan_is_snr_monitor_enabled(struct wlan_objmgr_psoc * psoc)1172 bool ucfg_scan_is_snr_monitor_enabled(struct wlan_objmgr_psoc *psoc)
1173 {
1174 	return wlan_scan_is_snr_monitor_enabled(psoc);
1175 }
1176 #endif
1177