xref: /wlan-dirver/qca-wifi-host-cmn/umac/scan/dispatcher/src/wlan_extscan_api.c (revision dae10a5fbc53d54c53c4ba24fa018ad8b1e7c008)
1 /*
2  * Copyright (c) 2012-2018 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: This file contains all EXTSSCAN component's APIs
21  */
22 
23 #include "wlan_extscan_api.h"
24 #include "cfg_ucfg_api.h"
25 
26 bool extscan_get_enable(struct wlan_objmgr_psoc *psoc)
27 {
28 	struct wlan_scan_obj *scan_obj;
29 
30 	scan_obj = wlan_psoc_get_scan_obj(psoc);
31 	if (!scan_obj) {
32 		scm_err("Failed to get scan object");
33 		return false;
34 	}
35 
36 	return scan_obj->extscan_cfg.extscan_enabled;
37 }
38 
39 void extscan_get_passive_max_time(struct wlan_objmgr_psoc *psoc,
40 				  uint32_t *passive_max_chn_time)
41 {
42 	struct wlan_scan_obj *scan_obj;
43 
44 	scan_obj = wlan_psoc_get_scan_obj(psoc);
45 	if (!scan_obj) {
46 		scm_err("Failed to get scan object");
47 		return;
48 	}
49 
50 	*passive_max_chn_time =
51 		scan_obj->extscan_cfg.extscan_passive_max_chn_time;
52 }
53 
54 void extscan_get_active_max_time(struct wlan_objmgr_psoc *psoc,
55 				 uint32_t *active_max_chn_time)
56 {
57 	struct wlan_scan_obj *scan_obj;
58 
59 	scan_obj = wlan_psoc_get_scan_obj(psoc);
60 	if (!scan_obj) {
61 		scm_err("Failed to get scan object");
62 		return;
63 	}
64 
65 	*active_max_chn_time =
66 		scan_obj->extscan_cfg.extscan_active_max_chn_time;
67 }
68 
69 void extscan_get_active_min_time(struct wlan_objmgr_psoc *psoc,
70 				 uint32_t *active_min_chn_time)
71 {
72 	struct wlan_scan_obj *scan_obj;
73 
74 	scan_obj = wlan_psoc_get_scan_obj(psoc);
75 	if (!scan_obj) {
76 		scm_err("Failed to get scan object");
77 		return;
78 	}
79 
80 	*active_min_chn_time =
81 		scan_obj->extscan_cfg.extscan_active_min_chn_time;
82 }
83 
84 QDF_STATUS
85 wlan_extscan_global_init(struct wlan_objmgr_psoc *psoc,
86 			 struct wlan_scan_obj *scan_obj)
87 {
88 	struct extscan_def_config *extscan_def = &scan_obj->extscan_cfg;
89 
90 	extscan_def->extscan_enabled = true;
91 	extscan_def->extscan_passive_max_chn_time =
92 			cfg_get(psoc, CFG_EXTSCAN_PASSIVE_MAX_CHANNEL_TIME);
93 	extscan_def->extscan_passive_min_chn_time =
94 			cfg_get(psoc, CFG_EXTSCAN_PASSIVE_MIN_CHANNEL_TIME);
95 	extscan_def->extscan_active_max_chn_time =
96 			cfg_get(psoc, CFG_EXTSCAN_ACTIVE_MAX_CHANNEL_TIME);
97 	extscan_def->extscan_active_min_chn_time =
98 			cfg_get(psoc, CFG_EXTSCAN_ACTIVE_MIN_CHANNEL_TIME);
99 	return QDF_STATUS_SUCCESS;
100 }
101 
102 QDF_STATUS
103 wlan_extscan_global_deinit()
104 {
105 	return QDF_STATUS_SUCCESS;
106 }
107