xref: /wlan-dirver/qca-wifi-host-cmn/wmi/src/wmi_unified_sta_api.c (revision 1397a33f48ea6455be40871470b286e535820eb8)
1 /*
2  * Copyright (c) 2013-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  * DOC: Implement API's specific to STA component.
20  */
21 #include <wmi.h>
22 #include "wmi_unified_priv.h"
23 #include "wmi_unified_sta_api.h"
24 
25 QDF_STATUS wmi_unified_set_sta_sa_query_param_cmd(void *wmi_hdl,
26 						  uint8_t vdev_id,
27 						  uint32_t max_retries,
28 						  uint32_t retry_interval)
29 {
30 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
31 
32 	if (wmi_handle->ops->send_set_sta_sa_query_param_cmd)
33 		return wmi_handle->ops->send_set_sta_sa_query_param_cmd(wmi_handle,
34 						vdev_id, max_retries,
35 						retry_interval);
36 
37 	return QDF_STATUS_E_FAILURE;
38 }
39 
40 QDF_STATUS wmi_unified_set_sta_keep_alive_cmd(void *wmi_hdl,
41 					      struct sta_params *params)
42 {
43 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
44 
45 	if (wmi_handle->ops->send_set_sta_keep_alive_cmd)
46 		return wmi_handle->ops->send_set_sta_keep_alive_cmd(wmi_handle,
47 								    params);
48 
49 	return QDF_STATUS_E_FAILURE;
50 }
51 
52 QDF_STATUS wmi_unified_vdev_set_gtx_cfg_cmd(void *wmi_hdl, uint32_t if_id,
53 			struct wmi_gtx_config *gtx_info)
54 {
55 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
56 
57 	if (wmi_handle->ops->send_vdev_set_gtx_cfg_cmd)
58 		return wmi_handle->ops->send_vdev_set_gtx_cfg_cmd(wmi_handle,
59 								  if_id,
60 								  gtx_info);
61 
62 	return QDF_STATUS_E_FAILURE;
63 }
64 
65 QDF_STATUS wmi_unified_process_dhcp_ind(void *wmi_hdl,
66 				wmi_peer_set_param_cmd_fixed_param *ta_dhcp_ind)
67 {
68 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
69 
70 	if (wmi_handle->ops->send_process_dhcp_ind_cmd)
71 		return wmi_handle->ops->send_process_dhcp_ind_cmd(wmi_handle,
72 								  ta_dhcp_ind);
73 
74 	return QDF_STATUS_E_FAILURE;
75 }
76 
77 QDF_STATUS wmi_unified_get_link_speed_cmd(void *wmi_hdl,
78 					  wmi_mac_addr peer_macaddr)
79 {
80 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
81 
82 	if (wmi_handle->ops->send_get_link_speed_cmd)
83 		return wmi_handle->ops->send_get_link_speed_cmd(wmi_handle,
84 								peer_macaddr);
85 
86 	return QDF_STATUS_E_FAILURE;
87 }
88 
89 QDF_STATUS wmi_unified_fw_profiling_data_cmd(void *wmi_hdl,
90 			uint32_t cmd, uint32_t value1, uint32_t value2)
91 {
92 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
93 
94 	if (wmi_handle->ops->send_fw_profiling_cmd)
95 		return wmi_handle->ops->send_fw_profiling_cmd(wmi_handle,
96 							      cmd,
97 							      value1,
98 							      value2);
99 
100 	return QDF_STATUS_E_FAILURE;
101 }
102 
103 QDF_STATUS wmi_unified_nat_keepalive_en_cmd(void *wmi_hdl, uint8_t vdev_id)
104 {
105 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
106 
107 	if (wmi_handle->ops->send_nat_keepalive_en_cmd)
108 		return wmi_handle->ops->send_nat_keepalive_en_cmd(wmi_handle,
109 								  vdev_id);
110 
111 	return QDF_STATUS_E_FAILURE;
112 }
113 
114 QDF_STATUS wmi_unified_wlm_latency_level_cmd(void *wmi_hdl,
115 					struct wlm_latency_level_param *param)
116 {
117 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
118 
119 	if (wmi_handle->ops->send_wlm_latency_level_cmd)
120 		return wmi_handle->ops->send_wlm_latency_level_cmd(wmi_handle,
121 								   param);
122 
123 	return QDF_STATUS_E_FAILURE;
124 }
125 
126 QDF_STATUS wmi_unified_process_set_ie_info_cmd(void *wmi_hdl,
127 				   struct vdev_ie_info_param *ie_info)
128 {
129 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
130 
131 	if (wmi_handle->ops->send_process_set_ie_info_cmd)
132 		return wmi_handle->ops->send_process_set_ie_info_cmd(wmi_handle,
133 								     ie_info);
134 
135 	return QDF_STATUS_E_FAILURE;
136 }
137 
138 QDF_STATUS wmi_unified_set_base_macaddr_indicate_cmd(void *wmi_hdl,
139 					 uint8_t *custom_addr)
140 {
141 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
142 
143 	if (wmi_handle->ops->send_set_base_macaddr_indicate_cmd)
144 		return wmi_handle->ops->send_set_base_macaddr_indicate_cmd(wmi_handle,
145 			    custom_addr);
146 
147 	return QDF_STATUS_E_FAILURE;
148 }
149 
150 #ifdef CONVERGED_TDLS_ENABLE
151 QDF_STATUS wmi_unified_set_tdls_offchan_mode_cmd(void *wmi_hdl,
152 			      struct tdls_channel_switch_params *chan_switch_params)
153 {
154 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
155 
156 	if (wmi_handle->ops->send_set_tdls_offchan_mode_cmd)
157 		return wmi_handle->ops->send_set_tdls_offchan_mode_cmd(wmi_handle,
158 			    chan_switch_params);
159 
160 	return QDF_STATUS_E_FAILURE;
161 }
162 
163 QDF_STATUS wmi_unified_update_fw_tdls_state_cmd(void *wmi_hdl,
164 						struct tdls_info *tdls_param,
165 						enum wmi_tdls_state tdls_state)
166 {
167 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
168 
169 	if (wmi_handle->ops->send_update_fw_tdls_state_cmd)
170 		return wmi_handle->ops->send_update_fw_tdls_state_cmd(
171 				wmi_handle, tdls_param, tdls_state);
172 
173 	return QDF_STATUS_E_FAILURE;
174 }
175 
176 QDF_STATUS wmi_unified_update_tdls_peer_state_cmd(void *wmi_hdl,
177 			       struct tdls_peer_state_params *peerStateParams,
178 				   uint32_t *ch_mhz)
179 {
180 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
181 
182 	if (wmi_handle->ops->send_update_tdls_peer_state_cmd)
183 		return wmi_handle->ops->send_update_tdls_peer_state_cmd(wmi_handle,
184 			    peerStateParams, ch_mhz);
185 
186 	return QDF_STATUS_E_FAILURE;
187 }
188 
189 QDF_STATUS wmi_extract_vdev_tdls_ev_param(void *wmi_hdl, void *evt_buf,
190 					  struct tdls_event_info *param)
191 {
192 	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
193 
194 	if (wmi_handle->ops->extract_vdev_tdls_ev_param)
195 		return wmi_handle->ops->extract_vdev_tdls_ev_param(wmi_handle,
196 				evt_buf, param);
197 
198 	return QDF_STATUS_E_FAILURE;
199 }
200 #endif /* CONVERGED_TDLS_ENABLE */
201 
202 #ifdef WLAN_FEATURE_DISA
203 QDF_STATUS wmi_unified_encrypt_decrypt_send_cmd(void *wmi_hdl,
204 				struct disa_encrypt_decrypt_req_params *params)
205 {
206 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
207 
208 	if (wmi_handle->ops->send_encrypt_decrypt_send_cmd)
209 		return wmi_handle->ops->send_encrypt_decrypt_send_cmd(
210 						wmi_handle,
211 						params);
212 	return QDF_STATUS_E_FAILURE;
213 }
214 
215 QDF_STATUS wmi_extract_encrypt_decrypt_resp_params(void *wmi_hdl,
216 			uint8_t *evt_buf,
217 			struct disa_encrypt_decrypt_resp_params *resp)
218 {
219 	struct wmi_unified *wmi_handle = (struct wmi_unified *)wmi_hdl;
220 
221 	if (wmi_handle->ops->extract_encrypt_decrypt_resp_event)
222 		return wmi_handle->ops->extract_encrypt_decrypt_resp_event(
223 				wmi_handle, evt_buf, resp);
224 
225 	return QDF_STATUS_E_FAILURE;
226 }
227 #endif /* WLAN_FEATURE_DISA */
228 
229 QDF_STATUS wmi_unified_send_sar_limit_cmd(void *wmi_hdl,
230 				struct sar_limit_cmd_params *params)
231 {
232 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
233 
234 	if (wmi_handle->ops->send_sar_limit_cmd)
235 		return wmi_handle->ops->send_sar_limit_cmd(
236 						wmi_handle,
237 						params);
238 	return QDF_STATUS_E_FAILURE;
239 }
240 
241 QDF_STATUS wmi_unified_get_sar_limit_cmd(void *wmi_hdl)
242 {
243 	wmi_unified_t wmi_handle = wmi_hdl;
244 
245 	if (wmi_handle->ops->get_sar_limit_cmd)
246 		return wmi_handle->ops->get_sar_limit_cmd(wmi_handle);
247 
248 	return QDF_STATUS_E_FAILURE;
249 }
250 
251 QDF_STATUS wmi_unified_extract_sar_limit_event(void *wmi_hdl,
252 					       uint8_t *evt_buf,
253 					       struct sar_limit_event *event)
254 {
255 	wmi_unified_t wmi_handle = wmi_hdl;
256 
257 	if (wmi_handle->ops->extract_sar_limit_event)
258 		return wmi_handle->ops->extract_sar_limit_event(wmi_handle,
259 								evt_buf,
260 								event);
261 
262 	return QDF_STATUS_E_FAILURE;
263 }
264 
265 QDF_STATUS wmi_unified_extract_sar2_result_event(void *handle,
266 						 uint8_t *event, uint32_t len)
267 {
268 	wmi_unified_t wmi_handle = handle;
269 
270 	if (wmi_handle->ops->extract_sar2_result_event)
271 		return wmi_handle->ops->extract_sar2_result_event(wmi_handle,
272 								  event,
273 								  len);
274 
275 	return QDF_STATUS_E_FAILURE;
276 }
277 
278 QDF_STATUS wmi_unified_set_del_pmkid_cache(void *wmi_hdl,
279 					struct wmi_unified_pmk_cache *req_buf)
280 {
281 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
282 
283 	if (wmi_handle->ops->send_set_del_pmkid_cache_cmd)
284 		return wmi_handle->ops->send_set_del_pmkid_cache_cmd(wmi_handle,
285 								     req_buf);
286 
287 	return QDF_STATUS_E_FAILURE;
288 }
289 
290 QDF_STATUS wmi_unified_del_ts_cmd(void *wmi_hdl, uint8_t vdev_id,
291 				  uint8_t ac)
292 {
293 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
294 
295 	if (wmi_handle->ops->send_del_ts_cmd)
296 		return wmi_handle->ops->send_del_ts_cmd(wmi_handle,
297 							vdev_id, ac);
298 
299 	return QDF_STATUS_E_FAILURE;
300 }
301 
302 QDF_STATUS wmi_unified_aggr_qos_cmd(void *wmi_hdl,
303 		      struct aggr_add_ts_param *aggr_qos_rsp_msg)
304 {
305 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
306 
307 	if (wmi_handle->ops->send_aggr_qos_cmd)
308 		return wmi_handle->ops->send_aggr_qos_cmd(wmi_handle,
309 							  aggr_qos_rsp_msg);
310 
311 	return QDF_STATUS_E_FAILURE;
312 }
313 
314 QDF_STATUS wmi_unified_add_ts_cmd(void *wmi_hdl,
315 		 struct add_ts_param *msg)
316 {
317 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
318 
319 	if (wmi_handle->ops->send_add_ts_cmd)
320 		return wmi_handle->ops->send_add_ts_cmd(wmi_handle,
321 							msg);
322 
323 	return QDF_STATUS_E_FAILURE;
324 }
325 
326 QDF_STATUS wmi_unified_process_add_periodic_tx_ptrn_cmd(
327 					wmi_unified_t wmi_handle,
328 					struct periodic_tx_pattern *pattern,
329 					uint8_t vdev_id)
330 {
331 	if (wmi_handle->ops->send_process_add_periodic_tx_ptrn_cmd)
332 		return wmi_handle->ops->send_process_add_periodic_tx_ptrn_cmd(
333 						wmi_handle, pattern, vdev_id);
334 
335 	return QDF_STATUS_E_FAILURE;
336 }
337 
338 QDF_STATUS wmi_unified_process_del_periodic_tx_ptrn_cmd(void *wmi_hdl,
339 						uint8_t vdev_id,
340 						uint8_t pattern_id)
341 {
342 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
343 
344 	if (wmi_handle->ops->send_process_del_periodic_tx_ptrn_cmd)
345 		return wmi_handle->ops->send_process_del_periodic_tx_ptrn_cmd(
346 				wmi_handle,
347 				vdev_id,
348 				pattern_id);
349 
350 	return QDF_STATUS_E_FAILURE;
351 }
352 
353 QDF_STATUS wmi_unified_set_auto_shutdown_timer_cmd(void *wmi_hdl,
354 						  uint32_t timer_val)
355 {
356 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
357 
358 	if (wmi_handle->ops->send_set_auto_shutdown_timer_cmd)
359 		return wmi_handle->ops->send_set_auto_shutdown_timer_cmd(
360 				wmi_handle,
361 				timer_val);
362 
363 	return QDF_STATUS_E_FAILURE;
364 }
365 
366 QDF_STATUS wmi_unified_set_led_flashing_cmd(void *wmi_hdl,
367 				struct flashing_req_params *flashing)
368 {
369 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
370 
371 	if (wmi_handle->ops->send_set_led_flashing_cmd)
372 		return wmi_handle->ops->send_set_led_flashing_cmd(wmi_handle,
373 								  flashing);
374 
375 	return QDF_STATUS_E_FAILURE;
376 }
377 
378 QDF_STATUS wmi_unified_process_ch_avoid_update_cmd(void *wmi_hdl)
379 {
380 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
381 
382 	if (wmi_handle->ops->send_process_ch_avoid_update_cmd)
383 		return wmi_handle->ops->send_process_ch_avoid_update_cmd(
384 				wmi_handle);
385 
386 	return QDF_STATUS_E_FAILURE;
387 }
388 
389 QDF_STATUS wmi_unified_pdev_set_pcl_cmd(void *wmi_hdl,
390 				struct wmi_pcl_chan_weights *msg)
391 {
392 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
393 
394 	if (wmi_handle->ops->send_pdev_set_pcl_cmd)
395 		return wmi_handle->ops->send_pdev_set_pcl_cmd(wmi_handle, msg);
396 
397 	return QDF_STATUS_E_FAILURE;
398 }
399 
400 QDF_STATUS wmi_unified_soc_set_hw_mode_cmd(void *wmi_hdl,
401 				uint32_t hw_mode_index)
402 {
403 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
404 
405 	if (wmi_handle->ops->send_pdev_set_hw_mode_cmd)
406 		return wmi_handle->ops->send_pdev_set_hw_mode_cmd(wmi_handle,
407 				  hw_mode_index);
408 
409 	return QDF_STATUS_E_FAILURE;
410 }
411 
412 #ifdef WLAN_POLICY_MGR_ENABLE
413 QDF_STATUS wmi_unified_pdev_set_dual_mac_config_cmd(void *wmi_hdl,
414 		struct policy_mgr_dual_mac_config *msg)
415 {
416 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
417 
418 	if (wmi_handle->ops->send_pdev_set_dual_mac_config_cmd)
419 		return wmi_handle->ops->send_pdev_set_dual_mac_config_cmd(
420 				wmi_handle,
421 				msg);
422 
423 	return QDF_STATUS_E_FAILURE;
424 }
425 #endif /* WLAN_POLICY_MGR_ENABLE */
426 
427 QDF_STATUS wmi_unified_send_adapt_dwelltime_params_cmd(void *wmi_hdl,
428 			struct wmi_adaptive_dwelltime_params *dwelltime_params)
429 {
430 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
431 
432 	if (wmi_handle->ops->send_adapt_dwelltime_params_cmd)
433 		return wmi_handle->ops->
434 			send_adapt_dwelltime_params_cmd(wmi_handle,
435 				  dwelltime_params);
436 
437 	return QDF_STATUS_E_FAILURE;
438 }
439 
440 QDF_STATUS wmi_unified_send_dbs_scan_sel_params_cmd(void *wmi_hdl,
441 			struct wmi_dbs_scan_sel_params *dbs_scan_params)
442 {
443 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
444 
445 	if (wmi_handle->ops->send_dbs_scan_sel_params_cmd)
446 		return wmi_handle->ops->
447 			send_dbs_scan_sel_params_cmd(wmi_handle,
448 						     dbs_scan_params);
449 
450 	return QDF_STATUS_E_FAILURE;
451 }
452 
453 QDF_STATUS wmi_unified_set_arp_stats_req(void *wmi_hdl,
454 					 struct set_arp_stats *req_buf)
455 {
456 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
457 
458 	if (wmi_handle->ops->send_set_arp_stats_req_cmd)
459 		return wmi_handle->ops->send_set_arp_stats_req_cmd(wmi_handle,
460 								   req_buf);
461 
462 	return QDF_STATUS_E_FAILURE;
463 }
464 
465 QDF_STATUS wmi_unified_get_arp_stats_req(void *wmi_hdl,
466 					 struct get_arp_stats *req_buf)
467 {
468 	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
469 
470 	if (wmi_handle->ops->send_get_arp_stats_req_cmd)
471 		return wmi_handle->ops->send_get_arp_stats_req_cmd(wmi_handle,
472 								   req_buf);
473 
474 	return QDF_STATUS_E_FAILURE;
475 }
476 
477 QDF_STATUS wmi_unified_peer_unmap_conf_send(void *wmi_hdl,
478 					    uint8_t vdev_id,
479 					    uint32_t peer_id_cnt,
480 					    uint16_t *peer_id_list)
481 {
482 	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
483 
484 	if (wmi_handle->ops->send_peer_unmap_conf_cmd)
485 		return wmi_handle->ops->send_peer_unmap_conf_cmd(wmi_handle,
486 				  vdev_id, peer_id_cnt, peer_id_list);
487 
488 	return QDF_STATUS_E_FAILURE;
489 }
490 
491