xref: /wlan-driver/qca-wifi-host-cmn/umac/scan/dispatcher/src/wlan_extscan_api.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  *
4*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
5*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
6*5113495bSYour Name  * above copyright notice and this permission notice appear in all
7*5113495bSYour Name  * copies.
8*5113495bSYour Name  *
9*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
17*5113495bSYour Name  */
18*5113495bSYour Name 
19*5113495bSYour Name /*
20*5113495bSYour Name  * DOC: This file contains all EXTSSCAN component's APIs
21*5113495bSYour Name  */
22*5113495bSYour Name 
23*5113495bSYour Name #include "wlan_extscan_api.h"
24*5113495bSYour Name #include "cfg_ucfg_api.h"
25*5113495bSYour Name 
extscan_get_enable(struct wlan_objmgr_psoc * psoc)26*5113495bSYour Name bool extscan_get_enable(struct wlan_objmgr_psoc *psoc)
27*5113495bSYour Name {
28*5113495bSYour Name 	struct wlan_scan_obj *scan_obj;
29*5113495bSYour Name 
30*5113495bSYour Name 	scan_obj = wlan_psoc_get_scan_obj(psoc);
31*5113495bSYour Name 	if (!scan_obj) {
32*5113495bSYour Name 		scm_err("Failed to get scan object");
33*5113495bSYour Name 		return false;
34*5113495bSYour Name 	}
35*5113495bSYour Name 
36*5113495bSYour Name 	return scan_obj->extscan_cfg.extscan_enabled;
37*5113495bSYour Name }
38*5113495bSYour Name 
extscan_get_passive_max_time(struct wlan_objmgr_psoc * psoc,uint32_t * passive_max_chn_time)39*5113495bSYour Name void extscan_get_passive_max_time(struct wlan_objmgr_psoc *psoc,
40*5113495bSYour Name 				  uint32_t *passive_max_chn_time)
41*5113495bSYour Name {
42*5113495bSYour Name 	struct wlan_scan_obj *scan_obj;
43*5113495bSYour Name 
44*5113495bSYour Name 	scan_obj = wlan_psoc_get_scan_obj(psoc);
45*5113495bSYour Name 	if (!scan_obj) {
46*5113495bSYour Name 		scm_err("Failed to get scan object");
47*5113495bSYour Name 		return;
48*5113495bSYour Name 	}
49*5113495bSYour Name 
50*5113495bSYour Name 	*passive_max_chn_time =
51*5113495bSYour Name 		scan_obj->extscan_cfg.extscan_passive_max_chn_time;
52*5113495bSYour Name }
53*5113495bSYour Name 
extscan_get_active_max_time(struct wlan_objmgr_psoc * psoc,uint32_t * active_max_chn_time)54*5113495bSYour Name void extscan_get_active_max_time(struct wlan_objmgr_psoc *psoc,
55*5113495bSYour Name 				 uint32_t *active_max_chn_time)
56*5113495bSYour Name {
57*5113495bSYour Name 	struct wlan_scan_obj *scan_obj;
58*5113495bSYour Name 
59*5113495bSYour Name 	scan_obj = wlan_psoc_get_scan_obj(psoc);
60*5113495bSYour Name 	if (!scan_obj) {
61*5113495bSYour Name 		scm_err("Failed to get scan object");
62*5113495bSYour Name 		return;
63*5113495bSYour Name 	}
64*5113495bSYour Name 
65*5113495bSYour Name 	*active_max_chn_time =
66*5113495bSYour Name 		scan_obj->extscan_cfg.extscan_active_max_chn_time;
67*5113495bSYour Name }
68*5113495bSYour Name 
extscan_get_active_min_time(struct wlan_objmgr_psoc * psoc,uint32_t * active_min_chn_time)69*5113495bSYour Name void extscan_get_active_min_time(struct wlan_objmgr_psoc *psoc,
70*5113495bSYour Name 				 uint32_t *active_min_chn_time)
71*5113495bSYour Name {
72*5113495bSYour Name 	struct wlan_scan_obj *scan_obj;
73*5113495bSYour Name 
74*5113495bSYour Name 	scan_obj = wlan_psoc_get_scan_obj(psoc);
75*5113495bSYour Name 	if (!scan_obj) {
76*5113495bSYour Name 		scm_err("Failed to get scan object");
77*5113495bSYour Name 		return;
78*5113495bSYour Name 	}
79*5113495bSYour Name 
80*5113495bSYour Name 	*active_min_chn_time =
81*5113495bSYour Name 		scan_obj->extscan_cfg.extscan_active_min_chn_time;
82*5113495bSYour Name }
83*5113495bSYour Name 
84*5113495bSYour Name QDF_STATUS
wlan_extscan_global_init(struct wlan_objmgr_psoc * psoc,struct wlan_scan_obj * scan_obj)85*5113495bSYour Name wlan_extscan_global_init(struct wlan_objmgr_psoc *psoc,
86*5113495bSYour Name 			 struct wlan_scan_obj *scan_obj)
87*5113495bSYour Name {
88*5113495bSYour Name 	struct extscan_def_config *extscan_def = &scan_obj->extscan_cfg;
89*5113495bSYour Name 
90*5113495bSYour Name 	extscan_def->extscan_enabled = true;
91*5113495bSYour Name 	extscan_def->extscan_passive_max_chn_time =
92*5113495bSYour Name 			cfg_get(psoc, CFG_EXTSCAN_PASSIVE_MAX_CHANNEL_TIME);
93*5113495bSYour Name 	extscan_def->extscan_passive_min_chn_time =
94*5113495bSYour Name 			cfg_get(psoc, CFG_EXTSCAN_PASSIVE_MIN_CHANNEL_TIME);
95*5113495bSYour Name 	extscan_def->extscan_active_max_chn_time =
96*5113495bSYour Name 			cfg_get(psoc, CFG_EXTSCAN_ACTIVE_MAX_CHANNEL_TIME);
97*5113495bSYour Name 	extscan_def->extscan_active_min_chn_time =
98*5113495bSYour Name 			cfg_get(psoc, CFG_EXTSCAN_ACTIVE_MIN_CHANNEL_TIME);
99*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
100*5113495bSYour Name }
101*5113495bSYour Name 
102*5113495bSYour Name QDF_STATUS
wlan_extscan_global_deinit()103*5113495bSYour Name wlan_extscan_global_deinit()
104*5113495bSYour Name {
105*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
106*5113495bSYour Name }
107