xref: /wlan-dirver/qca-wifi-host-cmn/wmi/src/wmi_unified_extscan_api.c (revision 92d87f51612f6c3b2285266215edee8911647c2f)
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_enhanched_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 /**
196  * wmi_unified_stop_extscan_cmd() - stop extscan command to fw.
197  * @wmi_hdl: wmi handle
198  * @pstopcmd: stop scan command request params
199  *
200  * This function sends stop extscan request to fw.
201  *
202  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure.
203  */
204 QDF_STATUS wmi_unified_stop_extscan_cmd(void *wmi_hdl,
205 			  struct extscan_stop_req_params *pstopcmd)
206 {
207 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
208 
209 	if (wmi_handle->ops->send_stop_extscan_cmd)
210 		return wmi_handle->ops->send_stop_extscan_cmd(wmi_handle,
211 			    pstopcmd);
212 
213 	return QDF_STATUS_E_FAILURE;
214 }
215 
216 /**
217  * wmi_unified_start_extscan_cmd() - start extscan command to fw.
218  * @wmi_hdl: wmi handle
219  * @pstart: scan command request params
220  *
221  * This function sends start extscan request to fw.
222  *
223  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure.
224  */
225 QDF_STATUS wmi_unified_start_extscan_cmd(void *wmi_hdl,
226 			  struct wifi_scan_cmd_req_params *pstart)
227 {
228 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
229 
230 	if (wmi_handle->ops->send_start_extscan_cmd)
231 		return wmi_handle->ops->send_start_extscan_cmd(wmi_handle,
232 			    pstart);
233 
234 	return QDF_STATUS_E_FAILURE;
235 }
236 
237 /**
238  * wmi_unified_get_buf_extscan_hotlist_cmd() - prepare hotlist command
239  * @wmi_hdl: wmi handle
240  * @photlist: hotlist command params
241  * @buf_len: buffer length
242  *
243  * This function fills individual elements for  hotlist request and
244  * TLV for bssid entries
245  *
246  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure.
247  */
248 QDF_STATUS wmi_unified_get_buf_extscan_hotlist_cmd(void *wmi_hdl,
249 				   struct ext_scan_setbssi_hotlist_params *
250 				   photlist, int *buf_len)
251 {
252 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
253 
254 	if (wmi_handle->ops->send_get_buf_extscan_hotlist_cmd)
255 		return wmi_handle->ops->send_get_buf_extscan_hotlist_cmd(wmi_handle,
256 				  photlist, buf_len);
257 
258 	return QDF_STATUS_E_FAILURE;
259 }
260