xref: /wlan-driver/qca-wifi-host-cmn/wmi/src/wmi_unified_sta_api.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 /**
20  * DOC: Implement API's specific to STA component.
21  */
22 #include <wmi.h>
23 #include "wmi_unified_priv.h"
24 #include "wmi_unified_sta_api.h"
25 
wmi_unified_set_sta_sa_query_param_cmd(wmi_unified_t wmi_handle,uint8_t vdev_id,uint32_t max_retries,uint32_t retry_interval)26 QDF_STATUS wmi_unified_set_sta_sa_query_param_cmd(wmi_unified_t wmi_handle,
27 						  uint8_t vdev_id,
28 						  uint32_t max_retries,
29 						  uint32_t retry_interval)
30 {
31 	if (wmi_handle->ops->send_set_sta_sa_query_param_cmd)
32 		return wmi_handle->ops->send_set_sta_sa_query_param_cmd(wmi_handle,
33 						vdev_id, max_retries,
34 						retry_interval);
35 
36 	return QDF_STATUS_E_FAILURE;
37 }
38 
39 QDF_STATUS
wmi_unified_set_sta_keep_alive_cmd(wmi_unified_t wmi_handle,struct sta_keep_alive_params * params)40 wmi_unified_set_sta_keep_alive_cmd(wmi_unified_t wmi_handle,
41 				   struct sta_keep_alive_params *params)
42 {
43 	if (wmi_handle->ops->send_set_sta_keep_alive_cmd)
44 		return wmi_handle->ops->send_set_sta_keep_alive_cmd(wmi_handle,
45 								    params);
46 
47 	return QDF_STATUS_E_FAILURE;
48 }
49 
50 QDF_STATUS
wmi_unified_vdev_set_gtx_cfg_cmd(wmi_unified_t wmi_handle,uint32_t if_id,struct wmi_gtx_config * gtx_info)51 wmi_unified_vdev_set_gtx_cfg_cmd(wmi_unified_t wmi_handle, uint32_t if_id,
52 				 struct wmi_gtx_config *gtx_info)
53 {
54 	if (wmi_handle->ops->send_vdev_set_gtx_cfg_cmd)
55 		return wmi_handle->ops->send_vdev_set_gtx_cfg_cmd(wmi_handle,
56 								  if_id,
57 								  gtx_info);
58 
59 	return QDF_STATUS_E_FAILURE;
60 }
61 
wmi_unified_process_dhcp_ind(wmi_unified_t wmi_handle,wmi_peer_set_param_cmd_fixed_param * ta_dhcp_ind)62 QDF_STATUS wmi_unified_process_dhcp_ind(
63 			wmi_unified_t wmi_handle,
64 			wmi_peer_set_param_cmd_fixed_param *ta_dhcp_ind)
65 {
66 	if (wmi_handle->ops->send_process_dhcp_ind_cmd)
67 		return wmi_handle->ops->send_process_dhcp_ind_cmd(wmi_handle,
68 								  ta_dhcp_ind);
69 
70 	return QDF_STATUS_E_FAILURE;
71 }
72 
wmi_unified_get_link_speed_cmd(wmi_unified_t wmi_handle,wmi_mac_addr peer_macaddr)73 QDF_STATUS wmi_unified_get_link_speed_cmd(wmi_unified_t wmi_handle,
74 					  wmi_mac_addr peer_macaddr)
75 {
76 	if (wmi_handle->ops->send_get_link_speed_cmd)
77 		return wmi_handle->ops->send_get_link_speed_cmd(wmi_handle,
78 								peer_macaddr);
79 
80 	return QDF_STATUS_E_FAILURE;
81 }
82 
wmi_unified_fw_profiling_data_cmd(wmi_unified_t wmi_handle,uint32_t cmd,uint32_t value1,uint32_t value2)83 QDF_STATUS wmi_unified_fw_profiling_data_cmd(wmi_unified_t wmi_handle,
84 					     uint32_t cmd,
85 					     uint32_t value1,
86 					     uint32_t value2)
87 {
88 	if (wmi_handle->ops->send_fw_profiling_cmd)
89 		return wmi_handle->ops->send_fw_profiling_cmd(wmi_handle,
90 							      cmd,
91 							      value1,
92 							      value2);
93 
94 	return QDF_STATUS_E_FAILURE;
95 }
96 
wmi_unified_nat_keepalive_en_cmd(wmi_unified_t wmi_handle,uint8_t vdev_id)97 QDF_STATUS wmi_unified_nat_keepalive_en_cmd(wmi_unified_t wmi_handle,
98 					    uint8_t vdev_id)
99 {
100 	if (wmi_handle->ops->send_nat_keepalive_en_cmd)
101 		return wmi_handle->ops->send_nat_keepalive_en_cmd(wmi_handle,
102 								  vdev_id);
103 
104 	return QDF_STATUS_E_FAILURE;
105 }
106 
107 QDF_STATUS
wmi_unified_wlm_latency_level_cmd(wmi_unified_t wmi_handle,struct wlm_latency_level_param * param)108 wmi_unified_wlm_latency_level_cmd(wmi_unified_t wmi_handle,
109 				  struct wlm_latency_level_param *param)
110 {
111 	if (wmi_handle->ops->send_wlm_latency_level_cmd)
112 		return wmi_handle->ops->send_wlm_latency_level_cmd(wmi_handle,
113 								   param);
114 
115 	return QDF_STATUS_E_FAILURE;
116 }
117 
118 QDF_STATUS
wmi_unified_process_set_ie_info_cmd(wmi_unified_t wmi_handle,struct vdev_ie_info_param * ie_info)119 wmi_unified_process_set_ie_info_cmd(wmi_unified_t wmi_handle,
120 				    struct vdev_ie_info_param *ie_info)
121 {
122 	if (wmi_handle->ops->send_process_set_ie_info_cmd)
123 		return wmi_handle->ops->send_process_set_ie_info_cmd(wmi_handle,
124 								     ie_info);
125 
126 	return QDF_STATUS_E_FAILURE;
127 }
128 
wmi_unified_set_base_macaddr_indicate_cmd(wmi_unified_t wmi_handle,uint8_t * custom_addr)129 QDF_STATUS wmi_unified_set_base_macaddr_indicate_cmd(wmi_unified_t wmi_handle,
130 						     uint8_t *custom_addr)
131 {
132 	if (wmi_handle->ops->send_set_base_macaddr_indicate_cmd)
133 		return wmi_handle->ops->send_set_base_macaddr_indicate_cmd(
134 						wmi_handle, custom_addr);
135 
136 	return QDF_STATUS_E_FAILURE;
137 }
138 
139 #ifdef FEATURE_WLAN_TDLS
wmi_unified_set_tdls_offchan_mode_cmd(wmi_unified_t wmi_handle,struct tdls_channel_switch_params * chan_switch_params)140 QDF_STATUS wmi_unified_set_tdls_offchan_mode_cmd(
141 			wmi_unified_t wmi_handle,
142 			struct tdls_channel_switch_params *chan_switch_params)
143 {
144 	if (wmi_handle->ops->send_set_tdls_offchan_mode_cmd)
145 		return wmi_handle->ops->send_set_tdls_offchan_mode_cmd(
146 						wmi_handle, chan_switch_params);
147 
148 	return QDF_STATUS_E_FAILURE;
149 }
150 
wmi_unified_update_fw_tdls_state_cmd(wmi_unified_t wmi_handle,struct tdls_info * tdls_param,enum wmi_tdls_state tdls_state)151 QDF_STATUS wmi_unified_update_fw_tdls_state_cmd(wmi_unified_t wmi_handle,
152 						struct tdls_info *tdls_param,
153 						enum wmi_tdls_state tdls_state)
154 {
155 	if (wmi_handle->ops->send_update_fw_tdls_state_cmd)
156 		return wmi_handle->ops->send_update_fw_tdls_state_cmd(
157 				wmi_handle, tdls_param, tdls_state);
158 
159 	return QDF_STATUS_E_FAILURE;
160 }
161 
wmi_unified_update_tdls_peer_state_cmd(wmi_unified_t wmi_handle,struct tdls_peer_update_state * peer_state,uint32_t * ch_mhz)162 QDF_STATUS wmi_unified_update_tdls_peer_state_cmd(wmi_unified_t wmi_handle,
163 				struct tdls_peer_update_state *peer_state,
164 				uint32_t *ch_mhz)
165 {
166 	if (wmi_handle->ops->send_update_tdls_peer_state_cmd)
167 		return wmi_handle->ops->send_update_tdls_peer_state_cmd(wmi_handle,
168 			    peer_state, ch_mhz);
169 
170 	return QDF_STATUS_E_FAILURE;
171 }
172 
wmi_extract_vdev_tdls_ev_param(wmi_unified_t wmi_handle,void * evt_buf,struct tdls_event_info * param)173 QDF_STATUS wmi_extract_vdev_tdls_ev_param(wmi_unified_t wmi_handle,
174 					  void *evt_buf,
175 					  struct tdls_event_info *param)
176 {
177 	if (wmi_handle->ops->extract_vdev_tdls_ev_param)
178 		return wmi_handle->ops->extract_vdev_tdls_ev_param(wmi_handle,
179 				evt_buf, param);
180 
181 	return QDF_STATUS_E_FAILURE;
182 }
183 #endif /* FEATURE_WLAN_TDLS */
184 
185 #if defined(WLAN_FEATURE_ROAM_OFFLOAD) && defined(FEATURE_DENYLIST_MGR)
186 QDF_STATUS
wmi_unified_send_reject_ap_list(struct wmi_unified * wmi_handle,struct reject_ap_params * reject_params)187 wmi_unified_send_reject_ap_list(struct wmi_unified *wmi_handle,
188 				struct reject_ap_params *reject_params)
189 {
190 	if (wmi_handle->ops->send_reject_ap_list_cmd)
191 		return wmi_handle->ops->send_reject_ap_list_cmd(wmi_handle,
192 								reject_params);
193 
194 	return QDF_STATUS_E_FAILURE;
195 }
196 #endif
197 
wmi_unified_send_sar_limit_cmd(wmi_unified_t wmi_handle,struct sar_limit_cmd_params * params)198 QDF_STATUS wmi_unified_send_sar_limit_cmd(wmi_unified_t wmi_handle,
199 					  struct sar_limit_cmd_params *params)
200 {
201 	if (wmi_handle->ops->send_sar_limit_cmd)
202 		return wmi_handle->ops->send_sar_limit_cmd(
203 						wmi_handle,
204 						params);
205 	return QDF_STATUS_E_FAILURE;
206 }
207 
wmi_unified_get_sar_limit_cmd(wmi_unified_t wmi_handle)208 QDF_STATUS wmi_unified_get_sar_limit_cmd(wmi_unified_t wmi_handle)
209 {
210 	if (wmi_handle->ops->get_sar_limit_cmd)
211 		return wmi_handle->ops->get_sar_limit_cmd(wmi_handle);
212 
213 	return QDF_STATUS_E_FAILURE;
214 }
215 
wmi_unified_extract_sar_limit_event(wmi_unified_t wmi_handle,uint8_t * evt_buf,struct sar_limit_event * event)216 QDF_STATUS wmi_unified_extract_sar_limit_event(wmi_unified_t wmi_handle,
217 					       uint8_t *evt_buf,
218 					       struct sar_limit_event *event)
219 {
220 	if (wmi_handle->ops->extract_sar_limit_event)
221 		return wmi_handle->ops->extract_sar_limit_event(wmi_handle,
222 								evt_buf,
223 								event);
224 
225 	return QDF_STATUS_E_FAILURE;
226 }
227 
wmi_unified_extract_sar2_result_event(void * handle,uint8_t * event,uint32_t len)228 QDF_STATUS wmi_unified_extract_sar2_result_event(void *handle,
229 						 uint8_t *event, uint32_t len)
230 {
231 	wmi_unified_t wmi_handle = handle;
232 
233 	if (wmi_handle->ops->extract_sar2_result_event)
234 		return wmi_handle->ops->extract_sar2_result_event(wmi_handle,
235 								  event,
236 								  len);
237 
238 	return QDF_STATUS_E_FAILURE;
239 }
240 
241 QDF_STATUS
wmi_unified_set_del_pmkid_cache(wmi_unified_t wmi_handle,struct wmi_unified_pmk_cache * req_buf)242 wmi_unified_set_del_pmkid_cache(wmi_unified_t wmi_handle,
243 				struct wmi_unified_pmk_cache *req_buf)
244 {
245 	if (wmi_handle->ops->send_set_del_pmkid_cache_cmd)
246 		return wmi_handle->ops->send_set_del_pmkid_cache_cmd(wmi_handle,
247 								     req_buf);
248 
249 	return QDF_STATUS_E_FAILURE;
250 }
251 
wmi_unified_del_ts_cmd(wmi_unified_t wmi_handle,uint8_t vdev_id,uint8_t ac)252 QDF_STATUS wmi_unified_del_ts_cmd(wmi_unified_t wmi_handle, uint8_t vdev_id,
253 				  uint8_t ac)
254 {
255 	if (wmi_handle->ops->send_del_ts_cmd)
256 		return wmi_handle->ops->send_del_ts_cmd(wmi_handle,
257 							vdev_id, ac);
258 
259 	return QDF_STATUS_E_FAILURE;
260 }
261 
wmi_unified_aggr_qos_cmd(wmi_unified_t wmi_handle,struct aggr_add_ts_param * aggr_qos_rsp_msg)262 QDF_STATUS wmi_unified_aggr_qos_cmd(
263 		wmi_unified_t wmi_handle,
264 		struct aggr_add_ts_param *aggr_qos_rsp_msg)
265 {
266 	if (wmi_handle->ops->send_aggr_qos_cmd)
267 		return wmi_handle->ops->send_aggr_qos_cmd(wmi_handle,
268 							  aggr_qos_rsp_msg);
269 
270 	return QDF_STATUS_E_FAILURE;
271 }
272 
wmi_unified_add_ts_cmd(wmi_unified_t wmi_handle,struct add_ts_param * msg)273 QDF_STATUS wmi_unified_add_ts_cmd(wmi_unified_t wmi_handle,
274 				  struct add_ts_param *msg)
275 {
276 	if (wmi_handle->ops->send_add_ts_cmd)
277 		return wmi_handle->ops->send_add_ts_cmd(wmi_handle,
278 							msg);
279 
280 	return QDF_STATUS_E_FAILURE;
281 }
282 
wmi_unified_process_add_periodic_tx_ptrn_cmd(wmi_unified_t wmi_handle,struct periodic_tx_pattern * pattern,uint8_t vdev_id)283 QDF_STATUS wmi_unified_process_add_periodic_tx_ptrn_cmd(
284 					wmi_unified_t wmi_handle,
285 					struct periodic_tx_pattern *pattern,
286 					uint8_t vdev_id)
287 {
288 	if (wmi_handle->ops->send_process_add_periodic_tx_ptrn_cmd)
289 		return wmi_handle->ops->send_process_add_periodic_tx_ptrn_cmd(
290 						wmi_handle, pattern, vdev_id);
291 
292 	return QDF_STATUS_E_FAILURE;
293 }
294 
295 QDF_STATUS
wmi_unified_process_del_periodic_tx_ptrn_cmd(wmi_unified_t wmi_handle,uint8_t vdev_id,uint8_t pattern_id)296 wmi_unified_process_del_periodic_tx_ptrn_cmd(wmi_unified_t wmi_handle,
297 					     uint8_t vdev_id,
298 					     uint8_t pattern_id)
299 {
300 	if (wmi_handle->ops->send_process_del_periodic_tx_ptrn_cmd)
301 		return wmi_handle->ops->send_process_del_periodic_tx_ptrn_cmd(
302 				wmi_handle,
303 				vdev_id,
304 				pattern_id);
305 
306 	return QDF_STATUS_E_FAILURE;
307 }
308 
wmi_unified_set_auto_shutdown_timer_cmd(wmi_unified_t wmi_handle,uint32_t timer_val)309 QDF_STATUS wmi_unified_set_auto_shutdown_timer_cmd(wmi_unified_t wmi_handle,
310 						   uint32_t timer_val)
311 {
312 	if (wmi_handle->ops->send_set_auto_shutdown_timer_cmd)
313 		return wmi_handle->ops->send_set_auto_shutdown_timer_cmd(
314 				wmi_handle,
315 				timer_val);
316 
317 	return QDF_STATUS_E_FAILURE;
318 }
319 
320 QDF_STATUS
wmi_unified_set_led_flashing_cmd(wmi_unified_t wmi_handle,struct flashing_req_params * flashing)321 wmi_unified_set_led_flashing_cmd(wmi_unified_t wmi_handle,
322 				 struct flashing_req_params *flashing)
323 {
324 	if (wmi_handle->ops->send_set_led_flashing_cmd)
325 		return wmi_handle->ops->send_set_led_flashing_cmd(wmi_handle,
326 								  flashing);
327 
328 	return QDF_STATUS_E_FAILURE;
329 }
330 
wmi_unified_process_ch_avoid_update_cmd(wmi_unified_t wmi_handle)331 QDF_STATUS wmi_unified_process_ch_avoid_update_cmd(wmi_unified_t wmi_handle)
332 {
333 	if (wmi_handle->ops->send_process_ch_avoid_update_cmd)
334 		return wmi_handle->ops->send_process_ch_avoid_update_cmd(
335 				wmi_handle);
336 
337 	return QDF_STATUS_E_FAILURE;
338 }
339 
wmi_unified_pdev_set_pcl_cmd(wmi_unified_t wmi_handle,struct wmi_pcl_chan_weights * msg)340 QDF_STATUS wmi_unified_pdev_set_pcl_cmd(wmi_unified_t wmi_handle,
341 					struct wmi_pcl_chan_weights *msg)
342 {
343 	if (wmi_handle->ops->send_pdev_set_pcl_cmd)
344 		return wmi_handle->ops->send_pdev_set_pcl_cmd(wmi_handle, msg);
345 
346 	return QDF_STATUS_E_FAILURE;
347 }
348 
349 #ifdef WLAN_POLICY_MGR_ENABLE
wmi_unified_pdev_set_dual_mac_config_cmd(wmi_unified_t wmi_handle,struct policy_mgr_dual_mac_config * msg)350 QDF_STATUS wmi_unified_pdev_set_dual_mac_config_cmd(
351 		wmi_unified_t wmi_handle,
352 		struct policy_mgr_dual_mac_config *msg)
353 {
354 	if (wmi_handle->ops->send_pdev_set_dual_mac_config_cmd)
355 		return wmi_handle->ops->send_pdev_set_dual_mac_config_cmd(
356 				wmi_handle,
357 				msg);
358 
359 	return QDF_STATUS_E_FAILURE;
360 }
361 #endif /* WLAN_POLICY_MGR_ENABLE */
362 
wmi_unified_send_adapt_dwelltime_params_cmd(wmi_unified_t wmi_handle,struct wmi_adaptive_dwelltime_params * dwelltime_params)363 QDF_STATUS wmi_unified_send_adapt_dwelltime_params_cmd(
364 			wmi_unified_t wmi_handle,
365 			struct wmi_adaptive_dwelltime_params *dwelltime_params)
366 {
367 	if (wmi_handle->ops->send_adapt_dwelltime_params_cmd)
368 		return wmi_handle->ops->
369 			send_adapt_dwelltime_params_cmd(wmi_handle,
370 				  dwelltime_params);
371 
372 	return QDF_STATUS_E_FAILURE;
373 }
374 
wmi_unified_send_dbs_scan_sel_params_cmd(wmi_unified_t wmi_handle,struct wmi_dbs_scan_sel_params * dbs_scan_params)375 QDF_STATUS wmi_unified_send_dbs_scan_sel_params_cmd(
376 			wmi_unified_t wmi_handle,
377 			struct wmi_dbs_scan_sel_params *dbs_scan_params)
378 {
379 	if (wmi_handle->ops->send_dbs_scan_sel_params_cmd)
380 		return wmi_handle->ops->
381 			send_dbs_scan_sel_params_cmd(wmi_handle,
382 						     dbs_scan_params);
383 
384 	return QDF_STATUS_E_FAILURE;
385 }
386 
wmi_unified_set_arp_stats_req(wmi_unified_t wmi_handle,struct set_arp_stats * req_buf)387 QDF_STATUS wmi_unified_set_arp_stats_req(wmi_unified_t wmi_handle,
388 					 struct set_arp_stats *req_buf)
389 {
390 	if (wmi_handle->ops->send_set_arp_stats_req_cmd)
391 		return wmi_handle->ops->send_set_arp_stats_req_cmd(wmi_handle,
392 								   req_buf);
393 
394 	return QDF_STATUS_E_FAILURE;
395 }
396 
wmi_unified_get_arp_stats_req(wmi_unified_t wmi_handle,struct get_arp_stats * req_buf)397 QDF_STATUS wmi_unified_get_arp_stats_req(wmi_unified_t wmi_handle,
398 					 struct get_arp_stats *req_buf)
399 {
400 	if (wmi_handle->ops->send_get_arp_stats_req_cmd)
401 		return wmi_handle->ops->send_get_arp_stats_req_cmd(wmi_handle,
402 								   req_buf);
403 
404 	return QDF_STATUS_E_FAILURE;
405 }
406 
wmi_unified_peer_unmap_conf_send(wmi_unified_t wmi_handle,uint8_t vdev_id,uint32_t peer_id_cnt,uint16_t * peer_id_list)407 QDF_STATUS wmi_unified_peer_unmap_conf_send(wmi_unified_t wmi_handle,
408 					    uint8_t vdev_id,
409 					    uint32_t peer_id_cnt,
410 					    uint16_t *peer_id_list)
411 {
412 	if (wmi_handle->ops->send_peer_unmap_conf_cmd)
413 		return wmi_handle->ops->send_peer_unmap_conf_cmd(wmi_handle,
414 				  vdev_id, peer_id_cnt, peer_id_list);
415 
416 	return QDF_STATUS_E_FAILURE;
417 }
418 
419