blob: ed0c86b2199262f61705ee5a28777301f65272eb [file] [log] [blame]
Om Prakash Tripathi7e3f45d2016-12-28 16:58:54 +05301/*
Yeshwanth Sriram Guntukaf70a37b2018-01-18 16:08:25 +05302 * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
Om Prakash Tripathi7e3f45d2016-12-28 16:58:54 +05303 *
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 north bound interface api
21 */
22
23#ifndef _WLAN_SCAN_UCFG_API_H_
24#define _WLAN_SCAN_UCFG_API_H_
25
26#include <scheduler_api.h>
Om Prakash Tripathi7e3f45d2016-12-28 16:58:54 +053027#include <wlan_objmgr_psoc_obj.h>
28#include <wlan_objmgr_pdev_obj.h>
29#include <wlan_objmgr_vdev_obj.h>
Om Prakash Tripathi22f95dc2016-12-19 10:45:59 +053030#include <wlan_scan_public_structs.h>
Om Prakash Tripathi7e3f45d2016-12-28 16:58:54 +053031
32/**
33 * ucfg_scan_register_requester() - assigns requester ID to caller and
34 * registers scan event call back handler
35 * @psoc: psoc object
36 * @module_name:name of requester module
37 * @event_cb: event callback function pointer
38 * @arg: argument to @event_cb
39 *
40 * API, allows other components to allocate requester id
41 * Normally used by modules at init time to register their callback
42 * and get one requester id. @event_cb will be invoked for
43 * all scan events whose requester id matches with @requester.
44 *
45 * Return: assigned non zero requester id for success
46 * zero (0) for failure
47 */
48wlan_scan_requester
49ucfg_scan_register_requester(struct wlan_objmgr_psoc *psoc,
50 uint8_t *module_name, scan_event_handler event_cb, void *arg);
51
52/**
53 * ucfg_scan_unregister_requester() -reclaims previously allocated requester ID
54 * @psoc: psoc object
55 * @requester: requester ID to reclaim.
56 *
57 * API, reclaims previously allocated requester id by
58 * ucfg_scan_get_req_id_reg_cb()
59 *
60 * Return: void
61 */
62void ucfg_scan_unregister_requester(struct wlan_objmgr_psoc *psoc,
63 wlan_scan_requester requester);
64
65
66/**
67 * ucfg_get_scan_requester_name()- returns module name of requester ID owner
68 * @psoc: psoc object
69 * @requester: requester ID
70 *
71 * API, returns module name of requester id owner
72 *
73 * Return: pointer to module name or "unknown" if requester id not found.
74 */
75uint8_t *ucfg_get_scan_requester_name(struct wlan_objmgr_psoc *psoc,
76 wlan_scan_requester requester);
77
78
79
80/**
81 * ucfg_scan_get_scan_id() - allocates scan ID
82 * @psoc: psoc object
83 *
84 * API, allocates a new scan id for caller
85 *
86 * Return: newly allocated scan ID
87 */
88wlan_scan_id
89ucfg_scan_get_scan_id(struct wlan_objmgr_psoc *psoc);
90
Abhishek Singh8c6e82d2017-03-03 21:57:29 +053091#ifdef FEATURE_WLAN_SCAN_PNO
92/**
93 * ucfg_scan_pno_start() - Public API to start PNO
94 * @vdev: vdev pointer
95 * @req: pno req params
96 *
97 * Return: 0 for success or error code.
98 */
99QDF_STATUS ucfg_scan_pno_start(struct wlan_objmgr_vdev *vdev,
100struct pno_scan_req_params *req);
Om Prakash Tripathi7e3f45d2016-12-28 16:58:54 +0530101
102/**
Abhishek Singh8c6e82d2017-03-03 21:57:29 +0530103 * ucfg_scan_pno_stop() - Public API to stop PNO
104 * @vdev: vdev pointer
105 * @req: pno req params
106 *
107 * Return: 0 for success or error code.
108 */
109QDF_STATUS ucfg_scan_pno_stop(struct wlan_objmgr_vdev *vdev);
110
111/**
112 * ucfg_scan_get_pno_in_progress() - Public API to check if pno is in progress
113 * @vdev: vdev pointer
114 *
115 * Return: true if pno in progress else false.
116 */
117bool ucfg_scan_get_pno_in_progress(struct wlan_objmgr_vdev *vdev);
118
119/**
120 * ucfg_scan_get_pno_match() - Public API to check if pno matched
121 * @vdev: vdev pointer
122 *
123 * Return: true if pno matched else false.
124 */
125bool ucfg_scan_get_pno_match(struct wlan_objmgr_vdev *vdev);
126
127/**
128 * ucfg_scan_register_pno_cb() - register pno cb
129 * @psoc: psoc object
130 * @event_cb: callback function pointer
131 * @arg: argument to @event_cb
132 *
133 * Return: QDF_STATUS
134 */
135QDF_STATUS
136ucfg_scan_register_pno_cb(struct wlan_objmgr_psoc *psoc,
137 scan_event_handler event_cb, void *arg);
138
139/**
140 * ucfg_scan_get_pno_def_params() - get the defaults pno params
141 * @vdev: vdev object
142 * @req: pno request object
143 *
144 * Return: QDF_STATUS_SUCCESS or error code
145 */
146QDF_STATUS
147ucfg_scan_get_pno_def_params(struct wlan_objmgr_vdev *vdev,
148 struct pno_scan_req_params *req);
149
150#else
151
152static inline bool
153ucfg_scan_get_pno_in_progress(struct wlan_objmgr_vdev *vdev)
154{
155 return false;
156}
157
158static inline bool
159ucfg_scan_get_pno_match(struct wlan_objmgr_vdev *vdev)
160{
161 return false;
162}
163#endif /* FEATURE_WLAN_SCAN_PNO */
164/**
Om Prakash Tripathi7e3f45d2016-12-28 16:58:54 +0530165 * ucfg_scan_start() - Public API to start a scan
166 * @req: start scan req params
167 *
168 * The Public API to start a scan. Post a msg to target_if queue
169 *
170 * Return: 0 for success or error code.
171 */
172QDF_STATUS
173ucfg_scan_start(struct scan_start_request *req);
174
175/**
Abhishek Singh65c4be72017-10-12 11:06:33 +0530176 * ucfg_scan_set_enable() - Public API to disable/enable scans
177 * @psoc: psoc on which scans need to be disabled
178 * @enable: enable scan if true disable is false
179 *
180 * Return: QDF_STATUS.
181 */
182QDF_STATUS ucfg_scan_set_enable(struct wlan_objmgr_psoc *psoc, bool enable);
183
184/**
185 * ucfg_scan_get_enable() - Public API to get if scan is enabled or disabled
186 * @psoc: psoc on which scans status need to be checked
187 *
188 * Return: true if enabled else false.
189 */
190bool ucfg_scan_get_enable(struct wlan_objmgr_psoc *psoc);
191
192/**
Yeshwanth Sriram Guntukaf70a37b2018-01-18 16:08:25 +0530193 * ucfg_scan_set_miracast() - Public API to disable/enable miracast flag
194 * @psoc: psoc pointer
195 * @enable: enable miracast if true disable is false
196 *
197 * Return: QDF_STATUS.
198 */
199QDF_STATUS ucfg_scan_set_miracast(
200 struct wlan_objmgr_psoc *psoc, bool enable);
201
202/**
Om Prakash Tripathi339dc262018-02-08 15:23:20 +0530203 * ucfg_scan_set_disable_timeout() - Public API to disable/enable scan timeout
204 * @psoc: psoc on which scan timeout need to be disabled
205 * @disable: disable scan timeout if true else enable scan timeout
206 *
207 * Return: QDF_STATUS.
208 */
209QDF_STATUS
210ucfg_scan_set_disable_timeout(struct wlan_objmgr_psoc *psoc, bool disable);
211
212/**
213 * ucfg_scan_get_disable_timeout() - Public API to get if scan timeout
214 * is enabled or disabled
215 * @psoc: psoc on which scan timeout status need to be checked
216 *
217 * Return: true if timeout is diaabled else false.
218 */
219bool ucfg_scan_get_disable_timeout(struct wlan_objmgr_psoc *psoc);
220
221/**
Om Prakash Tripathi3e166ff2017-11-03 16:11:11 +0530222 * ucfg_scan_set_wide_band_scan() - Public API to disable/enable wide band scan
223 * @pdev: psoc on which scans need to be disabled
224 * @enable: enable wide band scan if @enable is true, disable otherwise
225 *
226 * Return: QDF_STATUS.
227 */
228QDF_STATUS ucfg_scan_set_wide_band_scan(
229 struct wlan_objmgr_pdev *pdev, bool enable);
230
231/**
232 * ucfg_scan_get_wide_band_scan() - Public API to check if
233 * wide band scan is enabled or disabled
234 * @pdev: psoc on which scans status need to be checked
235 *
236 * Return: true if enabled else false.
237 */
238bool ucfg_scan_get_wide_band_scan(struct wlan_objmgr_pdev *pdev);
239
240/**
Om Prakash Tripathi7e3f45d2016-12-28 16:58:54 +0530241 * ucfg_scan_cancel() - Public API to stop a scan
242 * @req: stop scan request params
243 *
244 * The Public API to stop a scan. Post a msg to target_if queue
245 *
246 * Return: 0 for success or error code.
247 */
248QDF_STATUS
249ucfg_scan_cancel(struct scan_cancel_request *req);
250
251/**
Abhishek Singhf95b9e42017-04-25 12:12:01 +0530252 * ucfg_scan_cancel_sync() - Public API to stop a scan and wait
253 * till all scan are completed
254 * @req: stop scan request params
255 *
256 * The Public API to stop a scan and wait
257 * till all scan are completed
258 *
259 * Return: 0 for success or error code.
260 */
261QDF_STATUS
262ucfg_scan_cancel_sync(struct scan_cancel_request *req);
263
264/**
Om Prakash Tripathi7e3f45d2016-12-28 16:58:54 +0530265 * ucfg_scan_get_result() - The Public API to get scan results
266 * @pdev: pdev info
267 * @filter: Filters
268 *
269 * This function fetches scan result
270 *
271 * Return: scan list pointer
272 */
273qdf_list_t *ucfg_scan_get_result(struct wlan_objmgr_pdev *pdev,
274 struct scan_filter *filter);
275
276/**
277 * ucfg_scan_purge_results() - purge the scan list
278 * @scan_list: scan list to be purged
279 *
280 * This function purge the temp scan list
281 *
282 * Return: QDF_STATUS
283 */
284QDF_STATUS ucfg_scan_purge_results(qdf_list_t *scan_list);
285
286/**
287 * ucfg_scan_flush_results() - The Public API to flush scan result
288 * @pdev: pdev object
289 * @filter: filter to flush the scan entries
290 *
291 * The Public API to flush scan result.
292 *
293 * Return: 0 for success or error code.
294 */
295QDF_STATUS ucfg_scan_flush_results(struct wlan_objmgr_pdev *pdev,
296 struct scan_filter *filter);
297
298/**
299 * ucfg_scan_filter_valid_channel() - The Public API to filter scan result
300 * based on valid channel list
301 * @pdev: pdev object
302 * @chan_list: valid channel list
303 * @num_chan: number of valid channels
304 *
305 * The Public API to to filter scan result
306 * based on valid channel list.
307 *
308 * Return: void.
309 */
310void ucfg_scan_filter_valid_channel(struct wlan_objmgr_pdev *pdev,
311 uint8_t *chan_list, uint32_t num_chan);
312
313/**
Om Prakash Tripathi7e3f45d2016-12-28 16:58:54 +0530314 * ucfg_scan_db_iterate() - function to iterate scan table
315 * @pdev: pdev object
316 * @func: iterator function pointer
317 * @arg: argument to be passed to func()
318 *
319 * API, this API iterates scan table and invokes func
320 * on each scan enetry by passing scan entry and arg.
321 *
322 * Return: QDF_STATUS
323 */
324QDF_STATUS
325ucfg_scan_db_iterate(struct wlan_objmgr_pdev *pdev,
326 scan_iterator_func func, void *arg);
327
328/**
329 * ucfg_scan_update_mlme_info() - The Public API to update mlme
330 * info in the scan entry
331 * @vdev: vdev object
332 * @bss: bss info to find the matching scan entry
333 * @mlme_info: mlme info to be updated.
334 *
335 * The Public API to update mlme info in the scan entry.
336 * Post a msg to target_if queue
337 *
338 * Return: 0 for success or error code.
339 */
340QDF_STATUS
341ucfg_scan_update_mlme_info(struct wlan_objmgr_vdev *vdev, struct bss_info *bss,
342 struct mlme_info *mlme_info);
343
344/**
345 * ucfg_scan_register_event_handler() - The Public API to register
346 * an event cb handler
Om Prakash Tripathid088a8a2017-04-04 17:12:51 +0530347 * @pdev: pdev object
Om Prakash Tripathi7e3f45d2016-12-28 16:58:54 +0530348 * @event_cb: callback function to register
349 * @arg: component specific priv argument to @event_cb callback function
350 *
351 * The Public API to register a event cb handler. This cb is called whenever
Om Prakash Tripathid088a8a2017-04-04 17:12:51 +0530352 * any scan event is received on @pdev.
Om Prakash Tripathi7e3f45d2016-12-28 16:58:54 +0530353 *
354 * Return: 0 for success or error code.
355 */
356
357QDF_STATUS
Om Prakash Tripathid088a8a2017-04-04 17:12:51 +0530358ucfg_scan_register_event_handler(struct wlan_objmgr_pdev *pdev,
Om Prakash Tripathi7e3f45d2016-12-28 16:58:54 +0530359 scan_event_handler event_cb, void *arg);
360
361/**
362 * ucfg_scan_unregister_event_handler() - Public API to unregister
363 * event cb handler
Om Prakash Tripathid088a8a2017-04-04 17:12:51 +0530364 * @pdev: pdev object
Om Prakash Tripathi7e3f45d2016-12-28 16:58:54 +0530365 * @event_cb: callback function to unregister
366 * @arg: component specific priv argument to @event_cb callback function
367 *
368 * Unregister a event cb handler. cb and arg will be used to
369 * find the calback.
370 *
371 * Return: void
372 */
373
374void
Om Prakash Tripathid088a8a2017-04-04 17:12:51 +0530375ucfg_scan_unregister_event_handler(struct wlan_objmgr_pdev *pdev,
Om Prakash Tripathi7e3f45d2016-12-28 16:58:54 +0530376 scan_event_handler event_cb, void *arg);
377
378/**
379 * ucfg_scan_init_default_params() - get the defaults scan params
380 * @vdev: vdev object
381 * @req: scan request object
382 *
383 * get the defaults scan params
384 *
385 * Return: QDF_STATUS_SUCCESS or error code
386 */
387QDF_STATUS
388ucfg_scan_init_default_params(struct wlan_objmgr_vdev *vdev,
389 struct scan_start_request *req);
390
391/**
392 * ucfg_scan_init_ssid_params() - initialize scan request ssid list
393 *
394 * @scan_req: scan request object
395 * @num_ssid: number of ssid's in ssid list
396 * @ssid_list: ssid list
397 *
398 * Return: QDF_STATUS_SUCCESS for success or error code
399 */
400QDF_STATUS
401ucfg_scan_init_ssid_params(struct scan_start_request *scan_req,
402 uint32_t num_ssid, struct wlan_ssid *ssid_list);
403
404/**
405 * ucfg_scan_init_bssid_params() - initialize scan request bssid list
406 * @scan_req: scan request object
407 * @num_ssid: number of bssid's in bssid list
408 * @bssid_list: bssid list
409 *
410 * Return: QDF_STATUS_SUCCESS for success or error code
411 */
412QDF_STATUS
413ucfg_scan_init_bssid_params(struct scan_start_request *scan_req,
414 uint32_t num_ssid, struct qdf_mac_addr *bssid_list);
415
416/**
417 * ucfg_scan_init_chanlist_params() - initialize scan request channel list
418 * @scan_req: scan request object
Om Prakash Tripathi3e166ff2017-11-03 16:11:11 +0530419 * @num_chans: number of channels in channel list
420 * @chan_list: channel list
421 * @phymode: phymode in which scan shall be done
Om Prakash Tripathi7e3f45d2016-12-28 16:58:54 +0530422 *
423 * Return: QDF_STATUS_SUCCESS for success or error code
424 */
425QDF_STATUS
426ucfg_scan_init_chanlist_params(struct scan_start_request *scan_req,
Om Prakash Tripathi3e166ff2017-11-03 16:11:11 +0530427 uint32_t num_chans, uint32_t *chan_list, uint32_t *phymode);
Om Prakash Tripathi7e3f45d2016-12-28 16:58:54 +0530428
429/**
430 * ucfg_scan_get_vdev_status() - API to check vdev scan status
431 * @vdev: vdev object
432 *
433 * Return: enum scm_scan_status
434 */
435enum scm_scan_status
436ucfg_scan_get_vdev_status(struct wlan_objmgr_vdev *vdev);
437
438/**
439 * ucfg_scan_get_pdev_status() - API to check pdev scan status
440 * @pdev: vdev object
441 *
442 * Return: enum scm_scan_status
443 */
444enum scm_scan_status
445ucfg_scan_get_pdev_status(struct wlan_objmgr_pdev *pdev);
446
447/**
Om Prakash Tripathi7e3f45d2016-12-28 16:58:54 +0530448 * ucfg_scan_register_bcn_cb() - API to register api
449 * to inform/update bcn/probe as soon as they are received
450 * @pdev: psoc
451 * @cb: callback to be registered
452 * @type: Type of callback to be registered
453 *
454 * Return: enum scm_scan_status
455 */
456QDF_STATUS ucfg_scan_register_bcn_cb(struct wlan_objmgr_psoc *psoc,
457 update_beacon_cb cb, enum scan_cb_type type);
458
459/*
Abhishek Singh2f132462017-03-06 16:48:59 +0530460 * ucfg_scan_update_user_config() - Update scan cache user config
461 * @psoc: psoc
462 * @scan_cfg: scan user config
463 *
464 * Return: QDF_STATUS
465 */
466QDF_STATUS ucfg_scan_update_user_config(struct wlan_objmgr_psoc *psoc,
467 struct scan_user_cfg *scan_cfg);
468
Abhishek Singh6e7489e2017-03-23 10:54:22 +0530469/**
470 * ucfg_scan_update_roam_params() - Store/Update the roam params
471 * @psoc: psoc
472 * @roam_params: roam params
473 *
474 * Return: QDF_STATUS
475 */
476QDF_STATUS ucfg_scan_update_roam_params(struct wlan_objmgr_psoc *psoc,
477 struct roam_filter_params *roam_params);
478
Abhishek Singh2f132462017-03-06 16:48:59 +0530479/*
Om Prakash Tripathi7e3f45d2016-12-28 16:58:54 +0530480 * ucfg_scan_init() - Scan module initialization API
481 *
482 * Return: QDF_STATUS
483 */
484QDF_STATUS ucfg_scan_init(void);
485
486/**
487 * ucfg_scan_deinit() - Scan module deinitilization API
488 *
489 * Return: QDF_STATUS
490 */
491QDF_STATUS ucfg_scan_deinit(void);
492
493/**
494 * ucfg_scan_psoc_enable() - Scan module enable API
495 * @psoc: psoc object
496 *
497 * Return: QDF_STATUS
498 */
499QDF_STATUS ucfg_scan_psoc_enable(struct wlan_objmgr_psoc *psoc);
500
501/**
502 * ucfg_scan_psoc_enable() - Scan module disable API
503 * @psoc: psoc object
504 *
505 * Return: QDF_STATUS
506 */
507QDF_STATUS ucfg_scan_psoc_disable(struct wlan_objmgr_psoc *psoc);
508
509/**
510 * ucfg_scan_psoc_open() - Scan module psoc open API
511 * @psoc: psoc object
512 *
513 * Return: QDF_STATUS
514 */
515QDF_STATUS ucfg_scan_psoc_open(struct wlan_objmgr_psoc *psoc);
516
517/**
518 * ucfg_scan_psoc_close() - Scan module psoc close API
519 * @psoc: psoc object
520 *
521 * Return: QDF_STATUS
522 */
523QDF_STATUS ucfg_scan_psoc_close(struct wlan_objmgr_psoc *psoc);
524
Om Prakash Tripathi0078b782017-04-12 12:23:40 +0530525/**
526 * ucfg_scan_get_max_active_scans() - API to get max active scans
527 * supported on this psoc
528 * @psoc: psoc object
529 *
530 * Return: uint32_t
531 */
532uint32_t ucfg_scan_get_max_active_scans(struct wlan_objmgr_psoc *psoc);
533
Rajeev Kumar Sirasanagandlaa3f4a292017-06-21 12:01:22 +0530534/**
535 * ucfg_ie_whitelist_enabled() - Checks for IE whitelisting enable
536 * @psoc: pointer to psoc object
537 * @vdev: pointer to vdev
538 *
539 * This function is used to check whether IE whitelisting is enabled or not
540 *
541 * Return: If enabled returns true else returns false
542 */
543bool ucfg_ie_whitelist_enabled(struct wlan_objmgr_psoc *psoc,
544 struct wlan_objmgr_vdev *vdev);
545
546/**
547 * ucfg_copy_ie_whitelist_attrs() - Populate probe req IE whitelist attrs
548 * @psoc: pointer to psoc object
549 * @ie_whitelist: output parameter to hold ie whitelist attrs
550 *
551 * If IE whitelisting is enabled then invoke this function to copy
552 * IE whitelisting attrs from wlan scan object
553 *
554 * Return: true - successful copy
555 * false - copy failed
556 */
557bool ucfg_copy_ie_whitelist_attrs(struct wlan_objmgr_psoc *psoc,
558 struct probe_req_whitelist_attr *ie_whitelist);
Yeshwanth Sriram Guntukab9e2f662017-12-14 17:56:04 +0530559
560/**
561 * ucfg_scan_set_bt_activity() - API to set bt activity
562 * @psoc: pointer to psoc object
563 * @bt_a2dp_active: bt activiy value
564 *
565 * Return: None
566 */
567void ucfg_scan_set_bt_activity(struct wlan_objmgr_psoc *psoc,
568 bool bt_a2dp_active);
569/**
570 * ucfg_scan_get_bt_activity() - API to get bt activity
571 * @psoc: pointer to psoc object
572 *
573 * Return: true if enabled else false.
574 */
575bool ucfg_scan_get_bt_activity(struct wlan_objmgr_psoc *psoc);
Om Prakash Tripathi7e3f45d2016-12-28 16:58:54 +0530576#endif