1 /*
2 * Copyright (c) 2021, The Linux Foundation. All rights reserved.
3 * Copyright (c) 2022-2024 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 #ifndef _WMI_UNIFIED_11BE_TLV_H_
19 #define _WMI_UNIFIED_11BE_TLV_H_
20
21 #ifdef WLAN_FEATURE_11BE_MLO
22 /**
23 * vdev_create_mlo_params_size() - Get MLO params size in vdev create
24 * @param: pointer to vdev create request param
25 * Return: size of MLO params in vdev create
26 */
27 size_t vdev_create_mlo_params_size(struct vdev_create_params *param);
28 /**
29 * vdev_create_add_mlo_params() - Add MLO params in vdev create cmd
30 * @buf_ptr: pointer to vdev create buffer.
31 * @param: pointer to vdev create request param
32 *
33 * Return: pointer to new offset of vdev create buffer
34 */
35 uint8_t *vdev_create_add_mlo_params(uint8_t *buf_ptr,
36 struct vdev_create_params *param);
37 /**
38 * vdev_start_mlo_params_size() - Get MLO params size in vdev start
39 * @req: Vdev start request params
40 *
41 * Return: size of MLO params in vdev start
42 */
43 size_t vdev_start_mlo_params_size(struct vdev_start_params *req);
44 /**
45 * vdev_start_add_mlo_params() - Add MLO params in vdev start cmd
46 * @buf_ptr: pointer to vdev start buffer.
47 * @req: pointer to vdev create request param
48 *
49 * Return: pointer to new offset of cmd buffer
50 */
51 uint8_t *vdev_start_add_mlo_params(uint8_t *buf_ptr,
52 struct vdev_start_params *req);
53 /**
54 * vdev_start_add_ml_partner_links() - Add MLO partner links in vdev start cmd
55 * @buf_ptr: pointer to vdev start cmd buffer.
56 * @req: pointer to vdev start request param
57 *
58 * Return: pointer to new offset of cmd buffer
59 */
60 uint8_t *vdev_start_add_ml_partner_links(uint8_t *buf_ptr,
61 struct vdev_start_params *req);
62 /**
63 * bcn_tmpl_mlo_param_size() - Get ML param size in beacon template
64 * @param: Pointer to beacon template param
65 *
66 * Return: size of ML params in beacon template
67 */
68 size_t bcn_tmpl_mlo_param_size(struct beacon_tmpl_params *param);
69
70 /**
71 * bcn_tmpl_add_ml_partner_links - Add MLO partner links in beacon template
72 * command
73 * @buf_ptr: pointer to beacon cmd buffer.
74 * @param: pointer to beacon template params
75 *
76 * Return: pointer to new offset of cmd buffer
77 */
78 uint8_t *bcn_tmpl_add_ml_partner_links(uint8_t *buf_ptr,
79 struct beacon_tmpl_params *param);
80
81 /**
82 * bcn_tmpl_ml_info_size() - Get ML info size in beacon template
83 * @param: Pointer to beacon template param
84 *
85 * Return: size of ML info in beacon template
86 */
87 size_t bcn_tmpl_ml_info_size(struct beacon_tmpl_params *param);
88
89 /**
90 * bcn_tmpl_add_ml_info() - Add MLO info to update Critical Update info in
91 * beacon template command
92 * @buf_ptr: pointer to beacon cmd buffer.
93 * @param: pointer to beacon template params
94 *
95 * Return: pointer to new offset of cmd buffer
96 */
97 uint8_t *bcn_tmpl_add_ml_info(uint8_t *buf_ptr,
98 struct beacon_tmpl_params *param);
99 /**
100 * prb_resp_tmpl_ml_info_size() - Get ML info size in 20TU probe resp template
101 * @param: Pointer to 20TU probe response template param
102 *
103 * Return: size of ML info in 20TU probe response template
104 */
105 size_t prb_resp_tmpl_ml_info_size(struct wmi_probe_resp_params *param);
106
107 /**
108 * prb_resp_tmpl_add_ml_info() - Add MLO info to update Critical Update info in
109 * 20TU probe response template command
110 * @buf_ptr: pointer to 20TU probe response cmd buffer.
111 * @param: pointer to 20TU probe response template params
112 *
113 * Return: pointer to new offset of cmd buffer
114 */
115 uint8_t *prb_resp_tmpl_add_ml_info(uint8_t *buf_ptr,
116 struct wmi_probe_resp_params *param);
117 /**
118 * peer_create_add_mlo_params() - Add MLO params in peer create cmd
119 * @buf_ptr: pointer to peer create cmd buffer.
120 * @req: pointer to peer create request param
121 *
122 * Return: pointer to new offset of cmd buffer
123 */
124 uint8_t *peer_create_add_mlo_params(uint8_t *buf_ptr,
125 struct peer_create_params *req);
126 /**
127 * peer_create_mlo_params_size() - Get ML params size in peer create
128 * @req: pointer to peer create request param
129 *
130 * Return: size of ML params in peer create cmd
131 */
132 size_t peer_create_mlo_params_size(struct peer_create_params *req);
133 /**
134 * peer_assoc_mlo_params_size() - Get ML params size in peer assoc
135 * @req: pointer to peer assoc request param
136 *
137 * Return: size of ML params in peer assoc cmd
138 */
139 size_t peer_assoc_mlo_params_size(struct peer_assoc_params *req);
140 /**
141 * peer_assoc_add_mlo_params() - Add MLO params in peer assoc cmd
142 * @buf_ptr: pointer to peer assoc cmd buffer.
143 * @req: pointer to peer assoc request param
144 *
145 * Return: pointer to new offset of cmd buffer
146 */
147 uint8_t *peer_assoc_add_mlo_params(uint8_t *buf_ptr,
148 struct peer_assoc_params *req);
149 /**
150 * peer_assoc_add_ml_partner_links() - Add MLO partner links in peer assoc cmd
151 * @buf_ptr: pointer to peer assoc cmd buffer.
152 * @req: pointer to peer assoc request param
153 *
154 * Return: pointer to new offset of cmd buffer
155 */
156 uint8_t *peer_assoc_add_ml_partner_links(uint8_t *buf_ptr,
157 struct peer_assoc_params *req);
158 /**
159 * peer_assoc_t2lm_params_size() - Get T2LM param size in peer assoc
160 * @req: pointer to peer create request param
161 *
162 * Return: size of ML params in peer create cmd
163 */
164 size_t peer_assoc_t2lm_params_size(struct peer_assoc_params *req);
165 /**
166 * peer_assoc_add_tid_to_link_map() - Add TID-to-link mapping in peer assoc cmd
167 * @buf_ptr: pointer to peer assoc cmd buffer.
168 * @req: pointer to peer assoc request param
169 *
170 * Return: pointer to new offset of cmd buffer
171 */
172 uint8_t *peer_assoc_add_tid_to_link_map(uint8_t *buf_ptr,
173 struct peer_assoc_params *req);
174
175 /**
176 * peer_delete_mlo_params_size() - Get MLO params size in pdev delete
177 * @req: peer delete request params
178 *
179 * Return: size of MLO params in vdev start
180 */
181 size_t peer_delete_mlo_params_size(struct peer_delete_cmd_params *req);
182
183 /**
184 * peer_delete_add_mlo_params() - Add MLO params in peer delete cmd
185 * @buf_ptr: pointer to peer delete cmd buffer.
186 * @req: pointer to peer delete request param
187 *
188 * Return: pointer to new offset of cmd buffer
189 */
190 uint8_t *peer_delete_add_mlo_params(uint8_t *buf_ptr,
191 struct peer_delete_cmd_params *req);
192
193 /**
194 * vdev_stop_mlo_params_size() - Get MLO params size in vdev stop
195 * @params: VDEV stop request params
196 *
197 * Return: size of MLO params in VDEV stop
198 */
199 size_t vdev_stop_mlo_params_size(struct vdev_stop_params *params);
200
201 /**
202 * vdev_stop_add_mlo_params() - Add MLO params in VDEV stop cmd
203 * @buf_ptr: Pointer to VDEV stop cmd buffer.
204 * @params: VDEV stop request params
205 *
206 * Return: Pointer to new offset of cmd buffer.
207 */
208 uint8_t *vdev_stop_add_mlo_params(uint8_t *buf_ptr,
209 struct vdev_stop_params *params);
210
211 /** wmi_11be_tlv_attach_tlv - Attach 11be relaated callbacks
212 * @wmi_handle: WMI handle
213 */
214 void wmi_11be_attach_tlv(wmi_unified_t wmi_handle);
215
216 /**
217 * extract_mgmt_rx_mlo_link_removal_tlv_count() - Extract the number of link
218 * removal TLVs from MGMT Rx event
219 * @num_link_removal_tlvs: Number of link removal TLVs
220 * @hdr: MGMT Rx event parameters to be populated
221 *
222 * Return: None
223 */
224 static inline void
extract_mgmt_rx_mlo_link_removal_tlv_count(int num_link_removal_tlvs,struct mgmt_rx_event_params * hdr)225 extract_mgmt_rx_mlo_link_removal_tlv_count(
226 int num_link_removal_tlvs,
227 struct mgmt_rx_event_params *hdr)
228 {
229 hdr->num_link_removal_info = num_link_removal_tlvs;
230 }
231 #else
vdev_create_add_mlo_params(uint8_t * buf_ptr,struct vdev_create_params * param)232 static uint8_t *vdev_create_add_mlo_params(uint8_t *buf_ptr,
233 struct vdev_create_params *param)
234 {
235 WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0);
236 return buf_ptr + WMI_TLV_HDR_SIZE;
237 }
238
vdev_create_mlo_params_size(struct vdev_create_params * param)239 static size_t vdev_create_mlo_params_size(struct vdev_create_params *param)
240 {
241 return WMI_TLV_HDR_SIZE;
242 }
243
vdev_start_add_mlo_params(uint8_t * buf_ptr,struct vdev_start_params * req)244 static uint8_t *vdev_start_add_mlo_params(uint8_t *buf_ptr,
245 struct vdev_start_params *req)
246 {
247 WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0);
248 return buf_ptr + WMI_TLV_HDR_SIZE;
249 }
250
vdev_start_mlo_params_size(struct vdev_start_params * req)251 static size_t vdev_start_mlo_params_size(struct vdev_start_params *req)
252 {
253 return WMI_TLV_HDR_SIZE;
254 }
255
vdev_start_add_ml_partner_links(uint8_t * buf_ptr,struct vdev_start_params * req)256 static uint8_t *vdev_start_add_ml_partner_links(uint8_t *buf_ptr,
257 struct vdev_start_params *req)
258 {
259 WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0);
260 return buf_ptr + WMI_TLV_HDR_SIZE;
261 }
262
bcn_tmpl_mlo_param_size(struct beacon_tmpl_params * param)263 static size_t bcn_tmpl_mlo_param_size(struct beacon_tmpl_params *param)
264 {
265 return WMI_TLV_HDR_SIZE;
266 }
267
bcn_tmpl_add_ml_partner_links(uint8_t * buf_ptr,struct beacon_tmpl_params * param)268 static uint8_t *bcn_tmpl_add_ml_partner_links(uint8_t *buf_ptr,
269 struct beacon_tmpl_params *param)
270 {
271 WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0);
272 return buf_ptr + WMI_TLV_HDR_SIZE;
273 }
274
bcn_tmpl_ml_info_size(struct beacon_tmpl_params * param)275 static size_t bcn_tmpl_ml_info_size(struct beacon_tmpl_params *param)
276 {
277 return WMI_TLV_HDR_SIZE;
278 }
279
bcn_tmpl_add_ml_info(uint8_t * buf_ptr,struct beacon_tmpl_params * param)280 static uint8_t *bcn_tmpl_add_ml_info(uint8_t *buf_ptr,
281 struct beacon_tmpl_params *param)
282 {
283 WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0);
284 return buf_ptr + WMI_TLV_HDR_SIZE;
285 }
286
prb_resp_tmpl_ml_info_size(struct wmi_probe_resp_params * param)287 static size_t prb_resp_tmpl_ml_info_size(struct wmi_probe_resp_params *param)
288 {
289 return WMI_TLV_HDR_SIZE;
290 }
291
prb_resp_tmpl_add_ml_info(uint8_t * buf_ptr,struct wmi_probe_resp_params * param)292 static uint8_t *prb_resp_tmpl_add_ml_info(uint8_t *buf_ptr,
293 struct wmi_probe_resp_params *param)
294 {
295 WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0);
296 return buf_ptr + WMI_TLV_HDR_SIZE;
297 }
298
peer_create_add_mlo_params(uint8_t * buf_ptr,struct peer_create_params * req)299 static uint8_t *peer_create_add_mlo_params(uint8_t *buf_ptr,
300 struct peer_create_params *req)
301 {
302 WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0);
303 return buf_ptr + WMI_TLV_HDR_SIZE;
304 }
305
peer_create_mlo_params_size(struct peer_create_params * req)306 static size_t peer_create_mlo_params_size(struct peer_create_params *req)
307 {
308 return WMI_TLV_HDR_SIZE;
309 }
310
peer_assoc_mlo_params_size(struct peer_assoc_params * req)311 static size_t peer_assoc_mlo_params_size(struct peer_assoc_params *req)
312 {
313 size_t peer_assoc_mlo_size =
314 WMI_TLV_HDR_SIZE +
315 WMI_TLV_HDR_SIZE;
316
317 return peer_assoc_mlo_size;
318 }
319
peer_assoc_add_mlo_params(uint8_t * buf_ptr,struct peer_assoc_params * req)320 static uint8_t *peer_assoc_add_mlo_params(uint8_t *buf_ptr,
321 struct peer_assoc_params *req)
322 {
323 WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0);
324 return buf_ptr + WMI_TLV_HDR_SIZE;
325 }
326
peer_assoc_add_ml_partner_links(uint8_t * buf_ptr,struct peer_assoc_params * req)327 static uint8_t *peer_assoc_add_ml_partner_links(uint8_t *buf_ptr,
328 struct peer_assoc_params *req)
329 {
330 WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0);
331 return buf_ptr + WMI_TLV_HDR_SIZE;
332 }
333
peer_assoc_t2lm_params_size(struct peer_assoc_params * req)334 static size_t peer_assoc_t2lm_params_size(struct peer_assoc_params *req)
335 {
336 return WMI_TLV_HDR_SIZE;
337 }
338
peer_assoc_add_tid_to_link_map(uint8_t * buf_ptr,struct peer_assoc_params * req)339 static uint8_t *peer_assoc_add_tid_to_link_map(uint8_t *buf_ptr,
340 struct peer_assoc_params *req)
341 {
342 WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0);
343 return buf_ptr + WMI_TLV_HDR_SIZE;
344 }
345
peer_delete_mlo_params_size(struct peer_delete_cmd_params * req)346 static size_t peer_delete_mlo_params_size(struct peer_delete_cmd_params *req)
347 {
348 return WMI_TLV_HDR_SIZE;
349 }
350
peer_delete_add_mlo_params(uint8_t * buf_ptr,struct peer_delete_cmd_params * req)351 static uint8_t *peer_delete_add_mlo_params(uint8_t *buf_ptr,
352 struct peer_delete_cmd_params *req)
353 {
354 WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0);
355 return buf_ptr + WMI_TLV_HDR_SIZE;
356 }
357
vdev_stop_mlo_params_size(struct vdev_stop_params * params)358 static inline size_t vdev_stop_mlo_params_size(struct vdev_stop_params *params)
359 {
360 return WMI_TLV_HDR_SIZE;
361 }
362
vdev_stop_add_mlo_params(uint8_t * buf_ptr,struct vdev_stop_params * params)363 static inline uint8_t *vdev_stop_add_mlo_params(uint8_t *buf_ptr,
364 struct vdev_stop_params *params)
365 {
366 WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0);
367 return buf_ptr + WMI_TLV_HDR_SIZE;
368 }
369
wmi_11be_attach_tlv(wmi_unified_t wmi_handle)370 static void wmi_11be_attach_tlv(wmi_unified_t wmi_handle)
371 { }
372
373 static inline void
extract_mgmt_rx_mlo_link_removal_tlv_count(int num_link_removal_tlvs,struct mgmt_rx_event_params * hdr)374 extract_mgmt_rx_mlo_link_removal_tlv_count(
375 int num_link_removal_tlvs,
376 struct mgmt_rx_event_params *hdr)
377 {
378 }
379 #endif /*WLAN_FEATURE_11BE_MLO*/
380 #endif /*_WMI_UNIFIED_11BE_TLV_H_*/
381