1 /*
2 * Copyright (c) 2019-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
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: wlan_vdev_mgr_tgt_if_tx_api.c
22 *
23 * This file provides definitions for mlme tgt_if APIs, which will
24 * further call target_if/mlme component using LMAC MLME txops
25 */
26 #include <wlan_vdev_mgr_tgt_if_tx_api.h>
27 #include <target_if_vdev_mgr_tx_ops.h>
28 #include "include/wlan_vdev_mlme.h"
29 #include <wlan_mlme_dbg.h>
30 #include <cdp_txrx_cmn_struct.h>
31 #include <cdp_txrx_cmn.h>
32 #include <wlan_lmac_if_api.h>
33 #include <wlan_utility.h>
34 #include <cdp_txrx_ctrl.h>
35 #include <wlan_vdev_mlme_api.h>
36 #include <wlan_dfs_utils_api.h>
37 #include <wlan_vdev_mgr_utils_api.h>
38 #include <wlan_vdev_mgr_ucfg_api.h>
39 #include <wlan_vdev_mlme_main.h>
40
41 static inline struct wlan_lmac_if_mlme_tx_ops
wlan_vdev_mlme_get_lmac_txops(struct wlan_objmgr_vdev * vdev)42 *wlan_vdev_mlme_get_lmac_txops(struct wlan_objmgr_vdev *vdev)
43 {
44 struct wlan_objmgr_psoc *psoc;
45
46 psoc = wlan_vdev_get_psoc(vdev);
47
48 return target_if_vdev_mgr_get_tx_ops(psoc);
49 }
50
51 #ifdef WLAN_FEATURE_11BE_MLO
52 static inline void
wlan_vdev_mgr_fill_mlo_params(struct cdp_vdev_info * vdev_info,struct vdev_create_params * param)53 wlan_vdev_mgr_fill_mlo_params(struct cdp_vdev_info *vdev_info,
54 struct vdev_create_params *param)
55 {
56 vdev_info->mld_mac_addr = param->mlo_mac;
57 }
58
59 #ifdef WLAN_MLO_MULTI_CHIP
60 static inline void
wlan_vdev_mgr_fill_mlo_bridge_vap_params(struct cdp_vdev_info * vdev_info,struct wlan_objmgr_vdev * vdev)61 wlan_vdev_mgr_fill_mlo_bridge_vap_params(struct cdp_vdev_info *vdev_info,
62 struct wlan_objmgr_vdev *vdev)
63 {
64 vdev_info->is_bridge_vap = vdev->vdev_objmgr.mlo_bridge_vdev;
65 }
66 #else
67
68 static inline void
wlan_vdev_mgr_fill_mlo_bridge_vap_params(struct cdp_vdev_info * vdev_info,struct wlan_objmgr_vdev * vdev)69 wlan_vdev_mgr_fill_mlo_bridge_vap_params(struct cdp_vdev_info *vdev_info,
70 struct wlan_objmgr_vdev *vdev)
71 {
72 }
73 #endif
74
75 #else
76 static inline void
wlan_vdev_mgr_fill_mlo_params(struct cdp_vdev_info * vdev_info,struct vdev_create_params * param)77 wlan_vdev_mgr_fill_mlo_params(struct cdp_vdev_info *vdev_info,
78 struct vdev_create_params *param)
79 {
80 }
81
82 static inline void
wlan_vdev_mgr_fill_mlo_bridge_vap_params(struct cdp_vdev_info * vdev_info,struct wlan_objmgr_vdev * vdev)83 wlan_vdev_mgr_fill_mlo_bridge_vap_params(struct cdp_vdev_info *vdev_info,
84 struct wlan_objmgr_vdev *vdev)
85 {
86 }
87 #endif
88
tgt_vdev_mgr_create_send(struct vdev_mlme_obj * mlme_obj,struct vdev_create_params * param)89 QDF_STATUS tgt_vdev_mgr_create_send(
90 struct vdev_mlme_obj *mlme_obj,
91 struct vdev_create_params *param)
92 {
93 QDF_STATUS status = QDF_STATUS_E_FAILURE;
94 struct wlan_lmac_if_mlme_tx_ops *txops;
95 struct wlan_objmgr_psoc *psoc;
96 struct wlan_objmgr_pdev *pdev;
97 struct wlan_objmgr_vdev *vdev;
98 ol_txrx_soc_handle soc_txrx_handle;
99 uint32_t vdev_id;
100 struct cdp_vdev_info vdev_info = { 0 };
101
102 if (!param) {
103 mlme_err("Invalid input");
104 return QDF_STATUS_E_INVAL;
105 }
106
107 vdev = mlme_obj->vdev;
108 vdev_id = wlan_vdev_get_id(vdev);
109 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
110 if (!txops || !txops->vdev_create_send) {
111 mlme_err("VDEV_%d No Tx Ops", vdev_id);
112 return QDF_STATUS_E_INVAL;
113 }
114
115 psoc = wlan_vdev_get_psoc(vdev);
116 if (!psoc) {
117 mlme_err("psoc object is NULL");
118 return QDF_STATUS_E_INVAL;
119 }
120
121 status = txops->vdev_create_send(vdev, param);
122 if (QDF_IS_STATUS_ERROR(status)) {
123 mlme_err("VDEV_%d PSOC_%d Tx Ops Error : %d", vdev_id,
124 wlan_psoc_get_id(psoc), status);
125 return status;
126 }
127
128 vdev_info.vdev_mac_addr = wlan_vdev_mlme_get_macaddr(vdev);
129 vdev_info.vdev_id = vdev_id;
130 vdev_info.vdev_stats_id = param->vdev_stats_id;
131 vdev_info.op_mode = wlan_util_vdev_get_cdp_txrx_opmode(vdev);
132 vdev_info.subtype = wlan_util_vdev_get_cdp_txrx_subtype(vdev);
133 vdev_info.qdf_opmode = wlan_vdev_mlme_get_opmode(vdev);
134 wlan_vdev_mgr_fill_mlo_bridge_vap_params(&vdev_info, vdev);
135 wlan_vdev_mgr_fill_mlo_params(&vdev_info, param);
136 pdev = wlan_vdev_get_pdev(vdev);
137
138 soc_txrx_handle = wlan_psoc_get_dp_handle(psoc);
139 if (!soc_txrx_handle)
140 return QDF_STATUS_E_FAILURE;
141
142
143 return cdp_vdev_attach(soc_txrx_handle,
144 wlan_objmgr_pdev_get_pdev_id(pdev),
145 &vdev_info);
146 }
147
tgt_vdev_mgr_create_complete(struct vdev_mlme_obj * vdev_mlme)148 QDF_STATUS tgt_vdev_mgr_create_complete(struct vdev_mlme_obj *vdev_mlme)
149 {
150 struct wlan_objmgr_vdev *vdev;
151 struct vdev_set_params param = {0};
152 struct wlan_lmac_if_mlme_tx_ops *txops;
153 struct vdev_mlme_inactivity_params *inactivity;
154 uint8_t vdev_id;
155 QDF_STATUS status = QDF_STATUS_SUCCESS;
156
157 vdev = vdev_mlme->vdev;
158 vdev_id = wlan_vdev_get_id(vdev);
159 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
160 if (!txops || !txops->vdev_set_param_send) {
161 mlme_err("VDEV_%d: No Tx Ops", vdev_id);
162 return QDF_STATUS_E_INVAL;
163 }
164
165 inactivity = &vdev_mlme->mgmt.inactivity_params;
166
167 param.vdev_id = vdev_id;
168
169 param.param_value =
170 inactivity->keepalive_min_idle_inactive_time_secs;
171 param.param_id = WLAN_MLME_CFG_MIN_IDLE_INACTIVE_TIME;
172 status = txops->vdev_set_param_send(vdev, ¶m);
173 if (QDF_IS_STATUS_ERROR(status))
174 mlme_err("VDEV_%d: Failed to set min idle inactive time!",
175 vdev_id);
176
177 param.param_value =
178 inactivity->keepalive_max_idle_inactive_time_secs;
179 param.param_id = WLAN_MLME_CFG_MAX_IDLE_INACTIVE_TIME;
180 status = txops->vdev_set_param_send(vdev, ¶m);
181 if (QDF_IS_STATUS_ERROR(status))
182 mlme_err("VDEV_%d: Failed to set max idle inactive time!",
183 vdev_id);
184
185 param.param_value =
186 inactivity->keepalive_max_unresponsive_time_secs;
187 param.param_id = WLAN_MLME_CFG_MAX_UNRESPONSIVE_INACTIVE_TIME;
188 status = txops->vdev_set_param_send(vdev, ¶m);
189 if (QDF_IS_STATUS_ERROR(status))
190 mlme_err("VDEV_%d: Failed to set max unresponse inactive time!",
191 vdev_id);
192
193 return status;
194 }
195
tgt_vdev_mgr_start_send(struct vdev_mlme_obj * mlme_obj,struct vdev_start_params * param)196 QDF_STATUS tgt_vdev_mgr_start_send(
197 struct vdev_mlme_obj *mlme_obj,
198 struct vdev_start_params *param)
199 {
200 QDF_STATUS status;
201 struct wlan_lmac_if_mlme_tx_ops *txops;
202 struct wlan_objmgr_vdev *vdev;
203 uint8_t vdev_id;
204
205 if (!param) {
206 mlme_err("Invalid input");
207 return QDF_STATUS_E_INVAL;
208 }
209
210 vdev = mlme_obj->vdev;
211 vdev_id = wlan_vdev_get_id(vdev);
212 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
213 if (!txops || !txops->vdev_start_send) {
214 mlme_err("VDEV_%d: No Tx Ops", vdev_id);
215 return QDF_STATUS_E_INVAL;
216 }
217
218 status = txops->vdev_start_send(vdev, param);
219 if (QDF_IS_STATUS_ERROR(status))
220 mlme_err("VDEV_%d: Tx Ops Error : %d", vdev_id, status);
221
222 return status;
223 }
224
tgt_vdev_mgr_delete_send(struct vdev_mlme_obj * mlme_obj,struct vdev_delete_params * param)225 QDF_STATUS tgt_vdev_mgr_delete_send(
226 struct vdev_mlme_obj *mlme_obj,
227 struct vdev_delete_params *param)
228 {
229 QDF_STATUS status;
230 struct wlan_lmac_if_mlme_tx_ops *txops;
231 struct wlan_objmgr_vdev *vdev;
232 struct wlan_objmgr_psoc *psoc;
233 ol_txrx_soc_handle soc_txrx_handle;
234 uint8_t vdev_id;
235
236 if (!param) {
237 mlme_err("Invalid input");
238 return QDF_STATUS_E_INVAL;
239 }
240
241 vdev = mlme_obj->vdev;
242 vdev_id = wlan_vdev_get_id(vdev);
243 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
244 if (!txops || !txops->vdev_delete_send) {
245 mlme_err("VDEV_%d: No Tx Ops", vdev_id);
246 return QDF_STATUS_E_INVAL;
247 }
248
249 psoc = wlan_vdev_get_psoc(vdev);
250 soc_txrx_handle = wlan_psoc_get_dp_handle(psoc);
251 if (soc_txrx_handle)
252 cdp_vdev_detach(soc_txrx_handle, wlan_vdev_get_id(vdev),
253 NULL, NULL);
254
255 status = txops->vdev_delete_send(vdev, param);
256 if (QDF_IS_STATUS_ERROR(status))
257 mlme_err("VDEV_%d: Tx Ops Error : %d", vdev_id, status);
258
259 return status;
260 }
261
tgt_vdev_mgr_peer_flush_tids_send(struct vdev_mlme_obj * mlme_obj,struct peer_flush_params * param)262 QDF_STATUS tgt_vdev_mgr_peer_flush_tids_send(
263 struct vdev_mlme_obj *mlme_obj,
264 struct peer_flush_params *param)
265 {
266 QDF_STATUS status;
267 struct wlan_lmac_if_mlme_tx_ops *txops;
268 struct wlan_objmgr_vdev *vdev;
269 uint8_t vdev_id;
270
271 if (!param) {
272 mlme_err("Invalid input");
273 return QDF_STATUS_E_INVAL;
274 }
275
276 vdev = mlme_obj->vdev;
277 vdev_id = wlan_vdev_get_id(vdev);
278 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
279 if (!txops || !txops->peer_flush_tids_send) {
280 mlme_err("VDEV_%d: No Tx Ops", vdev_id);
281 return QDF_STATUS_E_INVAL;
282 }
283
284 status = txops->peer_flush_tids_send(vdev, param);
285 if (QDF_IS_STATUS_ERROR(status))
286 mlme_err("VDEV_%d: Tx Ops Error : %d", vdev_id, status);
287
288 return QDF_STATUS_SUCCESS;
289 }
290
tgt_vdev_mgr_stop_send(struct vdev_mlme_obj * mlme_obj,struct vdev_stop_params * param)291 QDF_STATUS tgt_vdev_mgr_stop_send(
292 struct vdev_mlme_obj *mlme_obj,
293 struct vdev_stop_params *param)
294 {
295 QDF_STATUS status;
296 struct wlan_lmac_if_mlme_tx_ops *txops;
297 struct wlan_objmgr_vdev *vdev;
298 uint8_t vdev_id;
299
300 if (!param) {
301 mlme_err("Invalid input");
302 return QDF_STATUS_E_INVAL;
303 }
304
305 vdev = mlme_obj->vdev;
306 vdev_id = wlan_vdev_get_id(vdev);
307 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
308 if (!txops || !txops->vdev_stop_send) {
309 mlme_err("VDEV_%d: No Tx Ops", vdev_id);
310 return QDF_STATUS_E_INVAL;
311 }
312
313 status = txops->vdev_stop_send(vdev, param);
314 if (QDF_IS_STATUS_ERROR(status))
315 mlme_err("VDEV_%d: Tx Ops Error : %d", vdev_id, status);
316
317 return status;
318 }
319
tgt_vdev_mgr_beacon_stop(struct vdev_mlme_obj * mlme_obj)320 QDF_STATUS tgt_vdev_mgr_beacon_stop(struct vdev_mlme_obj *mlme_obj)
321 {
322 return QDF_STATUS_SUCCESS;
323 }
324
tgt_vdev_mgr_beacon_free(struct vdev_mlme_obj * mlme_obj)325 QDF_STATUS tgt_vdev_mgr_beacon_free(struct vdev_mlme_obj *mlme_obj)
326 {
327 return QDF_STATUS_SUCCESS;
328 }
329
tgt_vdev_mgr_up_send(struct vdev_mlme_obj * mlme_obj,struct vdev_up_params * param)330 QDF_STATUS tgt_vdev_mgr_up_send(
331 struct vdev_mlme_obj *mlme_obj,
332 struct vdev_up_params *param)
333 {
334 QDF_STATUS status;
335 struct wlan_lmac_if_mlme_tx_ops *txops;
336 ol_txrx_soc_handle soc_txrx_handle;
337 struct wlan_objmgr_psoc *psoc;
338 struct wlan_objmgr_vdev *vdev;
339 uint8_t vdev_id;
340
341 if (!param) {
342 mlme_err("Invalid input");
343 return QDF_STATUS_E_INVAL;
344 }
345
346 vdev = mlme_obj->vdev;
347 vdev_id = wlan_vdev_get_id(vdev);
348 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
349 if (!txops || !txops->vdev_up_send) {
350 mlme_err("VDEV_%d: No Tx Ops", vdev_id);
351 return QDF_STATUS_E_INVAL;
352 }
353
354 /* cdp set rx and tx decap type */
355 psoc = wlan_vdev_get_psoc(vdev);
356 soc_txrx_handle = wlan_psoc_get_dp_handle(psoc);
357 if (!soc_txrx_handle || vdev_id == WLAN_INVALID_VDEV_ID)
358 return QDF_STATUS_E_INVAL;
359
360 status = txops->vdev_up_send(vdev, param);
361 if (QDF_IS_STATUS_ERROR(status))
362 mlme_err("VDEV_%d: Tx Ops Error : %d", vdev_id, status);
363
364 return status;
365 }
366
tgt_vdev_mgr_down_send(struct vdev_mlme_obj * mlme_obj,struct vdev_down_params * param)367 QDF_STATUS tgt_vdev_mgr_down_send(
368 struct vdev_mlme_obj *mlme_obj,
369 struct vdev_down_params *param)
370 {
371 QDF_STATUS status;
372 struct wlan_lmac_if_mlme_tx_ops *txops;
373 struct wlan_objmgr_pdev *pdev;
374 struct wlan_objmgr_vdev *vdev;
375 enum QDF_OPMODE opmode;
376 uint8_t vdev_id;
377
378 if (!param) {
379 mlme_err("Invalid input");
380 return QDF_STATUS_E_INVAL;
381 }
382
383 vdev = mlme_obj->vdev;
384 vdev_id = wlan_vdev_get_id(vdev);
385 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
386 if (!txops || !txops->vdev_down_send) {
387 mlme_err("VDEV_%d: No Tx Ops", vdev_id);
388 return QDF_STATUS_E_INVAL;
389 }
390
391 pdev = wlan_vdev_get_pdev(vdev);
392 if (!pdev) {
393 mlme_err("PDEV is NULL");
394 return QDF_STATUS_E_INVAL;
395 }
396
397 opmode = wlan_vdev_mlme_get_opmode(vdev);
398 if (wlan_util_is_vdev_active(pdev, WLAN_VDEV_TARGET_IF_ID) ==
399 QDF_STATUS_SUCCESS) {
400
401 if (opmode == QDF_SAP_MODE)
402 utils_dfs_cancel_precac_timer(pdev);
403 }
404
405 status = txops->vdev_down_send(vdev, param);
406 if (QDF_IS_STATUS_ERROR(status))
407 mlme_err("VDEV_%d: Tx Ops Error : %d", vdev_id, status);
408
409 return status;
410 }
411
tgt_vdev_mgr_set_neighbour_rx_cmd_send(struct vdev_mlme_obj * mlme_obj,struct set_neighbour_rx_params * param)412 QDF_STATUS tgt_vdev_mgr_set_neighbour_rx_cmd_send(
413 struct vdev_mlme_obj *mlme_obj,
414 struct set_neighbour_rx_params *param)
415 {
416 return QDF_STATUS_SUCCESS;
417 }
418
tgt_vdev_mgr_nac_rssi_send(struct vdev_mlme_obj * mlme_obj,struct vdev_scan_nac_rssi_params * param)419 QDF_STATUS tgt_vdev_mgr_nac_rssi_send(
420 struct vdev_mlme_obj *mlme_obj,
421 struct vdev_scan_nac_rssi_params *param)
422 {
423 return QDF_STATUS_SUCCESS;
424 }
425
tgt_vdev_mgr_sifs_trigger_send(struct vdev_mlme_obj * mlme_obj,struct sifs_trigger_param * param)426 QDF_STATUS tgt_vdev_mgr_sifs_trigger_send(
427 struct vdev_mlme_obj *mlme_obj,
428 struct sifs_trigger_param *param)
429 {
430 QDF_STATUS status = QDF_STATUS_E_FAILURE;
431 struct wlan_lmac_if_mlme_tx_ops *txops;
432 struct wlan_objmgr_vdev *vdev;
433 uint8_t vdev_id;
434
435 if (!param) {
436 mlme_err("Invalid input");
437 return QDF_STATUS_E_INVAL;
438 }
439
440 vdev = mlme_obj->vdev;
441 vdev_id = wlan_vdev_get_id(vdev);
442 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
443 if (!txops || !txops->vdev_sifs_trigger_send) {
444 mlme_err("VDEV_%d: No Tx Ops", vdev_id);
445 return QDF_STATUS_E_INVAL;
446 }
447
448 status = txops->vdev_sifs_trigger_send(vdev, param);
449 if (QDF_IS_STATUS_ERROR(status))
450 mlme_err("VDEV_%d: Tx Ops Error : %d", vdev_id, status);
451
452 return status;
453 }
454
tgt_vdev_mgr_set_custom_aggr_size_send(struct vdev_mlme_obj * mlme_obj,struct set_custom_aggr_size_params * param)455 QDF_STATUS tgt_vdev_mgr_set_custom_aggr_size_send(
456 struct vdev_mlme_obj *mlme_obj,
457 struct set_custom_aggr_size_params *param)
458 {
459 QDF_STATUS status;
460 struct wlan_lmac_if_mlme_tx_ops *txops;
461 struct wlan_objmgr_vdev *vdev;
462 uint8_t vdev_id;
463
464 if (!param) {
465 mlme_err("Invalid input");
466 return QDF_STATUS_E_INVAL;
467 }
468
469 vdev = mlme_obj->vdev;
470 vdev_id = wlan_vdev_get_id(vdev);
471 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
472 if (!txops || !txops->vdev_set_custom_aggr_size_cmd_send) {
473 mlme_err("VDEV_%d: No Tx Ops", vdev_id);
474 return QDF_STATUS_E_INVAL;
475 }
476
477 status = txops->vdev_set_custom_aggr_size_cmd_send(vdev, param);
478 if (QDF_IS_STATUS_ERROR(status))
479 mlme_err("VDEV_%d: Tx Ops Error : %d", vdev_id, status);
480
481 return status;
482 }
483
tgt_vdev_mgr_config_ratemask_cmd_send(struct vdev_mlme_obj * mlme_obj,struct config_ratemask_params * param)484 QDF_STATUS tgt_vdev_mgr_config_ratemask_cmd_send(
485 struct vdev_mlme_obj *mlme_obj,
486 struct config_ratemask_params *param)
487 {
488 QDF_STATUS status;
489 struct wlan_lmac_if_mlme_tx_ops *txops;
490 struct wlan_objmgr_vdev *vdev;
491 uint8_t vdev_id;
492
493 vdev = mlme_obj->vdev;
494 vdev_id = wlan_vdev_get_id(vdev);
495 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
496 if (!txops || !txops->vdev_config_ratemask_cmd_send) {
497 mlme_err("VDEV_%d: No Tx Ops", vdev_id);
498 return QDF_STATUS_E_INVAL;
499 }
500
501 status = txops->vdev_config_ratemask_cmd_send(vdev, param);
502 if (QDF_IS_STATUS_ERROR(status))
503 mlme_err("VDEV_%d: Tx Ops Error : %d", vdev_id, status);
504
505 return status;
506 }
507
tgt_vdev_mgr_beacon_cmd_send(struct vdev_mlme_obj * mlme_obj,struct beacon_params * param)508 QDF_STATUS tgt_vdev_mgr_beacon_cmd_send(
509 struct vdev_mlme_obj *mlme_obj,
510 struct beacon_params *param)
511 {
512 return QDF_STATUS_SUCCESS;
513 }
514
tgt_vdev_mgr_beacon_tmpl_send(struct vdev_mlme_obj * mlme_obj,struct beacon_tmpl_params * param)515 QDF_STATUS tgt_vdev_mgr_beacon_tmpl_send(
516 struct vdev_mlme_obj *mlme_obj,
517 struct beacon_tmpl_params *param)
518 {
519 return QDF_STATUS_SUCCESS;
520 }
521
522 #if defined(WLAN_SUPPORT_FILS) || defined(CONFIG_BAND_6GHZ)
tgt_vdev_mgr_fils_enable_send(struct vdev_mlme_obj * mlme_obj,struct config_fils_params * param)523 QDF_STATUS tgt_vdev_mgr_fils_enable_send(
524 struct vdev_mlme_obj *mlme_obj,
525 struct config_fils_params *param)
526 {
527 QDF_STATUS status;
528 struct wlan_lmac_if_mlme_tx_ops *txops;
529 struct wlan_objmgr_vdev *vdev;
530 uint8_t vdev_id;
531
532 vdev = mlme_obj->vdev;
533 vdev_id = wlan_vdev_get_id(vdev);
534 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
535 if (!txops || !txops->vdev_fils_enable_send) {
536 mlme_err("VDEV_%d: No Tx Ops fils Enable", vdev_id);
537 return QDF_STATUS_E_INVAL;
538 }
539
540 status = txops->vdev_fils_enable_send(vdev, param);
541 if (QDF_IS_STATUS_ERROR(status))
542 mlme_err("VDEV_%d: Tx Ops fils Enable Error : %d",
543 vdev_id, status);
544
545 return status;
546 }
547 #endif
548
tgt_vdev_mgr_multiple_vdev_restart_send(struct wlan_objmgr_pdev * pdev,struct multiple_vdev_restart_params * param)549 QDF_STATUS tgt_vdev_mgr_multiple_vdev_restart_send(
550 struct wlan_objmgr_pdev *pdev,
551 struct multiple_vdev_restart_params *param)
552 {
553 QDF_STATUS status = QDF_STATUS_SUCCESS;
554 struct wlan_lmac_if_mlme_tx_ops *txops;
555 struct wlan_objmgr_vdev *vdev;
556
557 if (!param) {
558 mlme_err("Invalid input");
559 return QDF_STATUS_E_INVAL;
560 }
561
562 vdev = wlan_objmgr_get_vdev_by_id_from_pdev(pdev,
563 param->vdev_ids[0],
564 WLAN_VDEV_TARGET_IF_ID);
565 if (vdev) {
566 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
567 if (!txops || !txops->multiple_vdev_restart_req_cmd) {
568 mlme_err("VDEV_%d: No Tx Ops", wlan_vdev_get_id(vdev));
569 wlan_objmgr_vdev_release_ref(vdev,
570 WLAN_VDEV_TARGET_IF_ID);
571 return QDF_STATUS_E_INVAL;
572 }
573
574 status = txops->multiple_vdev_restart_req_cmd(pdev, param);
575 if (QDF_IS_STATUS_ERROR(status))
576 mlme_err("Tx Ops Error: %d", status);
577
578 wlan_objmgr_vdev_release_ref(vdev, WLAN_VDEV_TARGET_IF_ID);
579 }
580
581 return status;
582 }
583
tgt_vdev_mgr_multiple_vdev_set_param(struct wlan_objmgr_pdev * pdev,struct multiple_vdev_set_param * param)584 QDF_STATUS tgt_vdev_mgr_multiple_vdev_set_param(
585 struct wlan_objmgr_pdev *pdev,
586 struct multiple_vdev_set_param *param)
587 {
588 QDF_STATUS status = QDF_STATUS_SUCCESS;
589 struct wlan_lmac_if_mlme_tx_ops *txops;
590 struct wlan_objmgr_vdev *vdev;
591
592 if (!param) {
593 mlme_err("Invalid input");
594 return QDF_STATUS_E_INVAL;
595 }
596
597 vdev = wlan_objmgr_get_vdev_by_id_from_pdev(pdev,
598 param->vdev_ids[0],
599 WLAN_VDEV_TARGET_IF_ID);
600 if (vdev) {
601 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
602 if (!txops || !txops->multiple_vdev_set_param_cmd) {
603 mlme_err("VDEV_%d: No Tx Ops", wlan_vdev_get_id(vdev));
604 wlan_objmgr_vdev_release_ref(vdev,
605 WLAN_VDEV_TARGET_IF_ID);
606 return QDF_STATUS_E_INVAL;
607 }
608
609 status = txops->multiple_vdev_set_param_cmd(pdev, param);
610 if (QDF_IS_STATUS_ERROR(status))
611 mlme_err("Tx Ops Error: %d", status);
612
613 wlan_objmgr_vdev_release_ref(vdev, WLAN_VDEV_TARGET_IF_ID);
614 }
615
616 return status;
617 }
618
tgt_vdev_mgr_set_tx_rx_decap_type(struct vdev_mlme_obj * mlme_obj,enum wlan_mlme_cfg_id param_id,uint32_t value)619 QDF_STATUS tgt_vdev_mgr_set_tx_rx_decap_type(struct vdev_mlme_obj *mlme_obj,
620 enum wlan_mlme_cfg_id param_id,
621 uint32_t value)
622 {
623 QDF_STATUS status;
624 struct wlan_lmac_if_mlme_tx_ops *txops;
625 struct wlan_objmgr_vdev *vdev;
626 uint8_t vdev_id;
627
628 if (!mlme_obj) {
629 mlme_err("Invalid input");
630 return QDF_STATUS_E_INVAL;
631 }
632
633 vdev = mlme_obj->vdev;
634 vdev_id = wlan_vdev_get_id(vdev);
635 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
636 if (!txops || !txops->vdev_set_tx_rx_decap_type) {
637 mlme_err("VDEV_%d: No Tx Ops", vdev_id);
638 return QDF_STATUS_E_INVAL;
639 }
640
641 status = txops->vdev_set_tx_rx_decap_type(vdev, param_id, value);
642 if (QDF_IS_STATUS_ERROR(status))
643 mlme_err("VDEV_%d: Tx Ops Error : %d", vdev_id, status);
644
645 return status;
646 }
647
tgt_vdev_mgr_set_param_send(struct vdev_mlme_obj * mlme_obj,struct vdev_set_params * param)648 QDF_STATUS tgt_vdev_mgr_set_param_send(
649 struct vdev_mlme_obj *mlme_obj,
650 struct vdev_set_params *param)
651 {
652 QDF_STATUS status;
653 struct wlan_lmac_if_mlme_tx_ops *txops;
654 struct wlan_objmgr_vdev *vdev;
655 uint8_t vdev_id;
656
657 if (!param) {
658 mlme_err("Invalid input");
659 return QDF_STATUS_E_INVAL;
660 }
661
662 vdev = mlme_obj->vdev;
663 vdev_id = wlan_vdev_get_id(vdev);
664 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
665 if (!txops || !txops->vdev_set_param_send) {
666 mlme_err("VDEV_%d: No Tx Ops", vdev_id);
667 return QDF_STATUS_E_INVAL;
668 }
669
670 status = txops->vdev_set_param_send(vdev, param);
671 if (QDF_IS_STATUS_ERROR(status))
672 mlme_err("VDEV_%d: Tx Ops Error : %d", vdev_id, status);
673
674 return status;
675 }
676
tgt_vdev_mgr_sta_ps_param_send(struct vdev_mlme_obj * mlme_obj,struct sta_ps_params * param)677 QDF_STATUS tgt_vdev_mgr_sta_ps_param_send(
678 struct vdev_mlme_obj *mlme_obj,
679 struct sta_ps_params *param)
680 {
681 QDF_STATUS status;
682 struct wlan_lmac_if_mlme_tx_ops *txops;
683 struct wlan_objmgr_vdev *vdev;
684 uint8_t vdev_id;
685
686 if (!param) {
687 mlme_err("Invalid input");
688 return QDF_STATUS_E_INVAL;
689 }
690
691 vdev = mlme_obj->vdev;
692 vdev_id = wlan_vdev_get_id(vdev);
693 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
694 if (!txops || !txops->vdev_sta_ps_param_send) {
695 mlme_err("VDEV_%d: No Tx Ops", vdev_id);
696 return QDF_STATUS_E_INVAL;
697 }
698
699 status = txops->vdev_sta_ps_param_send(vdev, param);
700 if (QDF_IS_STATUS_ERROR(status))
701 mlme_err("VDEV_%d: Tx Ops Error : %d", vdev_id, status);
702
703 return status;
704 }
705
tgt_vdev_mgr_peer_delete_all_send(struct vdev_mlme_obj * mlme_obj,struct peer_delete_all_params * param)706 QDF_STATUS tgt_vdev_mgr_peer_delete_all_send(
707 struct vdev_mlme_obj *mlme_obj,
708 struct peer_delete_all_params *param)
709 {
710 QDF_STATUS status;
711 struct wlan_lmac_if_mlme_tx_ops *txops;
712 struct wlan_objmgr_vdev *vdev;
713 uint8_t vdev_id;
714
715 if (!param) {
716 mlme_err("Invalid input");
717 return QDF_STATUS_E_INVAL;
718 }
719
720 vdev = mlme_obj->vdev;
721 vdev_id = wlan_vdev_get_id(vdev);
722 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
723 if (!txops || !txops->peer_delete_all_send) {
724 mlme_err("VDEV_%d: No Tx Ops", vdev_id);
725 return QDF_STATUS_E_INVAL;
726 }
727
728 status = txops->peer_delete_all_send(vdev, param);
729 if (QDF_IS_STATUS_ERROR(status))
730 mlme_err("VDEV_%d: Tx Ops Error : %d", vdev_id, status);
731
732 return status;
733 }
734
735 #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE
736 #ifdef WLAN_FEATURE_11BE_MLO
737 static inline void
tgt_vdev_mgr_fill_mlo_params(struct cdp_vdev_info * vdev_info,struct wlan_objmgr_vdev * vdev)738 tgt_vdev_mgr_fill_mlo_params(struct cdp_vdev_info *vdev_info,
739 struct wlan_objmgr_vdev *vdev)
740 {
741 vdev_info->mld_mac_addr = wlan_vdev_mlme_get_mldaddr(vdev);
742 }
743 #else
744 static inline void
tgt_vdev_mgr_fill_mlo_params(struct cdp_vdev_info * vdev_info,struct wlan_objmgr_vdev * vdev)745 tgt_vdev_mgr_fill_mlo_params(struct cdp_vdev_info *vdev_info,
746 struct wlan_objmgr_vdev *vdev)
747 {
748 }
749 #endif
750
tgt_vdev_mgr_cdp_vdev_attach(struct vdev_mlme_obj * mlme_obj)751 QDF_STATUS tgt_vdev_mgr_cdp_vdev_attach(struct vdev_mlme_obj *mlme_obj)
752 {
753 struct wlan_objmgr_psoc *psoc;
754 struct wlan_objmgr_pdev *pdev;
755 struct wlan_objmgr_vdev *vdev;
756 ol_txrx_soc_handle soc_txrx_handle;
757 struct cdp_vdev_info vdev_info = { 0 };
758
759 vdev = mlme_obj->vdev;
760
761 psoc = wlan_vdev_get_psoc(vdev);
762 if (!psoc) {
763 mlme_err("psoc object is NULL");
764 return QDF_STATUS_E_INVAL;
765 }
766
767 pdev = wlan_vdev_get_pdev(vdev);
768 soc_txrx_handle = wlan_psoc_get_dp_handle(psoc);
769 if (!soc_txrx_handle)
770 return QDF_STATUS_E_FAILURE;
771
772 vdev_info.vdev_mac_addr = wlan_vdev_mlme_get_macaddr(vdev);
773 vdev_info.vdev_id = wlan_vdev_get_id(vdev);
774 vdev_info.op_mode = wlan_util_vdev_get_cdp_txrx_opmode(vdev);
775 vdev_info.subtype = wlan_util_vdev_get_cdp_txrx_subtype(vdev);
776 vdev_info.qdf_opmode = wlan_vdev_mlme_get_opmode(vdev);
777 tgt_vdev_mgr_fill_mlo_params(&vdev_info, vdev);
778 return cdp_vdev_attach(soc_txrx_handle,
779 wlan_objmgr_pdev_get_pdev_id(pdev),
780 &vdev_info);
781 }
782
tgt_vdev_mgr_cdp_vdev_detach(struct vdev_mlme_obj * mlme_obj)783 QDF_STATUS tgt_vdev_mgr_cdp_vdev_detach(struct vdev_mlme_obj *mlme_obj)
784 {
785 struct wlan_objmgr_vdev *vdev;
786 struct wlan_objmgr_psoc *psoc;
787 ol_txrx_soc_handle soc_txrx_handle;
788
789 vdev = mlme_obj->vdev;
790 psoc = wlan_vdev_get_psoc(vdev);
791 soc_txrx_handle = wlan_psoc_get_dp_handle(psoc);
792 if (soc_txrx_handle)
793 return cdp_vdev_detach(soc_txrx_handle, wlan_vdev_get_id(vdev),
794 NULL, NULL);
795
796 return QDF_STATUS_E_INVAL;
797 }
798
tgt_vdev_mgr_send_set_mac_addr(struct qdf_mac_addr mac_addr,struct qdf_mac_addr mld_addr,struct wlan_objmgr_vdev * vdev)799 QDF_STATUS tgt_vdev_mgr_send_set_mac_addr(struct qdf_mac_addr mac_addr,
800 struct qdf_mac_addr mld_addr,
801 struct wlan_objmgr_vdev *vdev)
802 {
803 struct wlan_lmac_if_mlme_tx_ops *txops;
804 uint8_t vdev_id;
805 QDF_STATUS status;
806
807 vdev_id = wlan_vdev_get_id(vdev);
808 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
809 if (!txops || !txops->vdev_send_set_mac_addr) {
810 mlme_err("VDEV_%d: No Tx Ops", vdev_id);
811 return QDF_STATUS_E_INVAL;
812 }
813
814 status = txops->vdev_send_set_mac_addr(mac_addr, mld_addr, vdev);
815 if (QDF_IS_STATUS_ERROR(status))
816 mlme_err("VDEV_%d: Tx Ops Error : %d", vdev_id, status);
817
818 return status;
819 }
820 #endif
821
tgt_vdev_peer_set_param_send(struct wlan_objmgr_vdev * vdev,uint8_t * peer_mac_addr,uint32_t param_id,uint32_t param_value)822 QDF_STATUS tgt_vdev_peer_set_param_send(struct wlan_objmgr_vdev *vdev,
823 uint8_t *peer_mac_addr,
824 uint32_t param_id,
825 uint32_t param_value)
826 {
827 struct wlan_lmac_if_mlme_tx_ops *txops;
828 uint8_t vdev_id;
829 QDF_STATUS status;
830
831 vdev_id = wlan_vdev_get_id(vdev);
832 txops = wlan_vdev_mlme_get_lmac_txops(vdev);
833 if (!txops || !txops->vdev_peer_set_param_send) {
834 mlme_err("VDEV_%d: No Tx Ops", vdev_id);
835 return QDF_STATUS_E_INVAL;
836 }
837
838 status = txops->vdev_peer_set_param_send(vdev, peer_mac_addr,
839 param_id, param_value);
840 if (QDF_IS_STATUS_ERROR(status))
841 mlme_err("VDEV_%d: peer " QDF_MAC_ADDR_FMT " param_id %d param_value %d Error %d",
842 vdev_id, QDF_MAC_ADDR_REF(peer_mac_addr), param_id,
843 param_value, status);
844
845 return status;
846 }
847