xref: /wlan-dirver/qca-wifi-host-cmn/umac/scan/dispatcher/src/wlan_scan_api.c (revision 1f55ed1a9f5050d8da228aa8dd3fff7c0242aa71)
1 /*
2  * Copyright (c) 2017-2019 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 SCAN component's APIs
21  */
22 
23 #include "cfg_ucfg_api.h"
24 #include "wlan_scan_api.h"
25 
26 void wlan_scan_cfg_get_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
27 					 uint32_t *dwell_time)
28 {
29 	struct wlan_scan_obj *scan_obj;
30 
31 	scan_obj = wlan_psoc_get_scan_obj(psoc);
32 	if (!scan_obj)
33 		return;
34 	*dwell_time = scan_obj->scan_def.passive_dwell;
35 }
36 
37 void wlan_scan_cfg_set_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
38 					 uint32_t dwell_time)
39 {
40 	struct wlan_scan_obj *scan_obj;
41 
42 	scan_obj = wlan_psoc_get_scan_obj(psoc);
43 	if (!scan_obj)
44 		return;
45 	scan_obj->scan_def.passive_dwell = dwell_time;
46 }
47 
48 void wlan_scan_cfg_get_active_dwelltime(struct wlan_objmgr_psoc *psoc,
49 					uint32_t *dwell_time)
50 {
51 	struct wlan_scan_obj *scan_obj;
52 
53 	scan_obj = wlan_psoc_get_scan_obj(psoc);
54 	if (!scan_obj)
55 		return;
56 	*dwell_time = scan_obj->scan_def.active_dwell;
57 }
58 
59 void wlan_scan_cfg_set_active_dwelltime(struct wlan_objmgr_psoc *psoc,
60 					uint32_t dwell_time)
61 {
62 	struct wlan_scan_obj *scan_obj;
63 
64 	scan_obj = wlan_psoc_get_scan_obj(psoc);
65 	if (!scan_obj)
66 		return;
67 	scan_obj->scan_def.active_dwell = dwell_time;
68 }
69 
70 void wlan_scan_cfg_get_conc_active_dwelltime(struct wlan_objmgr_psoc *psoc,
71 					     uint32_t *dwell_time)
72 {
73 	struct wlan_scan_obj *scan_obj;
74 
75 	scan_obj = wlan_psoc_get_scan_obj(psoc);
76 	if (!scan_obj)
77 		return;
78 
79 	*dwell_time = scan_obj->scan_def.conc_active_dwell;
80 }
81 
82 void wlan_scan_cfg_set_conc_active_dwelltime(struct wlan_objmgr_psoc *psoc,
83 					     uint32_t dwell_time)
84 {
85 	struct wlan_scan_obj *scan_obj;
86 
87 	scan_obj = wlan_psoc_get_scan_obj(psoc);
88 	if (!scan_obj)
89 		return;
90 
91 	scan_obj->scan_def.conc_active_dwell = dwell_time;
92 }
93 
94 void wlan_scan_cfg_get_conc_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
95 					      uint32_t *dwell_time)
96 {
97 	struct wlan_scan_obj *scan_obj;
98 
99 	scan_obj = wlan_psoc_get_scan_obj(psoc);
100 	if (!scan_obj)
101 		return;
102 
103 	*dwell_time = scan_obj->scan_def.conc_passive_dwell;
104 }
105 
106 void wlan_scan_cfg_set_conc_passive_dwelltime(struct wlan_objmgr_psoc *psoc,
107 					      uint32_t dwell_time)
108 {
109 	struct wlan_scan_obj *scan_obj;
110 
111 	scan_obj = wlan_psoc_get_scan_obj(psoc);
112 	if (!scan_obj)
113 		return;
114 
115 	scan_obj->scan_def.conc_passive_dwell = dwell_time;
116 }
117 
118 void
119 wlan_scan_cfg_get_dfs_chan_scan_allowed(struct wlan_objmgr_psoc *psoc,
120 					bool *enable_dfs_scan)
121 {
122 	struct wlan_scan_obj *scan_obj;
123 
124 	scan_obj = wlan_psoc_get_scan_obj(psoc);
125 	if (!scan_obj)
126 		return;
127 
128 	*enable_dfs_scan = scan_obj->scan_def.allow_dfs_chan_in_scan;
129 }
130 
131 void
132 wlan_scan_cfg_set_dfs_chan_scan_allowed(struct wlan_objmgr_psoc *psoc,
133 					bool enable_dfs_scan)
134 {
135 	struct wlan_scan_obj *scan_obj;
136 
137 	scan_obj = wlan_psoc_get_scan_obj(psoc);
138 	if (!scan_obj)
139 		return;
140 
141 	scan_obj->scan_def.allow_dfs_chan_in_scan = enable_dfs_scan;
142 }
143 
144 void wlan_scan_cfg_get_conc_max_resttime(struct wlan_objmgr_psoc *psoc,
145 					 uint32_t *rest_time)
146 {
147 	struct wlan_scan_obj *scan_obj;
148 
149 	scan_obj = wlan_psoc_get_scan_obj(psoc);
150 	if (!scan_obj)
151 		return;
152 
153 	*rest_time = scan_obj->scan_def.conc_max_rest_time;
154 }
155 
156 void wlan_scan_cfg_get_conc_min_resttime(struct wlan_objmgr_psoc *psoc,
157 					 uint32_t *rest_time)
158 {
159 	struct wlan_scan_obj *scan_obj;
160 
161 	scan_obj = wlan_psoc_get_scan_obj(psoc);
162 	if (!scan_obj)
163 		return;
164 
165 	*rest_time = scan_obj->scan_def.conc_min_rest_time;
166 }
167