xref: /wlan-driver/qca-wifi-host-cmn/wmi/src/wmi_unified_11be_api.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
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  * DOC: Implement API's specific to 11be.
19  */
20 
21 #include "wmi_unified_11be_api.h"
22 
23 /**
24  * wmi_extract_mlo_link_set_active_resp() - extract mlo link set active resp
25  *  from event
26  * @wmi: WMI handle for this pdev
27  * @evt_buf: pointer to event buffer
28  * @resp: Pointer to hold mlo link set active resp
29  *
30  * Return: QDF_STATUS code
31  */
32 QDF_STATUS
wmi_extract_mlo_link_set_active_resp(wmi_unified_t wmi,void * evt_buf,struct mlo_link_set_active_resp * resp)33 wmi_extract_mlo_link_set_active_resp(wmi_unified_t wmi,
34 				     void *evt_buf,
35 				     struct mlo_link_set_active_resp *resp)
36 {
37 	if (wmi->ops->extract_mlo_link_set_active_resp) {
38 		return wmi->ops->extract_mlo_link_set_active_resp(wmi,
39 								  evt_buf,
40 								  resp);
41 	}
42 	return QDF_STATUS_E_FAILURE;
43 }
44 
45 /**
46  * wmi_send_mlo_link_set_active_cmd() - send mlo link set active command
47  * @wmi: WMI handle for this pdev
48  * @param: Pointer to mlo link set active param
49  *
50  * Return: QDF_STATUS code
51  */
52 QDF_STATUS
wmi_send_mlo_link_set_active_cmd(wmi_unified_t wmi,struct mlo_link_set_active_param * param)53 wmi_send_mlo_link_set_active_cmd(wmi_unified_t wmi,
54 				 struct mlo_link_set_active_param *param)
55 {
56 	if (wmi->ops->send_mlo_link_set_active_cmd)
57 		return wmi->ops->send_mlo_link_set_active_cmd(wmi, param);
58 
59 	return QDF_STATUS_E_FAILURE;
60 }
61 
62 #ifdef WLAN_FEATURE_11BE
wmi_send_mlo_peer_tid_to_link_map_cmd(wmi_unified_t wmi,struct wmi_host_tid_to_link_map_params * params,bool t2lm_info)63 QDF_STATUS wmi_send_mlo_peer_tid_to_link_map_cmd(
64 		wmi_unified_t wmi,
65 		struct wmi_host_tid_to_link_map_params *params,
66 		bool t2lm_info)
67 {
68 	if (wmi->ops->send_mlo_peer_tid_to_link_map)
69 		return wmi->ops->send_mlo_peer_tid_to_link_map(wmi, params, t2lm_info);
70 
71 	return QDF_STATUS_E_FAILURE;
72 }
73 
wmi_send_mlo_vdev_tid_to_link_map_cmd(wmi_unified_t wmi,struct wmi_host_tid_to_link_map_ap_params * params)74 QDF_STATUS wmi_send_mlo_vdev_tid_to_link_map_cmd(
75 		wmi_unified_t wmi,
76 		struct wmi_host_tid_to_link_map_ap_params *params)
77 {
78 	if (wmi->ops->send_mlo_vdev_tid_to_link_map)
79 		return wmi->ops->send_mlo_vdev_tid_to_link_map(wmi, params);
80 
81 	return QDF_STATUS_E_FAILURE;
82 }
83 
84 #ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
85 QDF_STATUS
wmi_send_mlo_link_switch_req_cnf_cmd(wmi_unified_t wmi,struct wlan_mlo_link_switch_cnf * params)86 wmi_send_mlo_link_switch_req_cnf_cmd(wmi_unified_t wmi,
87 				     struct wlan_mlo_link_switch_cnf *params)
88 {
89 	if (wmi->ops->send_mlo_link_switch_req_cnf_cmd)
90 		return wmi->ops->send_mlo_link_switch_req_cnf_cmd(wmi, params);
91 
92 	return QDF_STATUS_E_FAILURE;
93 }
94 
95 QDF_STATUS
wmi_extract_mlo_link_switch_request_evt(struct wmi_unified * wmi,void * buf,struct wlan_mlo_link_switch_req * req)96 wmi_extract_mlo_link_switch_request_evt(struct wmi_unified *wmi,
97 					void *buf,
98 					struct wlan_mlo_link_switch_req *req)
99 {
100 	if (wmi->ops->extract_mlo_link_switch_request_event)
101 		return wmi->ops->extract_mlo_link_switch_request_event(wmi,
102 								       buf,
103 								       req);
104 
105 	return QDF_STATUS_E_FAILURE;
106 }
107 
108 QDF_STATUS
wmi_extract_mlo_link_state_switch_evt(struct wmi_unified * wmi,void * buf,uint8_t len,struct mlo_link_switch_state_info * info)109 wmi_extract_mlo_link_state_switch_evt(struct wmi_unified *wmi,
110 				      void *buf, uint8_t len,
111 				      struct mlo_link_switch_state_info *info)
112 {
113 	if (wmi->ops->extract_mlo_link_state_switch_evt)
114 		return wmi->ops->extract_mlo_link_state_switch_evt(
115 							wmi, buf, len, info);
116 
117 	return QDF_STATUS_SUCCESS;
118 }
119 #endif /* WLAN_FEATURE_11BE_MLO_ADV_FEATURE */
120 
wmi_send_mlo_link_state_request_cmd(wmi_unified_t wmi,struct wmi_host_link_state_params * params)121 QDF_STATUS wmi_send_mlo_link_state_request_cmd(
122 		wmi_unified_t wmi,
123 		struct wmi_host_link_state_params *params)
124 {
125 	if (wmi->ops->send_mlo_link_state_request)
126 		return wmi->ops->send_mlo_link_state_request(wmi, params);
127 	return QDF_STATUS_E_FAILURE;
128 }
129 
wmi_send_link_set_bss_params_cmd(wmi_unified_t wmi,struct wmi_host_link_bss_params * params)130 QDF_STATUS wmi_send_link_set_bss_params_cmd(
131 		wmi_unified_t wmi,
132 		struct wmi_host_link_bss_params *params)
133 {
134 	if (wmi->ops->send_link_set_bss_params_cmd)
135 		return wmi->ops->send_link_set_bss_params_cmd(wmi, params);
136 	return QDF_STATUS_E_FAILURE;
137 }
138 
139 QDF_STATUS
wmi_extract_mlo_vdev_tid_to_link_map_event(wmi_unified_t wmi,void * evt_buf,struct mlo_vdev_host_tid_to_link_map_resp * resp)140 wmi_extract_mlo_vdev_tid_to_link_map_event(
141 		wmi_unified_t wmi, void *evt_buf,
142 		struct mlo_vdev_host_tid_to_link_map_resp *resp)
143 {
144 	if (wmi->ops->extract_mlo_vdev_tid_to_link_map_event) {
145 		return wmi->ops->extract_mlo_vdev_tid_to_link_map_event(wmi,
146 									evt_buf,
147 									resp);
148 	}
149 	return QDF_STATUS_E_FAILURE;
150 }
151 
152 QDF_STATUS
wmi_extract_mlo_vdev_bcast_tid_to_link_map_event(wmi_unified_t wmi,void * evt_buf,struct mlo_bcast_t2lm_info * bcast)153 wmi_extract_mlo_vdev_bcast_tid_to_link_map_event(
154 				     wmi_unified_t wmi,
155 				     void *evt_buf,
156 				     struct mlo_bcast_t2lm_info *bcast)
157 {
158 	if (wmi->ops->extract_mlo_vdev_bcast_tid_to_link_map_event) {
159 		return wmi->ops->extract_mlo_vdev_bcast_tid_to_link_map_event(
160 						wmi,
161 						evt_buf,
162 						bcast);
163 	}
164 	return QDF_STATUS_E_FAILURE;
165 }
166 
wmi_extract_mlo_link_state_info_event(wmi_unified_t wmi,void * evt_buf,struct ml_link_state_info_event * params)167 QDF_STATUS wmi_extract_mlo_link_state_info_event(
168 		wmi_unified_t wmi,
169 		void *evt_buf,
170 		struct ml_link_state_info_event *params)
171 {
172 	if (wmi->ops->extract_mlo_link_state_event)
173 		return wmi->ops->extract_mlo_link_state_event(
174 				wmi, evt_buf, params);
175 	return QDF_STATUS_E_FAILURE;
176 }
177 
wmi_extract_mlo_link_disable_request_evt(struct wmi_unified * wmi,void * buf,struct mlo_link_disable_request_evt_params * params)178 QDF_STATUS wmi_extract_mlo_link_disable_request_evt(
179 		struct wmi_unified *wmi,
180 		void *buf,
181 		struct mlo_link_disable_request_evt_params *params)
182 {
183 	if (wmi->ops->extract_mlo_link_disable_request_evt_param)
184 		return wmi->ops->extract_mlo_link_disable_request_evt_param(
185 							wmi, buf, params);
186 
187 	return QDF_STATUS_E_FAILURE;
188 }
189 #endif /* WLAN_FEATURE_11BE */
190 
191 QDF_STATUS
wmi_extract_mgmt_rx_ml_cu_params(wmi_unified_t wmi,void * evt_buf,struct mlo_mgmt_ml_info * cu_params)192 wmi_extract_mgmt_rx_ml_cu_params(wmi_unified_t wmi, void *evt_buf,
193 				 struct mlo_mgmt_ml_info *cu_params)
194 {
195 	if (wmi->ops->extract_mgmt_rx_ml_cu_params)
196 		return wmi->ops->extract_mgmt_rx_ml_cu_params(
197 				wmi, evt_buf, cu_params);
198 
199 	return QDF_STATUS_E_FAILURE;
200 }
201 
wmi_send_mlo_link_removal_cmd(wmi_unified_t wmi,const struct mlo_link_removal_cmd_params * param)202 QDF_STATUS wmi_send_mlo_link_removal_cmd(
203 		wmi_unified_t wmi,
204 		const struct mlo_link_removal_cmd_params *param)
205 {
206 	if (wmi->ops->send_mlo_link_removal_cmd)
207 		return wmi->ops->send_mlo_link_removal_cmd(wmi, param);
208 
209 	return QDF_STATUS_E_FAILURE;
210 }
211 
wmi_send_mlo_vdev_pause(wmi_unified_t wmi,struct mlo_vdev_pause * info)212 QDF_STATUS wmi_send_mlo_vdev_pause(wmi_unified_t wmi,
213 				   struct mlo_vdev_pause *info)
214 {
215 	if (wmi->ops->send_mlo_vdev_pause)
216 		return wmi->ops->send_mlo_vdev_pause(wmi, info);
217 
218 	return QDF_STATUS_E_FAILURE;
219 }
220 
wmi_extract_mlo_link_removal_evt_fixed_param(struct wmi_unified * wmi,void * buf,struct mlo_link_removal_evt_params * params)221 QDF_STATUS wmi_extract_mlo_link_removal_evt_fixed_param(
222 		struct wmi_unified *wmi,
223 		void *buf,
224 		struct mlo_link_removal_evt_params *params)
225 {
226 	if (wmi->ops->extract_mlo_link_removal_evt_fixed_param)
227 		return wmi->ops->extract_mlo_link_removal_evt_fixed_param(
228 							wmi, buf, params);
229 
230 	return QDF_STATUS_E_FAILURE;
231 }
232 
wmi_extract_mlo_link_removal_tbtt_update(struct wmi_unified * wmi,void * buf,struct mlo_link_removal_tbtt_info * tbtt_info)233 QDF_STATUS wmi_extract_mlo_link_removal_tbtt_update(
234 		struct wmi_unified *wmi,
235 		void *buf,
236 		struct mlo_link_removal_tbtt_info *tbtt_info)
237 {
238 	if (wmi->ops->extract_mlo_link_removal_tbtt_update)
239 		return wmi->ops->extract_mlo_link_removal_tbtt_update(
240 							wmi, buf, tbtt_info);
241 
242 	return QDF_STATUS_E_FAILURE;
243 }
244 
wmi_extract_mgmt_rx_mlo_link_removal_info(struct wmi_unified * wmi,void * buf,struct mgmt_rx_mlo_link_removal_info * link_removal_info,int num_link_removal_info)245 QDF_STATUS wmi_extract_mgmt_rx_mlo_link_removal_info(
246 		struct wmi_unified *wmi,
247 		void *buf,
248 		struct mgmt_rx_mlo_link_removal_info *link_removal_info,
249 		int num_link_removal_info)
250 {
251 	if (wmi->ops->extract_mgmt_rx_mlo_link_removal_info)
252 		return wmi->ops->extract_mgmt_rx_mlo_link_removal_info(
253 							wmi, buf,
254 							link_removal_info,
255 							num_link_removal_info);
256 
257 	return QDF_STATUS_E_FAILURE;
258 }
259 
260 #ifdef QCA_SUPPORT_PRIMARY_LINK_MIGRATE
wmi_unified_peer_ptqm_migrate_send(wmi_unified_t wmi_hdl,struct peer_ptqm_migrate_params * param)261 QDF_STATUS wmi_unified_peer_ptqm_migrate_send(
262 					wmi_unified_t wmi_hdl,
263 					struct peer_ptqm_migrate_params *param)
264 {
265 	if (wmi_hdl->ops->send_peer_ptqm_migrate_cmd)
266 		return wmi_hdl->ops->send_peer_ptqm_migrate_cmd(wmi_hdl, param);
267 
268 	return QDF_STATUS_E_FAILURE;
269 }
270 
271 QDF_STATUS
wmi_extract_peer_ptqm_migrate_event(wmi_unified_t wmi,void * evt_buf,struct peer_ptqm_migrate_event_params * resp)272 wmi_extract_peer_ptqm_migrate_event(
273 		wmi_unified_t wmi, void *evt_buf,
274 		struct peer_ptqm_migrate_event_params *resp)
275 {
276 	if (wmi->ops->extract_peer_ptqm_migrate_event) {
277 		return wmi->ops->extract_peer_ptqm_migrate_event(wmi,
278 								 evt_buf,
279 								 resp);
280 	}
281 	return QDF_STATUS_E_FAILURE;
282 }
283 
284 QDF_STATUS
wmi_extract_peer_ptqm_entry_param(wmi_unified_t wmi_handle,void * evt_buf,uint32_t index,struct peer_entry_ptqm_migrate_event_params * entry)285 wmi_extract_peer_ptqm_entry_param(
286 		wmi_unified_t wmi_handle, void *evt_buf,
287 		uint32_t index,
288 		struct peer_entry_ptqm_migrate_event_params *entry)
289 {
290 	if (wmi_handle->ops->extract_peer_entry_ptqm_migrate_event)
291 		return wmi_handle->ops->extract_peer_entry_ptqm_migrate_event(
292 			wmi_handle, evt_buf,
293 			index, entry);
294 
295 	return QDF_STATUS_E_FAILURE;
296 }
297 #endif /* QCA_SUPPORT_PRIMARY_LINK_MIGRATE */
298