xref: /wlan-dirver/qca-wifi-host-cmn/wmi/src/wmi_unified_extscan_api.c (revision 1b9674e21e24478fba4530f5ae7396b9555e9c6a)
1 /*
2  * Copyright (c) 2016-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 #include "wmi_unified_priv.h"
20 
21 /**
22  * wmi_unified_reset_passpoint_network_list_cmd() - reset passpoint network list
23  * @wmi_hdl: wmi handle
24  * @req: passpoint network request structure
25  *
26  * This function sends down WMI command with network id set to wildcard id.
27  * firmware shall clear all the config entries
28  *
29  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
30  */
31 QDF_STATUS wmi_unified_reset_passpoint_network_list_cmd(void *wmi_hdl,
32 					struct wifi_passpoint_req_param *req)
33 {
34 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
35 
36 	if (wmi_handle->ops->send_reset_passpoint_network_list_cmd)
37 		return wmi_handle->ops->send_reset_passpoint_network_list_cmd(wmi_handle,
38 			    req);
39 
40 	return QDF_STATUS_E_FAILURE;
41 }
42 
43 /**
44  * wmi_unified_set_passpoint_network_list_cmd() - set passpoint network list
45  * @wmi_hdl: wmi handle
46  * @req: passpoint network request structure
47  *
48  * This function reads the incoming @req and fill in the destination
49  * WMI structure and send down the passpoint configs down to the firmware
50  *
51  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
52  */
53 QDF_STATUS wmi_unified_set_passpoint_network_list_cmd(void *wmi_hdl,
54 					struct wifi_passpoint_req_param *req)
55 {
56 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
57 
58 	if (wmi_handle->ops->send_set_passpoint_network_list_cmd)
59 		return wmi_handle->ops->send_set_passpoint_network_list_cmd(wmi_handle,
60 			    req);
61 
62 	return QDF_STATUS_E_FAILURE;
63 }
64 
65 /** wmi_unified_set_epno_network_list_cmd() - set epno network list
66  * @wmi_hdl: wmi handle
67  * @req: epno config params request structure
68  *
69  * This function reads the incoming epno config request structure
70  * and constructs the WMI message to the firmware.
71  *
72  * Returns: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failures,
73  *          error number otherwise
74  */
75 QDF_STATUS wmi_unified_set_epno_network_list_cmd(void *wmi_hdl,
76 		struct wifi_enhanced_pno_params *req)
77 {
78 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
79 
80 	if (wmi_handle->ops->send_set_epno_network_list_cmd)
81 		return wmi_handle->ops->send_set_epno_network_list_cmd(wmi_handle,
82 			    req);
83 
84 	return QDF_STATUS_E_FAILURE;
85 }
86 
87 /**
88  * wmi_unified_extscan_get_capabilities_cmd() - extscan get capabilities
89  * @wmi_hdl: wmi handle
90  * @pgetcapab: get capabilities params
91  *
92  * This function send request to fw to get extscan capabilities.
93  *
94  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
95  */
96 QDF_STATUS wmi_unified_extscan_get_capabilities_cmd(void *wmi_hdl,
97 			  struct extscan_capabilities_params *pgetcapab)
98 {
99 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
100 
101 	if (wmi_handle->ops->send_extscan_get_capabilities_cmd)
102 		return wmi_handle->ops->send_extscan_get_capabilities_cmd(wmi_handle,
103 			    pgetcapab);
104 
105 	return QDF_STATUS_E_FAILURE;
106 }
107 
108 /**
109  * wmi_unified_extscan_get_cached_results_cmd() - extscan get cached results
110  * @wmi_hdl: wmi handle
111  * @pcached_results: cached results parameters
112  *
113  * This function send request to fw to get cached results.
114  *
115  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
116  */
117 QDF_STATUS wmi_unified_extscan_get_cached_results_cmd(void *wmi_hdl,
118 			  struct extscan_cached_result_params *pcached_results)
119 {
120 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
121 
122 	if (wmi_handle->ops->send_extscan_get_cached_results_cmd)
123 		return wmi_handle->ops->send_extscan_get_cached_results_cmd(wmi_handle,
124 			    pcached_results);
125 
126 	return QDF_STATUS_E_FAILURE;
127 }
128 
129 /**
130  * wmi_unified_extscan_stop_change_monitor_cmd() - send stop change monitor cmd
131  * @wmi_hdl: wmi handle
132  * @reset_req: Reset change request params
133  *
134  * This function sends stop change monitor request to fw.
135  *
136  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
137  */
138 QDF_STATUS wmi_unified_extscan_stop_change_monitor_cmd(void *wmi_hdl,
139 			  struct extscan_capabilities_reset_params *reset_req)
140 {
141 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
142 
143 	if (wmi_handle->ops->send_extscan_stop_change_monitor_cmd)
144 		return wmi_handle->ops->send_extscan_stop_change_monitor_cmd(wmi_handle,
145 			    reset_req);
146 
147 	return QDF_STATUS_E_FAILURE;
148 }
149 
150 
151 
152 /**
153  * wmi_unified_extscan_start_change_monitor_cmd() - start change monitor cmd
154  * @wmi_hdl: wmi handle
155  * @psigchange: change monitor request params
156  *
157  * This function sends start change monitor request to fw.
158  *
159  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
160  */
161 QDF_STATUS wmi_unified_extscan_start_change_monitor_cmd(void *wmi_hdl,
162 				   struct extscan_set_sig_changereq_params *
163 				   psigchange)
164 {
165 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
166 
167 	if (wmi_handle->ops->send_extscan_start_change_monitor_cmd)
168 		return wmi_handle->ops->send_extscan_start_change_monitor_cmd(wmi_handle,
169 			    psigchange);
170 
171 	return QDF_STATUS_E_FAILURE;
172 }
173 
174 /**
175  * wmi_unified_extscan_stop_hotlist_monitor_cmd() - stop hotlist monitor
176  * @wmi_hdl: wmi handle
177  * @photlist_reset: hotlist reset params
178  *
179  * This function configures hotlist monitor to stop in fw.
180  *
181  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
182  */
183 QDF_STATUS wmi_unified_extscan_stop_hotlist_monitor_cmd(void *wmi_hdl,
184 		  struct extscan_bssid_hotlist_reset_params *photlist_reset)
185 {
186 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
187 
188 	if (wmi_handle->ops->send_extscan_stop_hotlist_monitor_cmd)
189 		return wmi_handle->ops->send_extscan_stop_hotlist_monitor_cmd(wmi_handle,
190 			    photlist_reset);
191 
192 	return QDF_STATUS_E_FAILURE;
193 }
194 
195 QDF_STATUS wmi_unified_extscan_start_hotlist_monitor_cmd(void *wmi_hdl,
196 		struct extscan_bssid_hotlist_set_params *params)
197 {
198 	wmi_unified_t wmi_handle = wmi_hdl;
199 
200 	if (wmi_handle->ops->send_extscan_start_hotlist_monitor_cmd)
201 		return wmi_handle->ops->send_extscan_start_hotlist_monitor_cmd(wmi_handle,
202 									       params);
203 
204 	return QDF_STATUS_E_FAILURE;
205 }
206 
207 /**
208  * wmi_unified_stop_extscan_cmd() - stop extscan command to fw.
209  * @wmi_hdl: wmi handle
210  * @pstopcmd: stop scan command request params
211  *
212  * This function sends stop extscan request to fw.
213  *
214  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure.
215  */
216 QDF_STATUS wmi_unified_stop_extscan_cmd(void *wmi_hdl,
217 			  struct extscan_stop_req_params *pstopcmd)
218 {
219 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
220 
221 	if (wmi_handle->ops->send_stop_extscan_cmd)
222 		return wmi_handle->ops->send_stop_extscan_cmd(wmi_handle,
223 			    pstopcmd);
224 
225 	return QDF_STATUS_E_FAILURE;
226 }
227 
228 /**
229  * wmi_unified_start_extscan_cmd() - start extscan command to fw.
230  * @wmi_hdl: wmi handle
231  * @pstart: scan command request params
232  *
233  * This function sends start extscan request to fw.
234  *
235  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure.
236  */
237 QDF_STATUS wmi_unified_start_extscan_cmd(void *wmi_hdl,
238 			  struct wifi_scan_cmd_req_params *pstart)
239 {
240 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
241 
242 	if (wmi_handle->ops->send_start_extscan_cmd)
243 		return wmi_handle->ops->send_start_extscan_cmd(wmi_handle,
244 			    pstart);
245 
246 	return QDF_STATUS_E_FAILURE;
247 }
248