1 /*
2  * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2023 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 /**
21  * DOC: Implement API's specific to STA component.
22  */
23 
24 #ifndef _WMI_UNIFIED_STA_API_H_
25 #define _WMI_UNIFIED_STA_API_H_
26 
27 #include "wlan_disa_public_struct.h"
28 #include "wlan_tdls_public_structs.h"
29 #include "wlan_policy_mgr_public_struct.h"
30 #include "wmi_unified_sta_param.h"
31 
32 struct policy_mgr_dual_mac_config;
33 
34 /**
35  * wmi_unified_set_sta_sa_query_param_cmd() - set sta sa query parameters
36  * @wmi_handle: wmi handle
37  * @vdev_id: vdev id
38  * @max_retries: max retries
39  * @retry_interval: retry interval
40  * This function sets sta query related parameters in fw.
41  *
42  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
43  */
44 QDF_STATUS wmi_unified_set_sta_sa_query_param_cmd(wmi_unified_t wmi_handle,
45 						  uint8_t vdev_id,
46 						  uint32_t max_retries,
47 						  uint32_t retry_interval);
48 
49 /**
50  * wmi_unified_set_sta_keep_alive_cmd() - set sta keep alive parameters
51  * @wmi_handle: wmi handle
52  * @params: sta keep alive parameter
53  *
54  * This function sets keep alive related parameters in fw.
55  *
56  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
57  */
58 QDF_STATUS
59 wmi_unified_set_sta_keep_alive_cmd(wmi_unified_t wmi_handle,
60 				   struct sta_keep_alive_params *params);
61 
62 /**
63  * wmi_unified_vdev_set_gtx_cfg_cmd() - set GTX params
64  * @wmi_handle: wmi handle
65  * @if_id: vdev id
66  * @gtx_info: GTX config params
67  *
68  * This function set GTX related params in firmware.
69  *
70  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
71  */
72 QDF_STATUS
73 wmi_unified_vdev_set_gtx_cfg_cmd(wmi_unified_t wmi_handle, uint32_t if_id,
74 				 struct wmi_gtx_config *gtx_info);
75 
76 #if defined(WLAN_FEATURE_ROAM_OFFLOAD) && defined(FEATURE_DENYLIST_MGR)
77 /**
78  * wmi_unified_send_reject_ap_list() - send the reject ap list maintained by
79  * DLM to FW for roaming cases.
80  * @wmi_handle: wmi handle
81  * @reject_params: This contains the reject ap list, and the num of BSSIDs.
82  *
83  * Return: QDF_STATUS_SUCCESS for success or error code
84  */
85 QDF_STATUS
86 wmi_unified_send_reject_ap_list(struct wmi_unified *wmi_handle,
87 				struct reject_ap_params *reject_params);
88 #endif
89 
90 /**
91  * wmi_unified_process_dhcp_ind() - process dhcp indication from SME
92  * @wmi_handle: wmi handle
93  * @ta_dhcp_ind: DHCP indication parameter
94  *
95  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
96  */
97 QDF_STATUS wmi_unified_process_dhcp_ind(
98 			wmi_unified_t wmi_handle,
99 			wmi_peer_set_param_cmd_fixed_param *ta_dhcp_ind);
100 
101 /**
102  * wmi_unified_get_link_speed_cmd() -send command to get linkspeed
103  * @wmi_handle: wmi handle
104  * @peer_macaddr: peer MAC address
105  *
106  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
107  */
108 QDF_STATUS wmi_unified_get_link_speed_cmd(wmi_unified_t wmi_handle,
109 					  wmi_mac_addr peer_macaddr);
110 
111 /**
112  * wmi_unified_fw_profiling_data_cmd() - send FW profiling cmd to WLAN FW
113  * @wmi_handle: wmi handle
114  * @cmd: Profiling command index
115  * @value1: parameter1 value
116  * @value2: parameter2 value
117  *
118  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
119  */
120 QDF_STATUS wmi_unified_fw_profiling_data_cmd(wmi_unified_t wmi_handle,
121 					     uint32_t cmd,
122 					     uint32_t value1,
123 					     uint32_t value2);
124 
125 /**
126  * wmi_unified_nat_keepalive_en_cmd() - enable NAT keepalive filter
127  * @wmi_handle: wmi handle
128  * @vdev_id: vdev id
129  *
130  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
131  */
132 QDF_STATUS wmi_unified_nat_keepalive_en_cmd(wmi_unified_t wmi_handle,
133 					    uint8_t vdev_id);
134 
135 /**
136  * wmi_unified_wlm_latency_level_cmd() - set latency level
137  * @wmi_handle: wmi handle
138  * @param: WLM parameters
139  *
140  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
141  */
142 QDF_STATUS
143 wmi_unified_wlm_latency_level_cmd(wmi_unified_t wmi_handle,
144 				  struct wlm_latency_level_param *param);
145 
146 /**
147  * wmi_unified_process_set_ie_info_cmd() - Function to send IE info to firmware
148  * @wmi_handle:    Pointer to WMI handle
149  * @ie_info:       Pointer for IE information
150  *
151  * This function sends IE information to firmware
152  *
153  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
154  */
155 QDF_STATUS
156 wmi_unified_process_set_ie_info_cmd(wmi_unified_t wmi_handle,
157 				    struct vdev_ie_info_param *ie_info);
158 
159 /**
160  * wmi_unified_set_base_macaddr_indicate_cmd() - set base mac address in fw
161  * @wmi_handle: wmi handle
162  * @custom_addr: base mac address
163  *
164  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
165  */
166 QDF_STATUS wmi_unified_set_base_macaddr_indicate_cmd(wmi_unified_t wmi_handle,
167 						     uint8_t *custom_addr);
168 
169 #ifdef FEATURE_WLAN_TDLS
170 /**
171  * wmi_unified_set_tdls_offchan_mode_cmd() - set tdls off channel mode
172  * @wmi_handle: wmi handle
173  * @chan_switch_params: Pointer to tdls channel switch parameter structure
174  *
175  * This function sets tdls off channel mode
176  *
177  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failures;
178  *         Negative errno otherwise
179  */
180 QDF_STATUS wmi_unified_set_tdls_offchan_mode_cmd(
181 		wmi_unified_t wmi_handle,
182 		struct tdls_channel_switch_params *chan_switch_params);
183 
184 /**
185  * wmi_unified_update_fw_tdls_state_cmd() - send enable/disable tdls for a vdev
186  * @wmi_handle: wmi handle
187  * @tdls_param: TDLS params
188  * @tdls_state: TDLS state
189  *
190  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
191  */
192 QDF_STATUS wmi_unified_update_fw_tdls_state_cmd(wmi_unified_t wmi_handle,
193 						struct tdls_info *tdls_param,
194 						enum wmi_tdls_state tdls_state);
195 
196 /**
197  * wmi_unified_update_tdls_peer_state_cmd() - update TDLS peer state
198  * @wmi_handle: wmi handle
199  * @peer_state: TDLS peer state params
200  * @ch_mhz: peer channel list
201  *
202  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
203  */
204 QDF_STATUS wmi_unified_update_tdls_peer_state_cmd(wmi_unified_t wmi_handle,
205 				struct tdls_peer_update_state *peer_state,
206 				uint32_t *ch_mhz);
207 
208 /**
209  * wmi_extract_vdev_tdls_ev_param - extract vdev tdls param from event
210  * @wmi_handle: wmi handle
211  * @evt_buf: pointer to event buffer
212  * @param: Pointer to hold vdev tdls param
213  *
214  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
215  */
216 QDF_STATUS wmi_extract_vdev_tdls_ev_param(wmi_unified_t wmi_handle,
217 					  void *evt_buf,
218 					  struct tdls_event_info *param);
219 #endif /* FEATURE_WLAN_TDLS */
220 
221 /**
222  * wmi_unified_send_sar_limit_cmd() - send sar limit cmd to fw
223  * @wmi_handle: wmi handle
224  * @params: sar limit command params
225  *
226  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
227  */
228 QDF_STATUS wmi_unified_send_sar_limit_cmd(wmi_unified_t wmi_handle,
229 					  struct sar_limit_cmd_params *params);
230 
231 /**
232  * wmi_unified_get_sar_limit_cmd() - request current SAR limits from FW
233  * @wmi_handle: wmi handle
234  *
235  * Return: QDF_STATUS_SUCCESS for success or error code
236  */
237 QDF_STATUS wmi_unified_get_sar_limit_cmd(wmi_unified_t wmi_handle);
238 
239 /**
240  * wmi_unified_extract_sar_limit_event() - extract SAR limits from FW event
241  * @wmi_handle: wmi handle
242  * @evt_buf: event buffer received from firmware
243  * @event: SAR limit event which is to be populated by data extracted from
244  *         the @evt_buf buffer
245  *
246  * Return: QDF_STATUS_SUCCESS for success or error code
247  */
248 QDF_STATUS wmi_unified_extract_sar_limit_event(wmi_unified_t wmi_handle,
249 					       uint8_t *evt_buf,
250 					       struct sar_limit_event *event);
251 
252 /**
253  * wmi_unified_extract_sar2_result_event() - extract SAR limits from FW event
254  * @handle: wmi handle
255  * @event: event buffer received from firmware
256  * @len: length of the event buffer
257  *
258  * Return: QDF_STATUS_SUCCESS for success or error code
259  */
260 QDF_STATUS wmi_unified_extract_sar2_result_event(void *handle,
261 						 uint8_t *event, uint32_t len);
262 
263 /**
264  * wmi_unified_set_del_pmkid_cache() - set delete PMKID
265  * @wmi_handle: wmi handle
266  * @pmksa: pointer to pmk cache entry
267  *
268  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
269  */
270 QDF_STATUS
271 wmi_unified_set_del_pmkid_cache(wmi_unified_t wmi_handle,
272 				struct wmi_unified_pmk_cache *pmksa);
273 
274 /**
275  * wmi_unified_del_ts_cmd() - send DELTS request to fw
276  * @wmi_handle: wmi handle
277  * @vdev_id: vdev id
278  * @ac: ac param
279  *
280  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
281  */
282 QDF_STATUS wmi_unified_del_ts_cmd(wmi_unified_t wmi_handle, uint8_t vdev_id,
283 				  uint8_t ac);
284 
285 /**
286  * wmi_unified_aggr_qos_cmd() - send aggr qos request to fw
287  * @wmi_handle: handle to wmi
288  * @aggr_qos_rsp_msg: combined struct for all ADD_TS requests.
289  *
290  * A function to handle WMI_AGGR_QOS_REQ. This will send out
291  * ADD_TS requests to firmware in loop for all the ACs with
292  * active flow.
293  *
294  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
295  */
296 QDF_STATUS wmi_unified_aggr_qos_cmd(
297 		wmi_unified_t wmi_handle,
298 		struct aggr_add_ts_param *aggr_qos_rsp_msg);
299 
300 /**
301  * wmi_unified_add_ts_cmd() - send ADDTS request to fw
302  * @wmi_handle: wmi handle
303  * @msg: ADDTS params
304  *
305  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
306  */
307 QDF_STATUS wmi_unified_add_ts_cmd(wmi_unified_t wmi_handle,
308 				  struct add_ts_param *msg);
309 
310 /**
311  * wmi_unified_process_add_periodic_tx_ptrn_cmd() - add periodic tx pattern
312  * @wmi_handle: wmi handle
313  * @pattern: tx pattern parameters
314  * @vdev_id: vdev id
315  *
316  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
317  */
318 QDF_STATUS wmi_unified_process_add_periodic_tx_ptrn_cmd(
319 					wmi_unified_t wmi_handle,
320 					struct periodic_tx_pattern *pattern,
321 					uint8_t vdev_id);
322 
323 /**
324  * wmi_unified_process_del_periodic_tx_ptrn_cmd() - del periodic tx ptrn
325  * @wmi_handle: wmi handle
326  * @vdev_id: vdev id
327  * @pattern_id: pattern id
328  *
329  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
330  */
331 QDF_STATUS
332 wmi_unified_process_del_periodic_tx_ptrn_cmd(wmi_unified_t wmi_handle,
333 					     uint8_t vdev_id,
334 					     uint8_t pattern_id);
335 
336 /**
337  * wmi_unified_set_auto_shutdown_timer_cmd() - sets auto shutdown
338  *					       timer in firmware
339  * @wmi_handle: wmi handle
340  * @timer_val: auto shutdown timer value
341  *
342  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
343  */
344 QDF_STATUS wmi_unified_set_auto_shutdown_timer_cmd(wmi_unified_t wmi_handle,
345 						   uint32_t timer_val);
346 
347 /**
348  * wmi_unified_set_led_flashing_cmd() - set led flashing in fw
349  * @wmi_handle: wmi handle
350  * @flashing: flashing request
351  *
352  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
353  */
354 QDF_STATUS
355 wmi_unified_set_led_flashing_cmd(wmi_unified_t wmi_handle,
356 				 struct flashing_req_params *flashing);
357 
358 /**
359  * wmi_unified_process_ch_avoid_update_cmd() - handles channel avoid
360  *					       update request
361  * @wmi_handle: wmi handle
362  *
363  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
364  */
365 QDF_STATUS wmi_unified_process_ch_avoid_update_cmd(wmi_unified_t wmi_handle);
366 
367 /**
368  * wmi_unified_pdev_set_pcl_cmd() - Send WMI_SOC_SET_PCL_CMDID to FW
369  * @wmi_handle: wmi handle
370  * @msg: PCL structure containing the PCL and the number of channels
371  *
372  * WMI_SOC_SET_PCL_CMDID provides a Preferred Channel List (PCL) to the WLAN
373  * firmware. The DBS Manager is the consumer of this information in the WLAN
374  * firmware. The channel list will be used when a Virtual DEVice (VDEV) needs
375  * to migrate to a new channel without host driver involvement. An example of
376  * this behavior is Legacy Fast Roaming (LFR 3.0). Generally, the host will
377  * manage the channel selection without firmware involvement.
378  *
379  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
380  */
381 QDF_STATUS wmi_unified_pdev_set_pcl_cmd(wmi_unified_t wmi_handle,
382 					struct wmi_pcl_chan_weights *msg);
383 
384 #ifdef WLAN_POLICY_MGR_ENABLE
385 /**
386  * wmi_unified_pdev_set_dual_mac_config_cmd() - Set dual mac config to FW
387  * @wmi_handle: wmi handle
388  * @msg: Dual MAC config parameters
389  *
390  * Configures WLAN firmware with the dual MAC features
391  *
392  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failures.
393  */
394 QDF_STATUS wmi_unified_pdev_set_dual_mac_config_cmd(
395 		wmi_unified_t wmi_handle,
396 		struct policy_mgr_dual_mac_config *msg);
397 #endif /* WLAN_POLICY_MGR_ENABLE */
398 
399 /**
400  * wmi_unified_send_adapt_dwelltime_params_cmd() - send wmi cmd of
401  * adaptive dwelltime configuration params
402  * @wmi_handle:  wmi handler
403  * @wmi_param: pointer to dwelltime_params
404  *
405  * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure
406  */
407 QDF_STATUS wmi_unified_send_adapt_dwelltime_params_cmd(
408 		wmi_unified_t wmi_handle,
409 		struct wmi_adaptive_dwelltime_params *wmi_param);
410 
411 /**
412  * wmi_unified_send_dbs_scan_sel_params_cmd() - send wmi cmd of
413  * DBS scan selection configuration params
414  * @wmi_handle:  wmi handler
415  * @wmi_param: pointer to wmi_dbs_scan_sel_params
416  *
417  * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure
418  */
419 QDF_STATUS wmi_unified_send_dbs_scan_sel_params_cmd(
420 			wmi_unified_t wmi_handle,
421 			struct wmi_dbs_scan_sel_params *wmi_param);
422 
423 /**
424  * wmi_unified_set_arp_stats_req() - set arp stats request
425  * @wmi_handle: wmi handle
426  * @req_buf: pointer to set_arp_stats
427  *
428  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
429  */
430 QDF_STATUS wmi_unified_set_arp_stats_req(wmi_unified_t wmi_handle,
431 					 struct set_arp_stats *req_buf);
432 
433 /**
434  * wmi_unified_get_arp_stats_req() - get arp stats request
435  * @wmi_handle: wmi handle
436  * @req_buf: pointer to get_arp_stats
437  *
438  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
439  */
440 QDF_STATUS wmi_unified_get_arp_stats_req(wmi_unified_t wmi_handle,
441 					 struct get_arp_stats *req_buf);
442 
443 /**
444  * wmi_unified_peer_unmap_conf_send() - send PEER unmap conf command to fw
445  * @wmi_handle: wmi handle
446  * @vdev_id: vdev id
447  * @peer_id_cnt: number of peer id
448  * @peer_id_list: list of peer ids
449  *
450  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
451  */
452 QDF_STATUS wmi_unified_peer_unmap_conf_send(wmi_unified_t wmi_handle,
453 					    uint8_t vdev_id,
454 					    uint32_t peer_id_cnt,
455 					    uint16_t *peer_id_list);
456 
457 #endif /* _WMI_UNIFIED_STA_API_H_ */
458