xref: /wlan-driver/qca-wifi-host-cmn/umac/mlme/vdev_mgr/core/src/vdev_mgr_ops.c (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2024 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: vdev_mgr_ops.c
22  *
23  * This file provide API definitions for filling data structures
24  * and sending vdev mgmt commands to target_if/mlme
25  */
26 #include "vdev_mgr_ops.h"
27 #include <wlan_objmgr_vdev_obj.h>
28 #include <wlan_vdev_mlme_api.h>
29 #include <wlan_pdev_mlme.h>
30 #include <wlan_mlme_dbg.h>
31 #include <wlan_vdev_mgr_tgt_if_tx_api.h>
32 #include <target_if.h>
33 #include <init_deinit_lmac.h>
34 #include <wlan_lmac_if_api.h>
35 #include <wlan_reg_services_api.h>
36 #include <wlan_dfs_tgt_api.h>
37 #include <wlan_dfs_utils_api.h>
38 #include <wlan_vdev_mgr_ucfg_api.h>
39 #include <qdf_module.h>
40 #include <cdp_txrx_ctrl.h>
41 #ifdef WLAN_FEATURE_11BE_MLO
42 #include <wlan_mlo_mgr_ap.h>
43 #endif
44 #include <wlan_vdev_mgr_utils_api.h>
45 #include <wlan_vdev_mgr_api.h>
46 
47 #ifdef QCA_VDEV_STATS_HW_OFFLOAD_SUPPORT
48 /**
49  * vdev_mgr_alloc_vdev_stats_id() - Allocate vdev stats id for vdev
50  * @vdev: pointer to vdev
51  * @param: pointer to vdev create params
52  *
53  * Return: none
54  */
vdev_mgr_alloc_vdev_stats_id(struct wlan_objmgr_vdev * vdev,struct vdev_create_params * param)55 static void vdev_mgr_alloc_vdev_stats_id(struct wlan_objmgr_vdev *vdev,
56 					 struct vdev_create_params *param)
57 {
58 	struct wlan_objmgr_psoc *psoc;
59 	uint8_t vdev_stats_id = CDP_INVALID_VDEV_STATS_ID;
60 
61 	if ((param->type == WLAN_VDEV_MLME_TYPE_MONITOR) ||
62 	    (param->subtype == WLAN_VDEV_MLME_SUBTYPE_SMART_MONITOR) ||
63 	    (param->special_vdev_mode)) {
64 		param->vdev_stats_id = CDP_INVALID_VDEV_STATS_ID;
65 		return;
66 	}
67 	psoc = wlan_vdev_get_psoc(vdev);
68 	if (!psoc || !wlan_psoc_get_dp_handle(psoc)) {
69 		mlme_err("PSOC or PSOC DP Handle is NULL");
70 		param->vdev_stats_id = CDP_INVALID_VDEV_STATS_ID;
71 		return;
72 	}
73 
74 	/* Get vdev_stats_id from dp_soc via cdp call */
75 	cdp_vdev_alloc_vdev_stats_id(wlan_psoc_get_dp_handle(psoc),
76 				     &vdev_stats_id);
77 
78 	param->vdev_stats_id = vdev_stats_id;
79 }
80 
81 /**
82  * vdev_mgr_reset_vdev_stats_id() -Reset vdev stats id
83  * @vdev: pointer to vdev
84  * @vdev_stats_id: Value of vdev_stats_id
85  *
86  * Return: none
87  */
vdev_mgr_reset_vdev_stats_id(struct wlan_objmgr_vdev * vdev,uint8_t vdev_stats_id)88 static void vdev_mgr_reset_vdev_stats_id(struct wlan_objmgr_vdev *vdev,
89 					 uint8_t vdev_stats_id)
90 {
91 	struct wlan_objmgr_psoc *psoc;
92 
93 	if (vdev_stats_id == CDP_INVALID_VDEV_STATS_ID)
94 		return;
95 
96 	psoc = wlan_vdev_get_psoc(vdev);
97 	if (!psoc || !wlan_psoc_get_dp_handle(psoc)) {
98 		mlme_err("PSOC or PSOC DP Handle is NULL");
99 		return;
100 	}
101 
102 	cdp_vdev_reset_vdev_stats_id(wlan_psoc_get_dp_handle(psoc),
103 				     vdev_stats_id);
104 }
105 #else
vdev_mgr_alloc_vdev_stats_id(struct wlan_objmgr_vdev * vdev,struct vdev_create_params * param)106 static void vdev_mgr_alloc_vdev_stats_id(struct wlan_objmgr_vdev *vdev,
107 					 struct vdev_create_params *param)
108 {
109 	/* Assign Invalid vdev_stats_id */
110 	param->vdev_stats_id = CDP_INVALID_VDEV_STATS_ID;
111 }
112 
vdev_mgr_reset_vdev_stats_id(struct wlan_objmgr_vdev * vdev,uint8_t vdev_stats_id)113 static void vdev_mgr_reset_vdev_stats_id(struct wlan_objmgr_vdev *vdev,
114 					 uint8_t vdev_stats_id)
115 {}
116 #endif /* QCA_VDEV_STATS_HW_OFFLOAD_SUPPORT */
117 
118 #ifdef WLAN_FEATURE_11BE_MLO
119 static inline void
vdev_mgr_param_mld_mac_addr_copy(struct wlan_objmgr_vdev * vdev,struct vdev_create_params * param)120 vdev_mgr_param_mld_mac_addr_copy(struct wlan_objmgr_vdev *vdev,
121 				 struct vdev_create_params *param)
122 {
123 	WLAN_ADDR_COPY(param->mlo_mac, wlan_vdev_mlme_get_mldaddr(vdev));
124 }
125 #else /* WLAN_FEATURE_11BE_MLO */
126 static inline void
vdev_mgr_param_mld_mac_addr_copy(struct wlan_objmgr_vdev * vdev,struct vdev_create_params * param)127 vdev_mgr_param_mld_mac_addr_copy(struct wlan_objmgr_vdev *vdev,
128 				 struct vdev_create_params *param)
129 {
130 }
131 #endif /* WLAN_FEATURE_11BE_MLO */
132 
vdev_mgr_create_param_update(struct vdev_mlme_obj * mlme_obj,struct vdev_create_params * param)133 static QDF_STATUS vdev_mgr_create_param_update(
134 					struct vdev_mlme_obj *mlme_obj,
135 					struct vdev_create_params *param)
136 {
137 	struct wlan_objmgr_pdev *pdev;
138 	struct wlan_objmgr_vdev *vdev;
139 	struct vdev_mlme_mbss_11ax *mbss;
140 
141 	vdev = mlme_obj->vdev;
142 	if (!vdev) {
143 		mlme_err("VDEV is NULL");
144 		return QDF_STATUS_E_INVAL;
145 	}
146 
147 	pdev = wlan_vdev_get_pdev(vdev);
148 	if (!pdev) {
149 		mlme_err("PDEV is NULL");
150 		return QDF_STATUS_E_INVAL;
151 	}
152 
153 	mbss = &mlme_obj->mgmt.mbss_11ax;
154 	param->pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
155 	param->vdev_id = wlan_vdev_get_id(vdev);
156 	param->nss_2g = mlme_obj->proto.generic.nss_2g;
157 	param->nss_5g = mlme_obj->proto.generic.nss_5g;
158 	param->type = mlme_obj->mgmt.generic.type;
159 	param->subtype = mlme_obj->mgmt.generic.subtype;
160 	param->mbssid_flags = mbss->mbssid_flags;
161 	param->vdevid_trans = mbss->vdevid_trans;
162 	param->special_vdev_mode = mlme_obj->mgmt.generic.special_vdev_mode;
163 
164 	vdev_mgr_alloc_vdev_stats_id(vdev, param);
165 	param->vdev_stats_id_valid =
166 	((param->vdev_stats_id != CDP_INVALID_VDEV_STATS_ID) ? true : false);
167 	vdev_mgr_param_mld_mac_addr_copy(vdev, param);
168 
169 	return QDF_STATUS_SUCCESS;
170 }
171 
vdev_mgr_create_send(struct vdev_mlme_obj * mlme_obj)172 QDF_STATUS vdev_mgr_create_send(struct vdev_mlme_obj *mlme_obj)
173 {
174 	QDF_STATUS status;
175 	struct vdev_create_params param = {0};
176 
177 	if (!mlme_obj) {
178 		mlme_err("VDEV_MLME is NULL");
179 		return QDF_STATUS_E_INVAL;
180 	}
181 
182 	status = vdev_mgr_create_param_update(mlme_obj, &param);
183 	if (QDF_IS_STATUS_ERROR(status)) {
184 		mlme_err("Param Update Error: %d", status);
185 		return status;
186 	}
187 
188 	status = tgt_vdev_mgr_create_send(mlme_obj, &param);
189 	if (QDF_IS_STATUS_ERROR(status)) {
190 		/* Reset the vdev_stats_id */
191 		vdev_mgr_reset_vdev_stats_id(mlme_obj->vdev,
192 					     param.vdev_stats_id);
193 	}
194 	return status;
195 }
196 
197 #ifdef MOBILE_DFS_SUPPORT
vdev_mgr_is_opmode_sap_or_p2p_go(enum QDF_OPMODE op_mode)198 static bool vdev_mgr_is_opmode_sap_or_p2p_go(enum QDF_OPMODE op_mode)
199 {
200 	return (op_mode == QDF_SAP_MODE || op_mode == QDF_P2P_GO_MODE);
201 }
202 
vdev_mgr_is_49G_5G_chan_freq(uint16_t chan_freq)203 static bool vdev_mgr_is_49G_5G_chan_freq(uint16_t chan_freq)
204 {
205 	return WLAN_REG_IS_5GHZ_CH_FREQ(chan_freq) ||
206 		WLAN_REG_IS_49GHZ_FREQ(chan_freq);
207 }
208 #else
vdev_mgr_is_opmode_sap_or_p2p_go(enum QDF_OPMODE op_mode)209 static inline bool vdev_mgr_is_opmode_sap_or_p2p_go(enum QDF_OPMODE op_mode)
210 {
211 	return true;
212 }
213 
vdev_mgr_is_49G_5G_chan_freq(uint16_t chan_freq)214 static inline bool vdev_mgr_is_49G_5G_chan_freq(uint16_t chan_freq)
215 {
216 	return true;
217 }
218 #endif
219 
220 #ifdef WLAN_FEATURE_11BE
221 static void
vdev_mgr_start_param_update_11be(struct vdev_mlme_obj * mlme_obj,struct vdev_start_params * param,struct wlan_channel * des_chan)222 vdev_mgr_start_param_update_11be(struct vdev_mlme_obj *mlme_obj,
223 				 struct vdev_start_params *param,
224 				 struct wlan_channel *des_chan)
225 {
226 	param->eht_ops = mlme_obj->proto.eht_ops_info.eht_ops;
227 	param->channel.puncture_bitmap = des_chan->puncture_bitmap;
228 }
229 
230 static inline void
vdev_mgr_set_cur_chan_punc_bitmap(struct wlan_channel * des_chan,uint16_t * puncture_bitmap)231 vdev_mgr_set_cur_chan_punc_bitmap(struct wlan_channel *des_chan,
232 				  uint16_t *puncture_bitmap)
233 {
234 	*puncture_bitmap = des_chan->puncture_bitmap;
235 }
236 #else
237 static void
vdev_mgr_start_param_update_11be(struct vdev_mlme_obj * mlme_obj,struct vdev_start_params * param,struct wlan_channel * des_chan)238 vdev_mgr_start_param_update_11be(struct vdev_mlme_obj *mlme_obj,
239 				 struct vdev_start_params *param,
240 				 struct wlan_channel *des_chan)
241 {
242 }
243 
244 static inline void
vdev_mgr_set_cur_chan_punc_bitmap(struct wlan_channel * des_chan,uint16_t * puncture_bitmap)245 vdev_mgr_set_cur_chan_punc_bitmap(struct wlan_channel *des_chan,
246 				  uint16_t *puncture_bitmap)
247 {
248 	*puncture_bitmap = 0;
249 }
250 #endif
251 
252 #ifdef WLAN_FEATURE_11BE_MLO
253 #ifdef WLAN_MCAST_MLO
254 static inline void
vdev_mgr_start_param_update_mlo_mcast(struct wlan_objmgr_vdev * vdev,struct vdev_start_params * param)255 vdev_mgr_start_param_update_mlo_mcast(struct wlan_objmgr_vdev *vdev,
256 				      struct vdev_start_params *param)
257 {
258 	if (wlan_vdev_mlme_is_mlo_mcast_vdev(vdev))
259 		param->mlo_flags.mlo_mcast_vdev = 1;
260 }
261 #else
262 #define vdev_mgr_start_param_update_mlo_mcast(vdev, param)
263 #endif
264 
265 #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_MLO_MULTI_CHIP)
266 static QDF_STATUS
mlo_ap_append_bridge_vdevs(struct wlan_objmgr_vdev * vdev,struct mlo_vdev_start_partner_links * mlo_ptr,uint8_t p_idx)267 mlo_ap_append_bridge_vdevs(struct wlan_objmgr_vdev *vdev,
268 			   struct mlo_vdev_start_partner_links *mlo_ptr,
269 			   uint8_t p_idx)
270 {
271 	struct wlan_objmgr_vdev *bridge_vdev_list[WLAN_UMAC_MLO_MAX_BRIDGE_VDEVS] = {NULL};
272 	struct wlan_objmgr_pdev *pdev;
273 	uint16_t num_links = 0;
274 	uint8_t i = 0;
275 
276 	if (!vdev || !mlo_ptr)
277 		return QDF_STATUS_E_FAILURE;
278 
279 	if (p_idx > WLAN_UMAC_MLO_MAX_VDEVS)
280 		return QDF_STATUS_E_FAILURE;
281 
282 	mlo_ap_get_bridge_vdev_list(vdev, &num_links, bridge_vdev_list);
283 	if (!num_links)
284 		return QDF_STATUS_SUCCESS;
285 
286 	if (num_links > QDF_ARRAY_SIZE(bridge_vdev_list)) {
287 		mlme_err("Invalid number of VDEVs under AP-MLD num_links:%u",
288 			 num_links);
289 		for (i = 0; i < QDF_ARRAY_SIZE(bridge_vdev_list); i++)
290 			mlo_release_vdev_ref(bridge_vdev_list[i]);
291 		return QDF_STATUS_E_FAILURE;
292 	}
293 
294 	for (i = 0; i < WLAN_UMAC_MLO_MAX_BRIDGE_VDEVS; i++) {
295 		if (bridge_vdev_list[i] == vdev) {
296 			mlo_release_vdev_ref(bridge_vdev_list[i]);
297 			continue;
298 		}
299 
300 		pdev = wlan_vdev_get_pdev(bridge_vdev_list[i]);
301 		mlo_ptr->partner_info[p_idx].vdev_id =
302 			wlan_vdev_get_id(bridge_vdev_list[i]);
303 		mlo_ptr->partner_info[p_idx].hw_mld_link_id =
304 			wlan_mlo_get_pdev_hw_link_id(pdev);
305 		qdf_mem_copy(mlo_ptr->partner_info[p_idx].mac_addr,
306 			     wlan_vdev_mlme_get_macaddr(bridge_vdev_list[i]),
307 			     QDF_MAC_ADDR_SIZE);
308 		mlo_release_vdev_ref(bridge_vdev_list[i]);
309 		p_idx++;
310 	}
311 	mlo_ptr->num_links = p_idx;
312 
313 	return QDF_STATUS_SUCCESS;
314 }
315 #else
316 static inline QDF_STATUS
mlo_ap_append_bridge_vdevs(struct wlan_objmgr_vdev * vdev,struct mlo_vdev_start_partner_links * mlo_ptr,uint8_t p_idx)317 mlo_ap_append_bridge_vdevs(struct wlan_objmgr_vdev *vdev,
318 			   struct mlo_vdev_start_partner_links *mlo_ptr,
319 			   uint8_t p_idx)
320 {
321 	return QDF_STATUS_SUCCESS;
322 }
323 #endif
324 
325 static void
vdev_mgr_start_param_update_mlo_partner(struct wlan_objmgr_vdev * vdev,struct vdev_start_params * param)326 vdev_mgr_start_param_update_mlo_partner(struct wlan_objmgr_vdev *vdev,
327 					struct vdev_start_params *param)
328 {
329 	struct wlan_objmgr_pdev *pdev;
330 	struct mlo_vdev_start_partner_links *mlo_ptr = &param->mlo_partner;
331 	struct wlan_objmgr_vdev *vdev_list[WLAN_UMAC_MLO_MAX_VDEVS] = {NULL};
332 	uint16_t num_links = 0;
333 	uint8_t i = 0, p_idx = 0;
334 	QDF_STATUS status;
335 
336 	if (wlan_vdev_mlme_is_mlo_bridge_vdev(vdev))
337 		mlo_ap_get_vdev_list_no_flag(vdev, &num_links, vdev_list);
338 	else
339 		mlo_ap_get_vdev_list(vdev, &num_links, vdev_list);
340 
341 	if (!num_links) {
342 		mlme_err("No VDEVs under AP-MLD");
343 		return;
344 	}
345 
346 	if (num_links > QDF_ARRAY_SIZE(vdev_list)) {
347 		mlme_err("Invalid number of VDEVs under AP-MLD num_links:%u",
348 			 num_links);
349 		for (i = 0; i < QDF_ARRAY_SIZE(vdev_list); i++)
350 			mlo_release_vdev_ref(vdev_list[i]);
351 		return;
352 	}
353 
354 	for (i = 0; i < num_links; i++) {
355 		if (vdev_list[i] == vdev) {
356 			mlo_release_vdev_ref(vdev_list[i]);
357 			continue;
358 		}
359 
360 		pdev = wlan_vdev_get_pdev(vdev_list[i]);
361 		mlo_ptr->partner_info[p_idx].vdev_id =
362 			wlan_vdev_get_id(vdev_list[i]);
363 		mlo_ptr->partner_info[p_idx].hw_mld_link_id =
364 			wlan_mlo_get_pdev_hw_link_id(pdev);
365 		qdf_mem_copy(mlo_ptr->partner_info[p_idx].mac_addr,
366 			     wlan_vdev_mlme_get_macaddr(vdev_list[i]),
367 			     QDF_MAC_ADDR_SIZE);
368 		mlo_release_vdev_ref(vdev_list[i]);
369 		p_idx++;
370 	}
371 	mlo_ptr->num_links = p_idx;
372 
373 	status = mlo_ap_append_bridge_vdevs(vdev, mlo_ptr, p_idx);
374 	if (QDF_IS_STATUS_ERROR(status))
375 		mlo_err("failed to append bridge vdev to partner link list");
376 }
377 
378 static void
vdev_mgr_start_param_update_mlo(struct vdev_mlme_obj * mlme_obj,struct vdev_start_params * param)379 vdev_mgr_start_param_update_mlo(struct vdev_mlme_obj *mlme_obj,
380 				struct vdev_start_params *param)
381 {
382 	struct wlan_objmgr_vdev *vdev;
383 
384 	vdev = mlme_obj->vdev;
385 	if (!vdev) {
386 		mlme_err("VDEV is NULL");
387 		return;
388 	}
389 
390 	if (!wlan_vdev_mlme_is_mlo_vdev(vdev) &&
391 	    !wlan_vdev_mlme_is_mlo_bridge_vdev(vdev))
392 		return;
393 
394 	param->mlo_flags.mlo_enabled = 1;
395 
396 	if (wlan_vdev_mlme_get_opmode(vdev) == QDF_STA_MODE &&
397 	    !wlan_vdev_mlme_is_mlo_link_vdev(vdev))
398 		param->mlo_flags.mlo_assoc_link = 1;
399 
400 	if ((wlan_vdev_mlme_get_opmode(vdev) == QDF_STA_MODE) &&
401 	    wlan_vdev_mlme_cap_get(vdev, WLAN_VDEV_C_EMLSR_CAP)) {
402 		param->mlo_flags.emlsr_support  = 1;
403 		mlme_debug("eMLSR support=%d", param->mlo_flags.emlsr_support);
404 	}
405 
406 	if (wlan_vdev_mlme_get_opmode(vdev) == QDF_SAP_MODE) {
407 		if (wlan_vdev_mlme_op_flags_get(
408 			vdev, WLAN_VDEV_OP_MLO_LINK_ADD))
409 			param->mlo_flags.mlo_link_add  = 1;
410 
411 		vdev_mgr_start_param_update_mlo_mcast(vdev, param);
412 		vdev_mgr_start_param_update_mlo_partner(vdev, param);
413 	}
414 }
415 #else
416 static void
vdev_mgr_start_param_update_mlo(struct vdev_mlme_obj * mlme_obj,struct vdev_start_params * param)417 vdev_mgr_start_param_update_mlo(struct vdev_mlme_obj *mlme_obj,
418 				struct vdev_start_params *param)
419 {
420 }
421 #endif
422 
423 #ifdef MOBILE_DFS_SUPPORT
424 static void
vdev_mgr_start_param_update_cac_ms(struct wlan_objmgr_vdev * vdev,struct vdev_start_params * param)425 vdev_mgr_start_param_update_cac_ms(struct wlan_objmgr_vdev *vdev,
426 				   struct vdev_start_params *param)
427 {
428 	param->cac_duration_ms =
429 			wlan_util_vdev_mgr_get_cac_timeout_for_vdev(vdev);
430 }
431 
432 static inline
vdev_mgr_is_sta_max_phy_enabled(enum QDF_OPMODE op_mode,struct wlan_objmgr_pdev * pdev)433 bool vdev_mgr_is_sta_max_phy_enabled(enum QDF_OPMODE op_mode,
434 				     struct wlan_objmgr_pdev *pdev)
435 {
436 	return false;
437 }
438 #else
439 static void
vdev_mgr_start_param_update_cac_ms(struct wlan_objmgr_vdev * vdev,struct vdev_start_params * param)440 vdev_mgr_start_param_update_cac_ms(struct wlan_objmgr_vdev *vdev,
441 				   struct vdev_start_params *param)
442 {
443 }
444 
445 static inline
vdev_mgr_is_sta_max_phy_enabled(enum QDF_OPMODE op_mode,struct wlan_objmgr_pdev * pdev)446 bool vdev_mgr_is_sta_max_phy_enabled(enum QDF_OPMODE op_mode,
447 				     struct wlan_objmgr_pdev *pdev)
448 {
449 	return (op_mode == QDF_STA_MODE && wlan_rptr_check_rpt_max_phy(pdev));
450 }
451 #endif
452 
vdev_mgr_start_param_update(struct vdev_mlme_obj * mlme_obj,struct vdev_start_params * param)453 static QDF_STATUS vdev_mgr_start_param_update(
454 					struct vdev_mlme_obj *mlme_obj,
455 					struct vdev_start_params *param)
456 {
457 	struct wlan_channel *des_chan;
458 	uint32_t dfs_reg;
459 	bool is_stadfs_en = false;
460 	struct wlan_objmgr_vdev *vdev;
461 	struct wlan_objmgr_pdev *pdev;
462 	enum QDF_OPMODE op_mode;
463 	bool is_dfs_chan_updated = false;
464 	struct vdev_mlme_mbss_11ax *mbss;
465 	uint16_t puncture_bitmap;
466 
467 	vdev = mlme_obj->vdev;
468 	if (!vdev) {
469 		mlme_err("VDEV is NULL");
470 		return QDF_STATUS_E_INVAL;
471 	}
472 
473 	pdev = wlan_vdev_get_pdev(vdev);
474 	if (!pdev) {
475 		mlme_err("PDEV is NULL");
476 		return QDF_STATUS_E_INVAL;
477 	}
478 
479 	if (wlan_objmgr_pdev_try_get_ref(pdev, WLAN_MLME_SB_ID) !=
480 							QDF_STATUS_SUCCESS) {
481 		mlme_err("Failed to get pdev reference");
482 		return QDF_STATUS_E_FAILURE;
483 	}
484 
485 	des_chan = wlan_vdev_mlme_get_des_chan(vdev);
486 	param->vdev_id = wlan_vdev_get_id(vdev);
487 
488 	op_mode = wlan_vdev_mlme_get_opmode(vdev);
489 	if (!vdev_mgr_is_sta_max_phy_enabled(op_mode, pdev) &&
490 	    vdev_mgr_is_opmode_sap_or_p2p_go(op_mode) &&
491 	    vdev_mgr_is_49G_5G_chan_freq(des_chan->ch_freq)) {
492 		vdev_mgr_set_cur_chan_punc_bitmap(des_chan, &puncture_bitmap);
493 		tgt_dfs_set_current_channel_for_freq(pdev, des_chan->ch_freq,
494 						     des_chan->ch_flags,
495 						     des_chan->ch_flagext,
496 						     des_chan->ch_ieee,
497 						     des_chan->ch_freq_seg1,
498 						     des_chan->ch_freq_seg2,
499 						     des_chan->ch_cfreq1,
500 						     des_chan->ch_cfreq2,
501 						     puncture_bitmap,
502 						     &is_dfs_chan_updated);
503 		if (des_chan->ch_cfreq2)
504 			param->channel.dfs_set_cfreq2 =
505 				utils_is_dfs_cfreq2_ch(pdev);
506 	}
507 
508 	/* The Agile state machine should be stopped only once for the channel
509 	 * change. If  the same channel is being sent to the FW then do
510 	 * not send unnecessary STOP to the state machine.
511 	 */
512 	if (is_dfs_chan_updated)
513 		utils_dfs_agile_sm_deliver_evt(pdev,
514 					       DFS_AGILE_SM_EV_AGILE_STOP);
515 
516 	is_stadfs_en = tgt_dfs_is_stadfs_enabled(pdev);
517 	param->channel.is_stadfs_en = is_stadfs_en;
518 	param->beacon_interval = mlme_obj->proto.generic.beacon_interval;
519 	param->dtim_period = mlme_obj->proto.generic.dtim_period;
520 	param->disable_hw_ack = mlme_obj->mgmt.generic.disable_hw_ack;
521 	param->preferred_rx_streams =
522 		mlme_obj->mgmt.chainmask_info.num_rx_chain;
523 	param->preferred_tx_streams =
524 		mlme_obj->mgmt.chainmask_info.num_tx_chain;
525 
526 	wlan_reg_get_dfs_region(pdev, &dfs_reg);
527 	param->regdomain = dfs_reg;
528 	param->he_ops = mlme_obj->proto.he_ops_info.he_ops;
529 
530 	vdev_mgr_start_param_update_11be(mlme_obj, param, des_chan);
531 	vdev_mgr_start_param_update_mlo(mlme_obj, param);
532 
533 	param->channel.chan_id = des_chan->ch_ieee;
534 	param->channel.pwr = mlme_obj->mgmt.generic.tx_power;
535 	param->channel.mhz = des_chan->ch_freq;
536 	param->channel.half_rate = mlme_obj->mgmt.rate_info.half_rate;
537 	param->channel.quarter_rate = mlme_obj->mgmt.rate_info.quarter_rate;
538 
539 	if (vdev_mgr_is_opmode_sap_or_p2p_go(op_mode))
540 		param->channel.dfs_set = wlan_reg_is_dfs_for_freq(
541 							pdev,
542 							des_chan->ch_freq);
543 
544 	param->channel.is_chan_passive =
545 		utils_is_dfs_chan_for_freq(pdev, param->channel.mhz);
546 	param->channel.allow_ht = mlme_obj->proto.ht_info.allow_ht;
547 	param->channel.allow_vht = mlme_obj->proto.vht_info.allow_vht;
548 	param->channel.phy_mode = mlme_obj->mgmt.generic.phy_mode;
549 	param->channel.cfreq1 = des_chan->ch_cfreq1;
550 	param->channel.cfreq2 = des_chan->ch_cfreq2;
551 	param->channel.maxpower = mlme_obj->mgmt.generic.maxpower;
552 	param->channel.minpower = mlme_obj->mgmt.generic.minpower;
553 	param->channel.maxregpower = mlme_obj->mgmt.generic.maxregpower;
554 	param->channel.antennamax = mlme_obj->mgmt.generic.antennamax;
555 	param->channel.reg_class_id = mlme_obj->mgmt.generic.reg_class_id;
556 	param->bcn_tx_rate_code = vdev_mgr_fetch_ratecode(mlme_obj);
557 	param->ldpc_rx_enabled = mlme_obj->proto.generic.ldpc;
558 
559 	mbss = &mlme_obj->mgmt.mbss_11ax;
560 	param->mbssid_flags = mbss->mbssid_flags;
561 	param->mbssid_multi_group_flag = mbss->is_multi_mbssid;
562 	param->mbssid_multi_group_id   = mbss->grp_id;
563 	param->vdevid_trans = mbss->vdevid_trans;
564 
565 	if (mlme_obj->mgmt.generic.type == WLAN_VDEV_MLME_TYPE_AP) {
566 		param->hidden_ssid = mlme_obj->mgmt.ap.hidden_ssid;
567 		vdev_mgr_start_param_update_cac_ms(vdev, param);
568 	}
569 	wlan_vdev_mlme_get_ssid(vdev, param->ssid.ssid, &param->ssid.length);
570 
571 	wlan_objmgr_pdev_release_ref(pdev, WLAN_MLME_SB_ID);
572 	return QDF_STATUS_SUCCESS;
573 }
574 
vdev_mgr_start_send(struct vdev_mlme_obj * mlme_obj,bool restart)575 QDF_STATUS vdev_mgr_start_send(
576 			struct vdev_mlme_obj *mlme_obj,
577 			bool restart)
578 {
579 	QDF_STATUS status;
580 	struct vdev_start_params param = {0};
581 
582 	if (!mlme_obj) {
583 		mlme_err("VDEV_MLME is NULL");
584 		return QDF_STATUS_E_INVAL;
585 	}
586 
587 	status = vdev_mgr_start_param_update(mlme_obj, &param);
588 	if (QDF_IS_STATUS_ERROR(status)) {
589 		mlme_err("Param Update Error: %d", status);
590 		return status;
591 	}
592 
593 	param.is_restart = restart;
594 	status = tgt_vdev_mgr_start_send(mlme_obj, &param);
595 
596 	return status;
597 }
598 
vdev_mgr_delete_param_update(struct vdev_mlme_obj * mlme_obj,struct vdev_delete_params * param)599 static QDF_STATUS vdev_mgr_delete_param_update(
600 					struct vdev_mlme_obj *mlme_obj,
601 					struct vdev_delete_params *param)
602 {
603 	struct wlan_objmgr_vdev *vdev;
604 
605 	vdev = mlme_obj->vdev;
606 	if (!vdev) {
607 		mlme_err("VDEV is NULL");
608 		return QDF_STATUS_E_INVAL;
609 	}
610 
611 	param->vdev_id = wlan_vdev_get_id(vdev);
612 	return QDF_STATUS_SUCCESS;
613 }
614 
vdev_mgr_delete_send(struct vdev_mlme_obj * mlme_obj)615 QDF_STATUS vdev_mgr_delete_send(struct vdev_mlme_obj *mlme_obj)
616 {
617 	QDF_STATUS status;
618 	struct vdev_delete_params param;
619 
620 	if (!mlme_obj) {
621 		mlme_err("VDEV_MLME is NULL");
622 		return QDF_STATUS_E_INVAL;
623 	}
624 
625 	status = vdev_mgr_delete_param_update(mlme_obj, &param);
626 	if (QDF_IS_STATUS_ERROR(status)) {
627 		mlme_err("Param Update Error: %d", status);
628 		return status;
629 	}
630 
631 	status = tgt_vdev_mgr_delete_send(mlme_obj, &param);
632 
633 	return status;
634 }
635 
vdev_mgr_stop_param_update(struct vdev_mlme_obj * mlme_obj,struct vdev_stop_params * param)636 static QDF_STATUS vdev_mgr_stop_param_update(
637 				struct vdev_mlme_obj *mlme_obj,
638 				struct vdev_stop_params *param)
639 {
640 	struct wlan_objmgr_vdev *vdev;
641 
642 	vdev = mlme_obj->vdev;
643 	if (!vdev) {
644 		mlme_err("VDEV is NULL");
645 		return QDF_STATUS_E_INVAL;
646 	}
647 
648 	param->vdev_id = wlan_vdev_get_id(vdev);
649 	param->is_mlo_link_switch =
650 		wlan_vdev_mlme_is_mlo_link_switch_in_progress(vdev);
651 
652 	return QDF_STATUS_SUCCESS;
653 }
654 
vdev_mgr_stop_send(struct vdev_mlme_obj * mlme_obj)655 QDF_STATUS vdev_mgr_stop_send(struct vdev_mlme_obj *mlme_obj)
656 {
657 	QDF_STATUS status;
658 	struct vdev_stop_params param = {0};
659 
660 	if (!mlme_obj) {
661 		mlme_err("VDEV_MLME is NULL");
662 		return QDF_STATUS_E_INVAL;
663 	}
664 
665 	status = vdev_mgr_stop_param_update(mlme_obj, &param);
666 	if (QDF_IS_STATUS_ERROR(status)) {
667 		mlme_err("Param Update Error: %d", status);
668 		return status;
669 	}
670 
671 	status = tgt_vdev_mgr_stop_send(mlme_obj, &param);
672 
673 	return status;
674 }
675 
vdev_mgr_bcn_tmpl_param_update(struct vdev_mlme_obj * mlme_obj,struct beacon_tmpl_params * param)676 static QDF_STATUS vdev_mgr_bcn_tmpl_param_update(
677 				struct vdev_mlme_obj *mlme_obj,
678 				struct beacon_tmpl_params *param)
679 {
680 	return QDF_STATUS_SUCCESS;
681 }
682 
vdev_mgr_sta_ps_param_update(struct vdev_mlme_obj * mlme_obj,struct sta_ps_params * param)683 static QDF_STATUS vdev_mgr_sta_ps_param_update(
684 				struct vdev_mlme_obj *mlme_obj,
685 				struct sta_ps_params *param)
686 {
687 	struct wlan_objmgr_vdev *vdev;
688 
689 	vdev = mlme_obj->vdev;
690 	param->vdev_id = wlan_vdev_get_id(vdev);
691 	param->param_id = WLAN_MLME_CFG_UAPSD;
692 	param->value = mlme_obj->proto.sta.uapsd_cfg;
693 	return QDF_STATUS_SUCCESS;
694 }
695 
vdev_mgr_up_param_update(struct vdev_mlme_obj * mlme_obj,struct vdev_up_params * param)696 static QDF_STATUS vdev_mgr_up_param_update(
697 				struct vdev_mlme_obj *mlme_obj,
698 				struct vdev_up_params *param)
699 {
700 	struct vdev_mlme_mbss_11ax *mbss;
701 	struct wlan_objmgr_vdev *vdev;
702 	uint8_t bssid[QDF_MAC_ADDR_SIZE];
703 	struct qdf_mac_addr bcast_mac = QDF_MAC_ADDR_BCAST_INIT;
704 
705 	vdev = mlme_obj->vdev;
706 	param->vdev_id = wlan_vdev_get_id(vdev);
707 	param->assoc_id = mlme_obj->proto.sta.assoc_id;
708 
709 	mbss = &mlme_obj->mgmt.mbss_11ax;
710 	wlan_vdev_mgr_get_param_bssid(vdev, bssid);
711 
712 	if (wlan_vdev_mlme_get_opmode(vdev) != QDF_SAP_MODE) {
713 		mlme_debug("trans BSSID " QDF_MAC_ADDR_FMT " non-trans BSSID " QDF_MAC_ADDR_FMT " profile_num %d, profile_idx %d",
714 			   QDF_MAC_ADDR_REF(mbss->trans_bssid),
715 			   QDF_MAC_ADDR_REF(mbss->non_trans_bssid),
716 			  mbss->profile_idx, mbss->profile_num);
717 		if (!qdf_mem_cmp(bcast_mac.bytes, mbss->trans_bssid,
718 				 QDF_MAC_ADDR_SIZE))
719 			goto update_tx_prof;
720 
721 		if ((qdf_mem_cmp(bssid, mbss->trans_bssid, QDF_MAC_ADDR_SIZE)) &&
722 		    (qdf_mem_cmp(bssid, mbss->non_trans_bssid, QDF_MAC_ADDR_SIZE)))
723 			return QDF_STATUS_SUCCESS;
724 	}
725 
726 update_tx_prof:
727 	param->profile_idx = mbss->profile_idx;
728 	param->profile_num = mbss->profile_num;
729 
730 	qdf_mem_copy(param->trans_bssid, mbss->trans_bssid, QDF_MAC_ADDR_SIZE);
731 
732 	return QDF_STATUS_SUCCESS;
733 }
734 
vdev_mgr_configure_fd_for_sap(struct vdev_mlme_obj * mlme_obj)735 QDF_STATUS vdev_mgr_configure_fd_for_sap(struct vdev_mlme_obj *mlme_obj)
736 {
737 	struct config_fils_params fils_param = {0};
738 	struct vdev_mlme_mbss_11ax *mbss;
739 	bool is_non_tx_vdev, is_6g_sap_fd_enabled;
740 
741 	if (!mlme_obj->vdev->vdev_mlme.des_chan ||
742 	    !WLAN_REG_IS_6GHZ_CHAN_FREQ(
743 		mlme_obj->vdev->vdev_mlme.des_chan->ch_freq))
744 		return QDF_STATUS_SUCCESS;
745 	/*
746 	 * In case of a non-tx vdev, 'profile_num' must be greater
747 	 * than 0 indicating one or more non-tx vdev and 'profile_idx'
748 	 * must be in the range [1, 2^n] where n is the max bssid
749 	 * indicator
750 	 */
751 	mbss = &mlme_obj->mgmt.mbss_11ax;
752 	is_non_tx_vdev = mbss && mbss->profile_idx && mbss->profile_num;
753 	if (is_non_tx_vdev)
754 		return QDF_STATUS_SUCCESS;
755 
756 	is_6g_sap_fd_enabled = wlan_vdev_mlme_feat_ext_cap_get(mlme_obj->vdev,
757 						WLAN_VDEV_FEXT_FILS_DISC_6G_SAP);
758 	mlme_debug("SAP FD enabled %d", is_6g_sap_fd_enabled);
759 
760 	fils_param.vdev_id = wlan_vdev_get_id(mlme_obj->vdev);
761 
762 	/* If FD is disabled during runtime, disable the FD in FW */
763 	if (wlan_mlme_is_fd_disabled_in_6ghz_band(mlme_obj->vdev))
764 		goto send_cmd;
765 
766 	if (is_6g_sap_fd_enabled) {
767 		fils_param.fd_period = DEFAULT_FILS_DISCOVERY_PERIOD;
768 	} else if (wlan_vdev_mlme_feat_ext2_cap_get(mlme_obj->vdev,
769 					WLAN_VDEV_FEXT2_20TU_PRB_RESP)) {
770 		fils_param.send_prb_rsp_frame = true;
771 		fils_param.fd_period = DEFAULT_PROBE_RESP_PERIOD;
772 	} else {
773 		mlme_debug("SAP FD and 20TU Prb both are disabled");
774 	}
775 
776 send_cmd:
777 	return tgt_vdev_mgr_fils_enable_send(mlme_obj, &fils_param);
778 }
779 
vdev_mgr_up_send(struct vdev_mlme_obj * mlme_obj)780 QDF_STATUS vdev_mgr_up_send(struct vdev_mlme_obj *mlme_obj)
781 {
782 	QDF_STATUS status;
783 	struct vdev_up_params param = {0};
784 	struct sta_ps_params ps_param = {0};
785 	struct beacon_tmpl_params bcn_tmpl_param = {0};
786 	enum QDF_OPMODE opmode;
787 	struct wlan_objmgr_vdev *vdev;
788 
789 	if (!mlme_obj) {
790 		mlme_err("VDEV_MLME is NULL");
791 		return QDF_STATUS_E_INVAL;
792 	}
793 
794 	vdev = mlme_obj->vdev;
795 	if (!vdev) {
796 		mlme_err("VDEV is NULL");
797 		return QDF_STATUS_E_INVAL;
798 	}
799 
800 	vdev_mgr_up_param_update(mlme_obj, &param);
801 	vdev_mgr_bcn_tmpl_param_update(mlme_obj, &bcn_tmpl_param);
802 
803 	opmode = wlan_vdev_mlme_get_opmode(vdev);
804 	if (opmode == QDF_STA_MODE) {
805 		vdev_mgr_sta_ps_param_update(mlme_obj, &ps_param);
806 		status = tgt_vdev_mgr_sta_ps_param_send(mlme_obj, &ps_param);
807 
808 	}
809 
810 	status = tgt_vdev_mgr_beacon_tmpl_send(mlme_obj, &bcn_tmpl_param);
811 	if (QDF_IS_STATUS_ERROR(status))
812 		return status;
813 
814 	status = tgt_vdev_mgr_up_send(mlme_obj, &param);
815 	if (QDF_IS_STATUS_ERROR(status))
816 		return status;
817 
818 	/* Reset the max channel switch time and last beacon sent time as the
819 	 * VDEV UP command sent to FW.
820 	 */
821 	mlme_obj->mgmt.ap.max_chan_switch_time = 0;
822 	mlme_obj->mgmt.ap.last_bcn_ts_ms = 0;
823 
824 	if (opmode == QDF_SAP_MODE)
825 		status = vdev_mgr_configure_fd_for_sap(mlme_obj);
826 	return status;
827 }
828 
vdev_mgr_down_param_update(struct vdev_mlme_obj * mlme_obj,struct vdev_down_params * param)829 static QDF_STATUS vdev_mgr_down_param_update(
830 					struct vdev_mlme_obj *mlme_obj,
831 					struct vdev_down_params *param)
832 {
833 	struct wlan_objmgr_vdev *vdev;
834 
835 	vdev = mlme_obj->vdev;
836 	if (!vdev) {
837 		mlme_err("VDEV is NULL");
838 		return QDF_STATUS_E_INVAL;
839 	}
840 
841 	param->vdev_id = wlan_vdev_get_id(vdev);
842 
843 	return QDF_STATUS_SUCCESS;
844 }
845 
vdev_mgr_down_send(struct vdev_mlme_obj * mlme_obj)846 QDF_STATUS vdev_mgr_down_send(struct vdev_mlme_obj *mlme_obj)
847 {
848 	QDF_STATUS status;
849 	struct vdev_down_params param = {0};
850 
851 	if (!mlme_obj) {
852 		mlme_err("VDEV_MLME is NULL");
853 		return QDF_STATUS_E_INVAL;
854 	}
855 
856 	status = vdev_mgr_down_param_update(mlme_obj, &param);
857 	if (QDF_IS_STATUS_ERROR(status)) {
858 		mlme_err("Param Update Error: %d", status);
859 		return status;
860 	}
861 
862 	status = tgt_vdev_mgr_down_send(mlme_obj, &param);
863 
864 	return status;
865 }
866 
vdev_mgr_peer_flush_tids_param_update(struct vdev_mlme_obj * mlme_obj,struct peer_flush_params * param,uint8_t * mac,uint32_t peer_tid_bitmap)867 static QDF_STATUS vdev_mgr_peer_flush_tids_param_update(
868 					struct vdev_mlme_obj *mlme_obj,
869 					struct peer_flush_params *param,
870 					uint8_t *mac,
871 					uint32_t peer_tid_bitmap)
872 {
873 	struct wlan_objmgr_vdev *vdev;
874 
875 	vdev = mlme_obj->vdev;
876 	if (!vdev) {
877 		mlme_err("VDEV is NULL");
878 		return QDF_STATUS_E_INVAL;
879 	}
880 
881 	param->vdev_id = wlan_vdev_get_id(vdev);
882 	param->peer_tid_bitmap = peer_tid_bitmap;
883 	qdf_mem_copy(param->peer_mac, mac, QDF_MAC_ADDR_SIZE);
884 	return QDF_STATUS_SUCCESS;
885 }
886 
vdev_mgr_peer_flush_tids_send(struct vdev_mlme_obj * mlme_obj,uint8_t * mac,uint32_t peer_tid_bitmap)887 QDF_STATUS vdev_mgr_peer_flush_tids_send(struct vdev_mlme_obj *mlme_obj,
888 					 uint8_t *mac,
889 					 uint32_t peer_tid_bitmap)
890 {
891 	QDF_STATUS status;
892 	struct peer_flush_params param = {0};
893 
894 	if (!mlme_obj || !mac) {
895 		mlme_err("Invalid input");
896 		return QDF_STATUS_E_INVAL;
897 	}
898 
899 	status = vdev_mgr_peer_flush_tids_param_update(mlme_obj, &param,
900 						       mac, peer_tid_bitmap);
901 	if (QDF_IS_STATUS_ERROR(status)) {
902 		mlme_err("Param Update Error: %d", status);
903 		return status;
904 	}
905 
906 	status = tgt_vdev_mgr_peer_flush_tids_send(mlme_obj, &param);
907 
908 	return status;
909 }
910 
vdev_mgr_multiple_restart_param_update(struct wlan_objmgr_pdev * pdev,struct mlme_channel_param * chan,uint32_t disable_hw_ack,uint32_t * vdev_ids,uint32_t num_vdevs,struct vdev_mlme_mvr_param * mvr_param,struct multiple_vdev_restart_params * param)911 static QDF_STATUS vdev_mgr_multiple_restart_param_update(
912 				struct wlan_objmgr_pdev *pdev,
913 				struct mlme_channel_param *chan,
914 				uint32_t disable_hw_ack,
915 				uint32_t *vdev_ids,
916 				uint32_t num_vdevs,
917 				struct vdev_mlme_mvr_param *mvr_param,
918 				struct multiple_vdev_restart_params *param)
919 {
920 	param->pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
921 	param->requestor_id = MULTIPLE_VDEV_RESTART_REQ_ID;
922 	param->disable_hw_ack = disable_hw_ack;
923 	param->cac_duration_ms = WLAN_DFS_WAIT_MS;
924 	param->num_vdevs = num_vdevs;
925 
926 	qdf_mem_copy(&param->ch_param, chan,
927 		     sizeof(struct mlme_channel_param));
928 
929 	param->vdev_ids = vdev_ids;
930 	param->mvr_param = mvr_param;
931 	param->max_vdevs = wlan_pdev_get_max_vdev_count(pdev);
932 	param->mvr_bmap_enabled = wlan_pdev_nif_feat_cap_get(pdev,
933 				    WLAN_PDEV_F_MULTIVDEV_RESTART_BMAP);
934 
935 	return QDF_STATUS_SUCCESS;
936 }
937 
vdev_mgr_multiple_restart_send(struct wlan_objmgr_pdev * pdev,struct mlme_channel_param * chan,uint32_t disable_hw_ack,uint32_t * vdev_ids,uint32_t num_vdevs,struct vdev_mlme_mvr_param * mvr_param)938 QDF_STATUS vdev_mgr_multiple_restart_send(struct wlan_objmgr_pdev *pdev,
939 					  struct mlme_channel_param *chan,
940 					  uint32_t disable_hw_ack,
941 					  uint32_t *vdev_ids,
942 					  uint32_t num_vdevs,
943 					  struct vdev_mlme_mvr_param *mvr_param)
944 {
945 	struct multiple_vdev_restart_params param = {0};
946 
947 	vdev_mgr_multiple_restart_param_update(pdev, chan,
948 					       disable_hw_ack,
949 					       vdev_ids, num_vdevs,
950 					       mvr_param, &param);
951 
952 	return tgt_vdev_mgr_multiple_vdev_restart_send(pdev, &param);
953 }
954 
955 qdf_export_symbol(vdev_mgr_multiple_restart_send);
956 
vdev_mgr_set_custom_aggr_size_param_update(struct vdev_mlme_obj * mlme_obj,struct set_custom_aggr_size_params * param,bool is_amsdu)957 static QDF_STATUS vdev_mgr_set_custom_aggr_size_param_update(
958 				struct vdev_mlme_obj *mlme_obj,
959 				struct set_custom_aggr_size_params *param,
960 				bool is_amsdu)
961 {
962 	struct wlan_objmgr_vdev *vdev;
963 
964 	vdev = mlme_obj->vdev;
965 	if (!vdev) {
966 		mlme_err("VDEV is NULL");
967 		return QDF_STATUS_E_INVAL;
968 	}
969 
970 	param->aggr_type = is_amsdu ? WLAN_MLME_CUSTOM_AGGR_TYPE_AMSDU
971 				    : WLAN_MLME_CUSTOM_AGGR_TYPE_AMPDU;
972 	/*
973 	 * We are only setting TX params, therefore
974 	 * we are disabling rx_aggr_size
975 	 */
976 	param->rx_aggr_size_disable = true;
977 	param->tx_aggr_size = is_amsdu ? mlme_obj->mgmt.generic.amsdu
978 				       : mlme_obj->mgmt.generic.ampdu;
979 	param->vdev_id = wlan_vdev_get_id(vdev);
980 
981 	return QDF_STATUS_SUCCESS;
982 }
983 
vdev_mgr_set_custom_aggr_size_send(struct vdev_mlme_obj * vdev_mlme,bool is_amsdu)984 QDF_STATUS vdev_mgr_set_custom_aggr_size_send(
985 				struct vdev_mlme_obj *vdev_mlme,
986 				bool is_amsdu)
987 {
988 	QDF_STATUS status;
989 	struct set_custom_aggr_size_params param = {0};
990 
991 	status = vdev_mgr_set_custom_aggr_size_param_update(vdev_mlme,
992 							    &param, is_amsdu);
993 	if (QDF_IS_STATUS_ERROR(status)) {
994 		mlme_err("Param Update Error: %d", status);
995 		return status;
996 	}
997 
998 	return tgt_vdev_mgr_set_custom_aggr_size_send(vdev_mlme, &param);
999 }
1000 
vdev_mgr_peer_delete_all_param_update(struct vdev_mlme_obj * mlme_obj,struct peer_delete_all_params * param)1001 static QDF_STATUS vdev_mgr_peer_delete_all_param_update(
1002 				struct vdev_mlme_obj *mlme_obj,
1003 				struct peer_delete_all_params *param)
1004 {
1005 	struct wlan_objmgr_vdev *vdev;
1006 
1007 	vdev = mlme_obj->vdev;
1008 	if (!vdev) {
1009 		mlme_err("VDEV is NULL");
1010 		return QDF_STATUS_E_INVAL;
1011 	}
1012 
1013 	param->vdev_id = wlan_vdev_get_id(vdev);
1014 	return QDF_STATUS_SUCCESS;
1015 }
1016 
vdev_mgr_peer_delete_all_send(struct vdev_mlme_obj * mlme_obj)1017 QDF_STATUS vdev_mgr_peer_delete_all_send(struct vdev_mlme_obj *mlme_obj)
1018 {
1019 	QDF_STATUS status;
1020 	struct peer_delete_all_params param = {0};
1021 
1022 	if (!mlme_obj) {
1023 		mlme_err("Invalid input");
1024 		return QDF_STATUS_E_INVAL;
1025 	}
1026 
1027 	status = vdev_mgr_peer_delete_all_param_update(mlme_obj, &param);
1028 	if (QDF_IS_STATUS_ERROR(status)) {
1029 		mlme_err("Param Update Error: %d", status);
1030 		return status;
1031 	}
1032 
1033 	status = tgt_vdev_mgr_peer_delete_all_send(mlme_obj, &param);
1034 
1035 	return status;
1036 }
1037 
1038 #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE
vdev_mgr_send_set_mac_addr(struct qdf_mac_addr mac_addr,struct qdf_mac_addr mld_addr,struct wlan_objmgr_vdev * vdev)1039 QDF_STATUS vdev_mgr_send_set_mac_addr(struct qdf_mac_addr mac_addr,
1040 				      struct qdf_mac_addr mld_addr,
1041 				      struct wlan_objmgr_vdev *vdev)
1042 {
1043 	return tgt_vdev_mgr_send_set_mac_addr(mac_addr, mld_addr, vdev);
1044 }
1045 
vdev_mgr_cdp_vdev_attach(struct vdev_mlme_obj * mlme_obj)1046 QDF_STATUS vdev_mgr_cdp_vdev_attach(struct vdev_mlme_obj *mlme_obj)
1047 {
1048 	return tgt_vdev_mgr_cdp_vdev_attach(mlme_obj);
1049 }
1050 
vdev_mgr_cdp_vdev_detach(struct vdev_mlme_obj * mlme_obj)1051 QDF_STATUS vdev_mgr_cdp_vdev_detach(struct vdev_mlme_obj *mlme_obj)
1052 {
1053 	return tgt_vdev_mgr_cdp_vdev_detach(mlme_obj);
1054 }
1055 #endif
1056