1 /*
2  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 /*
18  * This file contains the API definitions for the Unified Wireless Module
19  * Interface (WMI) specific to 11be.
20  */
21 
22 #ifndef _WMI_UNIFIED_11BE_API_H_
23 #define _WMI_UNIFIED_11BE_API_H_
24 
25 #include <wmi_unified_api.h>
26 #include <wmi_unified_priv.h>
27 
28 #ifdef WLAN_FEATURE_11BE_MLO
29 /**
30  * wmi_extract_mlo_link_set_active_resp() - extract mlo link set active
31  *  response event
32  * @wmi: wmi handle
33  * @evt_buf: pointer to event buffer
34  * @evt: Pointer to hold mlo link set active response event
35  *
36  * This function gets called to extract mlo link set active response event
37  *
38  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
39  */
40 QDF_STATUS
41 wmi_extract_mlo_link_set_active_resp(wmi_unified_t wmi,
42 				     void *evt_buf,
43 				     struct mlo_link_set_active_resp *evt);
44 
45 /**
46  * wmi_send_mlo_link_set_active_cmd() - send mlo link set active command
47  * @wmi_handle: WMI handle for this pdev
48  * @param: Pointer to mlo link set active param
49  *
50  * Return: QDF_STATUS code
51  */
52 QDF_STATUS
53 wmi_send_mlo_link_set_active_cmd(wmi_unified_t wmi_handle,
54 				 struct mlo_link_set_active_param *param);
55 
56 /**
57  * wmi_extract_mgmt_rx_ml_cu_params() - extract mlo cu params from event
58  * @wmi_handle: wmi handle
59  * @evt_buf: pointer to event buffer
60  * @cu_params: Pointer to mlo CU params
61  *
62  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
63  */
64 QDF_STATUS
65 wmi_extract_mgmt_rx_ml_cu_params(wmi_unified_t wmi_handle, void *evt_buf,
66 				 struct mlo_mgmt_ml_info *cu_params);
67 
68 /**
69  * wmi_send_mlo_link_removal_cmd() - Send WMI command for MLO link removal
70  * @wmi: wmi handle
71  * @param: MLO link removal command parameters
72  *
73  * Return: QDF_STATUS_SUCCESS of operation
74  */
75 QDF_STATUS wmi_send_mlo_link_removal_cmd(
76 		wmi_unified_t wmi,
77 		const struct mlo_link_removal_cmd_params *param);
78 
79 /**
80  * wmi_send_mlo_vdev_pause() - Send WMI command for MLO vdev pause
81  * @wmi: wmi handle
82  * @info: MLO vdev pause information
83  *
84  * Return: QDF_STATUS_SUCCESS of operation
85  */
86 QDF_STATUS wmi_send_mlo_vdev_pause(wmi_unified_t wmi,
87 				   struct mlo_vdev_pause *info);
88 
89 /**
90  * wmi_extract_mlo_link_removal_evt_fixed_param() - Extract fixed parameters TLV
91  * from the MLO link removal WMI  event
92  * @wmi_handle: wmi handle
93  * @buf: pointer to event buffer
94  * @params: MLO link removal event parameters
95  *
96  * Return: QDF_STATUS_SUCCESS of operation
97  */
98 QDF_STATUS wmi_extract_mlo_link_removal_evt_fixed_param(
99 		struct wmi_unified *wmi_handle,
100 		void *buf,
101 		struct mlo_link_removal_evt_params *params);
102 
103 /**
104  * wmi_extract_mlo_link_removal_tbtt_update() - Extract TBTT update TLV
105  * from the MLO link removal WMI  event
106  * @wmi_handle: wmi handle
107  * @buf: pointer to event buffer
108  * @tbtt_info: TBTT information
109  *
110  * Return: QDF_STATUS of operation
111  */
112 QDF_STATUS wmi_extract_mlo_link_removal_tbtt_update(
113 		struct wmi_unified *wmi_handle,
114 		void *buf,
115 		struct mlo_link_removal_tbtt_info *tbtt_info);
116 
117 /**
118  * wmi_extract_mgmt_rx_mlo_link_removal_info() - Extract MLO link removal info
119  * from MGMT Rx event
120  * @wmi: wmi handle
121  * @buf: event buffer
122  * @link_removal_info: link removal information array to be populated
123  * @num_link_removal_info: Number of elements in @link_removal_info
124  *
125  * Return: QDF_STATUS of operation
126  */
127 QDF_STATUS wmi_extract_mgmt_rx_mlo_link_removal_info(
128 		struct wmi_unified *wmi,
129 		void *buf,
130 		struct mgmt_rx_mlo_link_removal_info *link_removal_info,
131 		int num_link_removal_info);
132 #endif /*WLAN_FEATURE_11BE_MLO*/
133 
134 #ifdef WLAN_FEATURE_11BE
135 /**
136  * wmi_send_mlo_peer_tid_to_link_map_cmd() - send TID-to-link mapping command
137  * @wmi: WMI handle for this pdev
138  * @params: Pointer to TID-to-link mapping params
139  * @t2lm_info: T2LM info presence flag
140  */
141 QDF_STATUS wmi_send_mlo_peer_tid_to_link_map_cmd(
142 		wmi_unified_t wmi,
143 		struct wmi_host_tid_to_link_map_params *params,
144 		bool t2lm_info);
145 
146 /**
147  * wmi_send_mlo_vdev_tid_to_link_map_cmd() - send TID-to-link mapping command
148  *                                           per vdev
149  * @wmi: WMI handle for this pdev
150  * @params: Pointer to TID-to-link mapping params
151  */
152 QDF_STATUS wmi_send_mlo_vdev_tid_to_link_map_cmd(
153 		wmi_unified_t wmi,
154 		struct wmi_host_tid_to_link_map_ap_params *params);
155 /**
156  * wmi_send_mlo_link_state_request_cmd - send mlo link status command
157  * @wmi: wmi handle
158  * @params: Pointer to link state params
159  */
160 QDF_STATUS wmi_send_mlo_link_state_request_cmd(
161 		wmi_unified_t wmi,
162 		struct wmi_host_link_state_params *params);
163 
164 /**
165  * wmi_send_link_set_bss_params_cmd - send link set bss cmd
166  * @wmi: wmi handler
167  * @params: pointer to link bss param
168  */
169 QDF_STATUS wmi_send_link_set_bss_params_cmd(
170 		wmi_unified_t wmi,
171 		struct wmi_host_link_bss_params *params);
172 
173 /**
174  * wmi_extract_mlo_vdev_tid_to_link_map_event() - extract mlo t2lm info for vdev
175  * @wmi: wmi handle
176  * @evt_buf: pointer to event buffer
177  * @resp: Pointer to host structure to get the t2lm info
178  *
179  * This function gets called to extract mlo t2lm info for particular pdev
180  *
181  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
182  */
183 QDF_STATUS
184 wmi_extract_mlo_vdev_tid_to_link_map_event(
185 		wmi_unified_t wmi, void *evt_buf,
186 		struct mlo_vdev_host_tid_to_link_map_resp *resp);
187 
188 /**
189  * wmi_extract_mlo_vdev_bcast_tid_to_link_map_event() - extract bcast mlo t2lm
190  *                                                      info for vdev
191  * @wmi: wmi handle
192  * @evt_buf: pointer to event buffer
193  * @bcast: Pointer to host structure to get the t2lm bcast info
194  *
195  * This function gets called to extract bcast mlo t2lm info for particular pdev
196  *
197  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
198  */
199 QDF_STATUS
200 wmi_extract_mlo_vdev_bcast_tid_to_link_map_event(
201 				     wmi_unified_t wmi,
202 				     void *evt_buf,
203 				     struct mlo_bcast_t2lm_info *bcast);
204 
205 /**
206  * wmi_extract_mlo_link_state_info_event - extract mlo link status info
207  * @wmi: wmi handle
208  * @evt_buf: pointer to event buffer
209  * @params: pointer to host struct to get mlo link state
210  */
211 QDF_STATUS wmi_extract_mlo_link_state_info_event(
212 			wmi_unified_t wmi,
213 			void *evt_buf,
214 			struct ml_link_state_info_event *params);
215 
216 #ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
217 /**
218  * wmi_send_mlo_link_switch_req_cnf_cmd() - Send WMI command to FW on
219  * status of Link switch request received.
220  * @wmi: wmi handle
221  * @params: Params to send to FW.
222  *
223  * Return: QDF_STATUS.
224  */
225 QDF_STATUS
226 wmi_send_mlo_link_switch_req_cnf_cmd(wmi_unified_t wmi,
227 				     struct wlan_mlo_link_switch_cnf *params);
228 
229 /**
230  * wmi_extract_mlo_link_switch_request_evt() - Extract fixed params TLV
231  * from the MLO link switch request WMI event.
232  * @wmi: wmi handle
233  * @buf: pointer to event buffer
234  * @req: MLO link switch request event params.
235  *
236  * Return: QDF_STATUS
237  */
238 QDF_STATUS
239 wmi_extract_mlo_link_switch_request_evt(struct wmi_unified *wmi, void *buf,
240 					struct wlan_mlo_link_switch_req *req);
241 #else
242 static inline QDF_STATUS
wmi_send_mlo_link_switch_req_cnf_cmd(wmi_unified_t wmi,struct wlan_mlo_link_switch_cnf * params)243 wmi_send_mlo_link_switch_req_cnf_cmd(wmi_unified_t wmi,
244 				     struct wlan_mlo_link_switch_cnf *params)
245 {
246 	return QDF_STATUS_SUCCESS;
247 }
248 
249 static inline QDF_STATUS
wmi_extract_mlo_link_switch_request_evt(struct wmi_unified * wmi,void * buf,struct wlan_mlo_link_switch_req * req)250 wmi_extract_mlo_link_switch_request_evt(struct wmi_unified *wmi, void *buf,
251 					struct wlan_mlo_link_switch_req *req)
252 {
253 	return QDF_STATUS_SUCCESS;
254 }
255 #endif
256 
257 /**
258  * wmi_extract_mlo_link_disable_request_evt() - Extract fixed parameters TLV
259  * from the MLO link disable request WMI event
260  * @wmi: wmi handle
261  * @buf: pointer to event buffer
262  * @params: MLO link disable request event parameters
263  *
264  * Return: QDF_STATUS_SUCCESS of operation
265  */
266 QDF_STATUS wmi_extract_mlo_link_disable_request_evt(
267 		struct wmi_unified *wmi,
268 		void *buf,
269 		struct mlo_link_disable_request_evt_params *params);
270 
271 /**
272  * wmi_extract_mlo_link_state_switch_evt() - Extract the MLO link switch state
273  * event parameters
274  * @wmi: wmi handle
275  * @buf: pointer to event buffer
276  * @len: event data length
277  * @info: Info on link switch state change event
278  *
279  * Return: QDF_STATUS
280  */
281 QDF_STATUS
282 wmi_extract_mlo_link_state_switch_evt(struct wmi_unified *wmi, void *buf,
283 				      uint8_t len,
284 				      struct mlo_link_switch_state_info *info);
285 #endif /* WLAN_FEATURE_11BE */
286 
287 #ifdef QCA_SUPPORT_PRIMARY_LINK_MIGRATE
288 /**
289  * wmi_unified_peer_ptqm_migrate_send() - send PEER ptqm migrate command to fw
290  * @wmi_hdl: wmi handle
291  * @param: pointer to hold peer ptqm migrate parameters
292  *
293  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
294  */
295 QDF_STATUS wmi_unified_peer_ptqm_migrate_send(
296 					wmi_unified_t wmi_hdl,
297 					struct peer_ptqm_migrate_params *param);
298 
299 /**
300  * wmi_extract_peer_ptqm_migrate_event() - extract peer ptqm migrate event params
301  * @wmi: wmi handle
302  * @evt_buf: pointer to event buffer
303  * @resp: Pointer to host structure to get the event params
304  *
305  * This function gets called to extract peer ptqm migrate event params
306  *
307  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
308  */
309 QDF_STATUS
310 wmi_extract_peer_ptqm_migrate_event(
311 		wmi_unified_t wmi, void *evt_buf,
312 		struct peer_ptqm_migrate_event_params *resp);
313 
314 /**
315  * wmi_extract_peer_ptqm_entry_param() - extract peer entry ptqm migrate param
316  * @wmi_handle: wmi handle
317  * @evt_buf: pointer to event buffer
318  * @index: Index into pdev stats
319  * @entry: Pointer to peer entry params
320  *
321  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
322  */
323 QDF_STATUS
324 wmi_extract_peer_ptqm_entry_param(
325 		wmi_unified_t wmi_handle, void *evt_buf,
326 		uint32_t index,
327 		struct peer_entry_ptqm_migrate_event_params *entry);
328 #endif /* QCA_SUPPORT_PRIMARY_LINK_MIGRATE */
329 #endif /*_WMI_UNIFIED_11BE_API_H_*/
330