1 /*
2  * Copyright (c) 2018-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
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  * DOC: define UCFG APIs exposed by the mlme component
21  */
22 
23 #include "cfg_ucfg_api.h"
24 #include "cfg_mlme_sta.h"
25 #include "wlan_mlme_main.h"
26 #include "wlan_mlme_api.h"
27 #include "wlan_mlme_ucfg_api.h"
28 #include "wlan_objmgr_pdev_obj.h"
29 #include "wlan_mlme_vdev_mgr_interface.h"
30 #include <include/wlan_pdev_mlme.h>
31 #include "wlan_pdev_mlme_api.h"
32 #include <wlan_psoc_mlme_api.h>
33 #include "wlan_vdev_mgr_tgt_if_tx_api.h"
34 #include "wlan_policy_mgr_public_struct.h"
35 #include "spatial_reuse_api.h"
36 
ucfg_mlme_global_init(void)37 QDF_STATUS ucfg_mlme_global_init(void)
38 {
39 	mlme_register_mlme_ext_ops();
40 
41 	return QDF_STATUS_SUCCESS;
42 }
43 
ucfg_mlme_global_deinit(void)44 QDF_STATUS ucfg_mlme_global_deinit(void)
45 {
46 	return QDF_STATUS_SUCCESS;
47 }
48 
ucfg_mlme_init(void)49 QDF_STATUS ucfg_mlme_init(void)
50 {
51 	QDF_STATUS status;
52 
53 	status = wlan_objmgr_register_peer_create_handler(
54 			WLAN_UMAC_COMP_MLME,
55 			mlme_peer_object_created_notification,
56 			NULL);
57 	if (QDF_IS_STATUS_ERROR(status)) {
58 		mlme_legacy_err("peer create register notification failed");
59 		return QDF_STATUS_E_FAILURE;
60 	}
61 
62 	status = wlan_objmgr_register_peer_destroy_handler(
63 			WLAN_UMAC_COMP_MLME,
64 			mlme_peer_object_destroyed_notification,
65 			NULL);
66 	if (QDF_IS_STATUS_ERROR(status)) {
67 		mlme_legacy_err("peer destroy register notification failed");
68 		return QDF_STATUS_E_FAILURE;
69 	}
70 
71 	mlme_register_mlo_ext_ops();
72 	return status;
73 }
74 
ucfg_mlme_deinit(void)75 QDF_STATUS ucfg_mlme_deinit(void)
76 {
77 	QDF_STATUS status;
78 
79 	mlme_unregister_mlo_ext_ops();
80 	status = wlan_objmgr_unregister_peer_destroy_handler(
81 			WLAN_UMAC_COMP_MLME,
82 			mlme_peer_object_destroyed_notification,
83 			NULL);
84 	if (QDF_IS_STATUS_ERROR(status))
85 		mlme_legacy_err("unable to unregister peer destroy handle");
86 
87 	status = wlan_objmgr_unregister_peer_create_handler(
88 			WLAN_UMAC_COMP_MLME,
89 			mlme_peer_object_created_notification,
90 			NULL);
91 	if (QDF_IS_STATUS_ERROR(status))
92 		mlme_legacy_err("unable to unregister peer create handle");
93 
94 	return status;
95 }
96 
ucfg_mlme_psoc_open(struct wlan_objmgr_psoc * psoc)97 QDF_STATUS ucfg_mlme_psoc_open(struct wlan_objmgr_psoc *psoc)
98 {
99 	QDF_STATUS status;
100 
101 	status = mlme_cfg_on_psoc_enable(psoc);
102 	if (!QDF_IS_STATUS_SUCCESS(status))
103 		mlme_legacy_err("Failed to initialize MLME CFG");
104 
105 	return status;
106 }
107 
ucfg_mlme_psoc_close(struct wlan_objmgr_psoc * psoc)108 void ucfg_mlme_psoc_close(struct wlan_objmgr_psoc *psoc)
109 {
110 	/* Clear the MLME CFG Structure */
111 	wlan_mlme_psoc_flush_peer_trans_history(psoc);
112 }
113 
ucfg_mlme_pdev_open(struct wlan_objmgr_pdev * pdev)114 QDF_STATUS ucfg_mlme_pdev_open(struct wlan_objmgr_pdev *pdev)
115 {
116 	struct pdev_mlme_obj *pdev_mlme;
117 
118 	pdev_mlme = wlan_pdev_mlme_get_cmpt_obj(pdev);
119 	if (!pdev_mlme) {
120 		mlme_legacy_err(" PDEV MLME is NULL");
121 		return QDF_STATUS_E_FAILURE;
122 	}
123 	pdev_mlme->mlme_register_ops = mlme_register_vdev_mgr_ops;
124 
125 	return QDF_STATUS_SUCCESS;
126 }
127 
ucfg_mlme_pdev_close(struct wlan_objmgr_pdev * pdev)128 QDF_STATUS ucfg_mlme_pdev_close(struct wlan_objmgr_pdev *pdev)
129 {
130 	return QDF_STATUS_SUCCESS;
131 }
132 
ucfg_mlme_set_ml_link_control_mode(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,uint8_t value)133 void ucfg_mlme_set_ml_link_control_mode(struct wlan_objmgr_psoc *psoc,
134 					uint8_t vdev_id, uint8_t value)
135 {
136 	wlan_mlme_set_ml_link_control_mode(psoc, vdev_id, value);
137 }
138 
ucfg_mlme_set_bt_profile_con(struct wlan_objmgr_psoc * psoc,bool bt_profile_con)139 void ucfg_mlme_set_bt_profile_con(struct wlan_objmgr_psoc *psoc,
140 				  bool bt_profile_con)
141 {
142 	wlan_mlme_set_bt_profile_con(psoc, bt_profile_con);
143 }
144 
ucfg_mlme_get_ml_link_control_mode(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id)145 uint8_t ucfg_mlme_get_ml_link_control_mode(struct wlan_objmgr_psoc *psoc,
146 					   uint8_t vdev_id)
147 {
148 	return wlan_mlme_get_ml_link_control_mode(psoc, vdev_id);
149 }
150 
151 
152 /**
153  * ucfg_mlme_convert_power_cfg_chan_to_freq() - converts channel numbers to
154  * frequencies and copies the triplets to power_freq_data array
155  * @pdev: pointer to pdev object
156  * @max_length: Max length of the power chan data array
157  * @length: length of the data present in power_chan_data array
158  * @power_chan_data: Power data array from which channel numbers needs to be
159  * converted to frequencies
160  * @power_freq_data: Power data array in which the power data needs to be copied
161  * after conversion of channel numbers to frequencies
162  *
163  * power_data is received in the form of (first_channel_number,
164  * number_of_channels, max_tx_power) triplet, convert the channel numbers from
165  * the power_chan_data array to frequencies and copy the triplets
166  * (first_frequency, number_of_channels, max_tx_power) values to
167  * the power_freq_data array
168  *
169  * Return: Number of bytes filled in power_freq_data
170  */
171 
ucfg_mlme_convert_power_cfg_chan_to_freq(struct wlan_objmgr_pdev * pdev,uint32_t max_length,qdf_size_t length,uint8_t * power_chan_data,uint8_t * power_freq_data)172 static uint32_t ucfg_mlme_convert_power_cfg_chan_to_freq(
173 						struct wlan_objmgr_pdev *pdev,
174 						uint32_t max_length,
175 						qdf_size_t length,
176 						uint8_t *power_chan_data,
177 						uint8_t *power_freq_data)
178 {
179 	uint32_t count = 0, rem_length = length, copied_length = 0, i = 0;
180 	struct pwr_channel_info *pwr_cfg_data;
181 
182 	pwr_cfg_data = qdf_mem_malloc(max_length);
183 	if (!pwr_cfg_data)
184 		return 0;
185 
186 	mlme_legacy_debug("max_length %d length %zu", max_length, length);
187 	while ((rem_length >= 3) &&
188 	       (copied_length <= (max_length - (sizeof(struct pwr_channel_info))))) {
189 		pwr_cfg_data[i].first_freq = wlan_reg_legacy_chan_to_freq(
190 						pdev,
191 						power_chan_data[count++]);
192 		pwr_cfg_data[i].num_chan = power_chan_data[count++];
193 		pwr_cfg_data[i].max_tx_pwr = power_chan_data[count++];
194 		copied_length += sizeof(struct pwr_channel_info);
195 		rem_length -= 3;
196 		mlme_legacy_debug("First freq %d num channels %d max tx power %d",
197 				  pwr_cfg_data[i].first_freq,
198 				  pwr_cfg_data[i].num_chan,
199 				  pwr_cfg_data[i].max_tx_pwr);
200 		i++;
201 	}
202 
203 	qdf_mem_zero(power_freq_data, max_length);
204 	qdf_mem_copy(power_freq_data, pwr_cfg_data, copied_length);
205 	qdf_mem_free(pwr_cfg_data);
206 	return copied_length;
207 }
208 
ucfg_mlme_cfg_chan_to_freq(struct wlan_objmgr_pdev * pdev)209 void ucfg_mlme_cfg_chan_to_freq(struct wlan_objmgr_pdev *pdev)
210 {
211 	struct wlan_objmgr_psoc *psoc = wlan_pdev_get_psoc(pdev);
212 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
213 	struct wlan_mlme_cfg *mlme_cfg;
214 	uint32_t converted_data_len = 0;
215 
216 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
217 	if (!mlme_obj)
218 		return;
219 
220 	mlme_cfg = &mlme_obj->cfg;
221 
222 	mlme_cfg->power.max_tx_power_24.max_len = CFG_MAX_TX_POWER_2_4_LEN;
223 	converted_data_len = ucfg_mlme_convert_power_cfg_chan_to_freq(
224 				pdev,
225 				mlme_cfg->power.max_tx_power_24_chan.max_len,
226 				mlme_cfg->power.max_tx_power_24_chan.len,
227 				mlme_cfg->power.max_tx_power_24_chan.data,
228 				mlme_cfg->power.max_tx_power_24.data);
229 	if (!converted_data_len) {
230 		mlme_legacy_err("mlme cfg power 2_4 data chan number to freq failed");
231 		return;
232 	}
233 
234 	mlme_cfg->power.max_tx_power_24.len = converted_data_len;
235 
236 	mlme_cfg->power.max_tx_power_5.max_len = CFG_MAX_TX_POWER_5_LEN;
237 	converted_data_len = ucfg_mlme_convert_power_cfg_chan_to_freq(
238 				pdev,
239 				mlme_cfg->power.max_tx_power_5_chan.max_len,
240 				mlme_cfg->power.max_tx_power_5_chan.len,
241 				mlme_cfg->power.max_tx_power_5_chan.data,
242 				mlme_cfg->power.max_tx_power_5.data);
243 	if (!converted_data_len) {
244 		mlme_legacy_err("mlme cfg power 5 data chan number to freq failed");
245 		return;
246 	}
247 	mlme_cfg->power.max_tx_power_5.len = converted_data_len;
248 }
249 
250 QDF_STATUS
ucfg_mlme_get_sta_keep_alive_period(struct wlan_objmgr_psoc * psoc,uint32_t * val)251 ucfg_mlme_get_sta_keep_alive_period(struct wlan_objmgr_psoc *psoc,
252 				    uint32_t *val)
253 {
254 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
255 
256 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
257 	if (!mlme_obj) {
258 		*val = cfg_default(CFG_INFRA_STA_KEEP_ALIVE_PERIOD);
259 		return QDF_STATUS_E_INVAL;
260 	}
261 
262 	*val = mlme_obj->cfg.sta.sta_keep_alive_period;
263 
264 	return QDF_STATUS_SUCCESS;
265 }
266 
267 QDF_STATUS
ucfg_mlme_get_dfs_master_capability(struct wlan_objmgr_psoc * psoc,bool * val)268 ucfg_mlme_get_dfs_master_capability(struct wlan_objmgr_psoc *psoc,
269 				    bool *val)
270 {
271 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
272 
273 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
274 	if (!mlme_obj) {
275 		*val = cfg_default(CFG_ENABLE_DFS_MASTER_CAPABILITY);
276 		return QDF_STATUS_E_INVAL;
277 	}
278 
279 	*val = mlme_obj->cfg.dfs_cfg.dfs_master_capable;
280 
281 	return QDF_STATUS_SUCCESS;
282 }
283 
284 QDF_STATUS
ucfg_mlme_get_oem_6g_supported(struct wlan_objmgr_psoc * psoc,bool * oem_6g_disable)285 ucfg_mlme_get_oem_6g_supported(struct wlan_objmgr_psoc *psoc,
286 			       bool *oem_6g_disable)
287 {
288 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
289 
290 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
291 	if (!mlme_obj) {
292 		*oem_6g_disable =
293 			cfg_default(CFG_OEM_SIXG_SUPPORT_DISABLE);
294 		return QDF_STATUS_E_INVAL;
295 	}
296 
297 	*oem_6g_disable = mlme_obj->cfg.wifi_pos_cfg.oem_6g_support_disable;
298 
299 	return QDF_STATUS_SUCCESS;
300 }
301 
302 QDF_STATUS
ucfg_mlme_get_fine_time_meas_cap(struct wlan_objmgr_psoc * psoc,uint32_t * fine_time_meas_cap)303 ucfg_mlme_get_fine_time_meas_cap(struct wlan_objmgr_psoc *psoc,
304 				 uint32_t *fine_time_meas_cap)
305 {
306 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
307 
308 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
309 	if (!mlme_obj) {
310 		*fine_time_meas_cap =
311 			cfg_default(CFG_FINE_TIME_MEAS_CAPABILITY);
312 		return QDF_STATUS_E_INVAL;
313 	}
314 
315 	*fine_time_meas_cap = mlme_obj->cfg.wifi_pos_cfg.fine_time_meas_cap;
316 
317 	return QDF_STATUS_SUCCESS;
318 }
319 
320 QDF_STATUS
ucfg_mlme_set_fine_time_meas_cap(struct wlan_objmgr_psoc * psoc,uint32_t fine_time_meas_cap)321 ucfg_mlme_set_fine_time_meas_cap(struct wlan_objmgr_psoc *psoc,
322 				 uint32_t fine_time_meas_cap)
323 {
324 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
325 
326 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
327 	if (!mlme_obj)
328 		return QDF_STATUS_E_INVAL;
329 
330 	mlme_obj->cfg.wifi_pos_cfg.fine_time_meas_cap = fine_time_meas_cap;
331 
332 	return QDF_STATUS_SUCCESS;
333 }
334 
335 static QDF_STATUS
ucfg_mlme_set_vdev_traffic_type(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_vdev * vdev,bool set,uint8_t bit_mask)336 ucfg_mlme_set_vdev_traffic_type(struct wlan_objmgr_psoc *psoc,
337 				struct wlan_objmgr_vdev *vdev, bool set,
338 				uint8_t bit_mask)
339 {
340 	struct mlme_legacy_priv *mlme_priv;
341 	struct vdev_mlme_obj *vdev_mlme;
342 	struct vdev_set_params param = {0};
343 	enum QDF_OPMODE mode;
344 	QDF_STATUS status;
345 	uint8_t vdev_id = wlan_vdev_get_id(vdev);
346 	uint8_t prev_traffic_type;
347 
348 	mode = wlan_vdev_mlme_get_opmode(vdev);
349 	if (mode != QDF_SAP_MODE && mode != QDF_P2P_CLIENT_MODE &&
350 	    mode != QDF_P2P_GO_MODE) {
351 		mlme_legacy_debug("vdev %d: not supported for opmode %d",
352 				  vdev_id, mode);
353 		return QDF_STATUS_E_NOSUPPORT;
354 	}
355 
356 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
357 	if (!vdev_mlme) {
358 		mlme_legacy_err("vdev %d: bit_mask 0x%x, set %d, vdev mlme is null",
359 				vdev_id, bit_mask, set);
360 		return QDF_STATUS_E_FAILURE;
361 	}
362 	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
363 	if (!mlme_priv) {
364 		mlme_legacy_err("vdev %d: bit_mask 0x%x, set %d, vmlme_priv is null",
365 				vdev_id, bit_mask, set);
366 		return QDF_STATUS_E_FAILURE;
367 	}
368 	prev_traffic_type = mlme_priv->vdev_traffic_type;
369 	if (set)
370 		mlme_priv->vdev_traffic_type |= bit_mask;
371 	else
372 		mlme_priv->vdev_traffic_type &= ~bit_mask;
373 
374 	if (prev_traffic_type == mlme_priv->vdev_traffic_type) {
375 		mlme_legacy_debug("vdev %d: No change in value 0x%x, set %d mask 0x%x",
376 				  vdev_id, mlme_priv->vdev_traffic_type, set,
377 				  bit_mask);
378 		return QDF_STATUS_SUCCESS;
379 	}
380 	mlme_legacy_debug("vdev %d: vdev_traffic_type 0x%x (set %d with bit_mask 0x%x)",
381 			  vdev_id, mlme_priv->vdev_traffic_type, set, bit_mask);
382 	param.param_id = wmi_vdev_param_set_traffic_config;
383 	param.vdev_id = vdev_id;
384 	param.param_value = mlme_priv->vdev_traffic_type;
385 	status = tgt_vdev_mgr_set_param_send(vdev_mlme, &param);
386 	policy_mgr_handle_ml_sta_link_on_traffic_type_change(psoc, vdev);
387 
388 	return status;
389 }
390 
ucfg_mlme_connected_chan_stats_request(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id)391 QDF_STATUS ucfg_mlme_connected_chan_stats_request(struct wlan_objmgr_psoc *psoc,
392 						  uint8_t vdev_id)
393 {
394 	return mlme_connected_chan_stats_request(psoc, vdev_id);
395 }
396 
397 bool
ucfg_mlme_is_chwidth_with_notify_supported(struct wlan_objmgr_psoc * psoc)398 ucfg_mlme_is_chwidth_with_notify_supported(struct wlan_objmgr_psoc *psoc)
399 {
400 	return wlan_psoc_nif_fw_ext2_cap_get(psoc,
401 				WLAN_VDEV_PARAM_CHWIDTH_WITH_NOTIFY_SUPPORT);
402 }
403 
ucfg_mlme_update_bss_rate_flags(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,enum phy_ch_width ch_width,uint8_t eht_present,uint8_t he_present,uint8_t vht_present,uint8_t ht_present)404 QDF_STATUS ucfg_mlme_update_bss_rate_flags(struct wlan_objmgr_psoc *psoc,
405 					   uint8_t vdev_id,
406 					   enum phy_ch_width ch_width,
407 					   uint8_t eht_present,
408 					   uint8_t he_present,
409 					   uint8_t vht_present,
410 					   uint8_t ht_present)
411 {
412 	return wlan_mlme_update_bss_rate_flags(psoc, vdev_id, ch_width,
413 					       eht_present, he_present,
414 					       vht_present, ht_present);
415 }
416 
417 QDF_STATUS
ucfg_mlme_send_ch_width_update_with_notify(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_vdev * link_vdev,enum phy_ch_width ch_width,uint8_t link_vdev_id)418 ucfg_mlme_send_ch_width_update_with_notify(struct wlan_objmgr_psoc *psoc,
419 					   struct wlan_objmgr_vdev *link_vdev,
420 					   enum phy_ch_width ch_width,
421 					   uint8_t link_vdev_id)
422 {
423 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
424 
425 	status = wlan_mlme_send_ch_width_update_with_notify(psoc, link_vdev,
426 							    link_vdev_id,
427 							    ch_width);
428 
429 	return status;
430 }
431 
432 QDF_STATUS
ucfg_mlme_set_vdev_wifi_std(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,WMI_HOST_WIFI_STANDARD wifi_std)433 ucfg_mlme_set_vdev_wifi_std(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
434 			    WMI_HOST_WIFI_STANDARD wifi_std)
435 {
436 	struct wlan_objmgr_vdev *vdev;
437 	struct mlme_legacy_priv *mlme_priv;
438 
439 	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
440 						    WLAN_MLME_OBJMGR_ID);
441 	if (!vdev) {
442 		mlme_legacy_err("vdev %d: vdev not found",
443 				vdev_id);
444 		return QDF_STATUS_E_FAILURE;
445 	}
446 
447 	mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev);
448 	if (!mlme_priv) {
449 		mlme_legacy_err("vdev %d: vmlme_priv is null", vdev_id);
450 		wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
451 		return QDF_STATUS_E_FAILURE;
452 	}
453 
454 	mlme_priv->wifi_std = wifi_std;
455 	mlme_priv->is_user_std_set = true;
456 
457 	if (wifi_std < WMI_HOST_WIFI_STANDARD_7)
458 		wlan_vdev_mlme_set_user_dis_eht_flag(vdev, true);
459 	else
460 		wlan_vdev_mlme_set_user_dis_eht_flag(vdev, false);
461 
462 	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
463 
464 	return QDF_STATUS_SUCCESS;
465 }
466 
467 QDF_STATUS
ucfg_mlme_set_vdev_traffic_low_latency(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,bool set)468 ucfg_mlme_set_vdev_traffic_low_latency(struct wlan_objmgr_psoc *psoc,
469 				       uint8_t vdev_id, bool set)
470 {
471 	struct wlan_objmgr_vdev *vdev;
472 	QDF_STATUS status;
473 
474 	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
475 						    WLAN_MLME_OBJMGR_ID);
476 	if (!vdev) {
477 		mlme_legacy_err("vdev %d: vdev not found",
478 				vdev_id);
479 		return QDF_STATUS_E_FAILURE;
480 	}
481 	status = ucfg_mlme_set_vdev_traffic_type(psoc, vdev, set,
482 						 PM_VDEV_TRAFFIC_LOW_LATENCY);
483 	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
484 
485 	return status;
486 }
487 
488 QDF_STATUS
ucfg_mlme_set_vdev_traffic_high_throughput(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,bool set)489 ucfg_mlme_set_vdev_traffic_high_throughput(struct wlan_objmgr_psoc *psoc,
490 					   uint8_t vdev_id, bool set)
491 {
492 	struct wlan_objmgr_vdev *vdev;
493 	QDF_STATUS status;
494 
495 	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
496 						    WLAN_MLME_OBJMGR_ID);
497 	if (!vdev) {
498 		mlme_legacy_err("vdev %d: vdev not found",
499 				vdev_id);
500 		return QDF_STATUS_E_FAILURE;
501 	}
502 	status = ucfg_mlme_set_vdev_traffic_type(psoc, vdev, set,
503 						 PM_VDEV_TRAFFIC_HIGH_TPUT);
504 	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
505 
506 	return status;
507 }
508 
509 QDF_STATUS
ucfg_mlme_get_dfs_disable_channel_switch(struct wlan_objmgr_psoc * psoc,bool * dfs_disable_channel_switch)510 ucfg_mlme_get_dfs_disable_channel_switch(struct wlan_objmgr_psoc *psoc,
511 					 bool *dfs_disable_channel_switch)
512 {
513 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
514 
515 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
516 	if (!mlme_obj) {
517 		*dfs_disable_channel_switch =
518 			cfg_default(CFG_DISABLE_DFS_CH_SWITCH);
519 		return QDF_STATUS_E_INVAL;
520 	}
521 
522 	*dfs_disable_channel_switch =
523 		mlme_obj->cfg.dfs_cfg.dfs_disable_channel_switch;
524 
525 	return QDF_STATUS_SUCCESS;
526 }
527 
528 QDF_STATUS
ucfg_mlme_set_dfs_disable_channel_switch(struct wlan_objmgr_psoc * psoc,bool dfs_disable_channel_switch)529 ucfg_mlme_set_dfs_disable_channel_switch(struct wlan_objmgr_psoc *psoc,
530 					 bool dfs_disable_channel_switch)
531 {
532 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
533 
534 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
535 	if (!mlme_obj) {
536 		return QDF_STATUS_E_INVAL;
537 	}
538 
539 	mlme_obj->cfg.dfs_cfg.dfs_disable_channel_switch =
540 		dfs_disable_channel_switch;
541 
542 	return QDF_STATUS_SUCCESS;
543 }
544 
545 QDF_STATUS
ucfg_mlme_get_dfs_ignore_cac(struct wlan_objmgr_psoc * psoc,bool * dfs_ignore_cac)546 ucfg_mlme_get_dfs_ignore_cac(struct wlan_objmgr_psoc *psoc,
547 			     bool *dfs_ignore_cac)
548 {
549 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
550 
551 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
552 	if (!mlme_obj) {
553 		*dfs_ignore_cac = cfg_default(CFG_IGNORE_CAC);
554 		return QDF_STATUS_E_INVAL;
555 	}
556 
557 	*dfs_ignore_cac = mlme_obj->cfg.dfs_cfg.dfs_ignore_cac;
558 
559 	return QDF_STATUS_SUCCESS;
560 }
561 
562 QDF_STATUS
ucfg_mlme_set_dfs_ignore_cac(struct wlan_objmgr_psoc * psoc,bool dfs_ignore_cac)563 ucfg_mlme_set_dfs_ignore_cac(struct wlan_objmgr_psoc *psoc,
564 			     bool dfs_ignore_cac)
565 {
566 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
567 
568 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
569 	if (!mlme_obj)
570 		return QDF_STATUS_E_INVAL;
571 
572 	mlme_obj->cfg.dfs_cfg.dfs_ignore_cac = dfs_ignore_cac;
573 
574 	return QDF_STATUS_SUCCESS;
575 }
576 
577 QDF_STATUS
ucfg_mlme_get_sap_tx_leakage_threshold(struct wlan_objmgr_psoc * psoc,uint32_t * sap_tx_leakage_threshold)578 ucfg_mlme_get_sap_tx_leakage_threshold(struct wlan_objmgr_psoc *psoc,
579 				       uint32_t *sap_tx_leakage_threshold)
580 {
581 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
582 
583 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
584 	if (!mlme_obj) {
585 		*sap_tx_leakage_threshold =
586 			cfg_default(CFG_SAP_TX_LEAKAGE_THRESHOLD);
587 		return QDF_STATUS_E_INVAL;
588 	}
589 
590 	*sap_tx_leakage_threshold =
591 		mlme_obj->cfg.dfs_cfg.sap_tx_leakage_threshold;
592 
593 	return QDF_STATUS_SUCCESS;
594 }
595 
596 QDF_STATUS
ucfg_mlme_set_sap_tx_leakage_threshold(struct wlan_objmgr_psoc * psoc,uint32_t sap_tx_leakage_threshold)597 ucfg_mlme_set_sap_tx_leakage_threshold(struct wlan_objmgr_psoc *psoc,
598 				       uint32_t sap_tx_leakage_threshold)
599 {
600 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
601 
602 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
603 	if (!mlme_obj)
604 		return QDF_STATUS_E_INVAL;
605 
606 	mlme_obj->cfg.dfs_cfg.sap_tx_leakage_threshold =
607 		sap_tx_leakage_threshold;
608 
609 	return QDF_STATUS_SUCCESS;
610 }
611 
612 QDF_STATUS
ucfg_mlme_get_dfs_pri_multiplier(struct wlan_objmgr_psoc * psoc,uint32_t * dfs_pri_multiplier)613 ucfg_mlme_get_dfs_pri_multiplier(struct wlan_objmgr_psoc *psoc,
614 				 uint32_t *dfs_pri_multiplier)
615 {
616 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
617 
618 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
619 	if (!mlme_obj) {
620 		*dfs_pri_multiplier =
621 			cfg_default(CFG_DFS_RADAR_PRI_MULTIPLIER);
622 		return QDF_STATUS_E_INVAL;
623 	}
624 
625 	*dfs_pri_multiplier =
626 		mlme_obj->cfg.dfs_cfg.dfs_pri_multiplier;
627 
628 	return QDF_STATUS_SUCCESS;
629 }
630 
631 QDF_STATUS
ucfg_mlme_set_dfs_pri_multiplier(struct wlan_objmgr_psoc * psoc,uint32_t dfs_pri_multiplier)632 ucfg_mlme_set_dfs_pri_multiplier(struct wlan_objmgr_psoc *psoc,
633 				 uint32_t dfs_pri_multiplier)
634 {
635 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
636 
637 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
638 	if (!mlme_obj)
639 		return QDF_STATUS_E_INVAL;
640 
641 	mlme_obj->cfg.dfs_cfg.dfs_pri_multiplier =
642 		dfs_pri_multiplier;
643 
644 	return QDF_STATUS_SUCCESS;
645 }
646 
647 QDF_STATUS
ucfg_mlme_get_dfs_filter_offload(struct wlan_objmgr_psoc * psoc,bool * dfs_filter_offload)648 ucfg_mlme_get_dfs_filter_offload(struct wlan_objmgr_psoc *psoc,
649 				 bool *dfs_filter_offload)
650 {
651 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
652 
653 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
654 	if (!mlme_obj) {
655 		*dfs_filter_offload =
656 			cfg_default(CFG_ENABLE_DFS_PHYERR_FILTEROFFLOAD);
657 		return QDF_STATUS_E_INVAL;
658 	}
659 
660 	*dfs_filter_offload = mlme_obj->cfg.dfs_cfg.dfs_filter_offload;
661 
662 	return QDF_STATUS_SUCCESS;
663 }
664 
665 QDF_STATUS
ucfg_mlme_set_dfs_filter_offload(struct wlan_objmgr_psoc * psoc,bool dfs_filter_offload)666 ucfg_mlme_set_dfs_filter_offload(struct wlan_objmgr_psoc *psoc,
667 				 bool dfs_filter_offload)
668 {
669 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
670 
671 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
672 	if (!mlme_obj)
673 		return QDF_STATUS_E_INVAL;
674 
675 	mlme_obj->cfg.dfs_cfg.dfs_filter_offload = dfs_filter_offload;
676 
677 	return QDF_STATUS_SUCCESS;
678 }
679 
680 QDF_STATUS
ucfg_mlme_get_pmkid_modes(struct wlan_objmgr_psoc * psoc,uint32_t * val)681 ucfg_mlme_get_pmkid_modes(struct wlan_objmgr_psoc *psoc,
682 			  uint32_t *val)
683 {
684 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
685 
686 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
687 	if (!mlme_obj) {
688 		*val = cfg_default(CFG_PMKID_MODES);
689 		return QDF_STATUS_E_INVAL;
690 	}
691 
692 	*val = mlme_obj->cfg.sta.pmkid_modes;
693 
694 	return QDF_STATUS_SUCCESS;
695 }
696 
697 QDF_STATUS
ucfg_mlme_set_pmkid_modes(struct wlan_objmgr_psoc * psoc,uint32_t val)698 ucfg_mlme_set_pmkid_modes(struct wlan_objmgr_psoc *psoc,
699 			  uint32_t val)
700 {
701 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
702 
703 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
704 	if (!mlme_obj)
705 		return QDF_STATUS_E_INVAL;
706 
707 	mlme_obj->cfg.sta.pmkid_modes = val;
708 
709 	return QDF_STATUS_SUCCESS;
710 }
711 
712 QDF_STATUS
ucfg_mlme_get_dot11p_mode(struct wlan_objmgr_psoc * psoc,enum dot11p_mode * out_mode)713 ucfg_mlme_get_dot11p_mode(struct wlan_objmgr_psoc *psoc,
714 			  enum dot11p_mode *out_mode)
715 {
716 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
717 
718 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
719 	if (!mlme_obj) {
720 		*out_mode = cfg_default(CFG_DOT11P_MODE);
721 		return QDF_STATUS_E_INVAL;
722 	}
723 
724 	*out_mode = mlme_obj->cfg.sta.dot11p_mode;
725 
726 	return QDF_STATUS_SUCCESS;
727 }
728 
729 QDF_STATUS
ucfg_mlme_get_go_cts2self_for_sta(struct wlan_objmgr_psoc * psoc,bool * val)730 ucfg_mlme_get_go_cts2self_for_sta(struct wlan_objmgr_psoc *psoc,
731 				  bool *val)
732 {
733 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
734 
735 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
736 	if (!mlme_obj) {
737 		*val = cfg_default(CFG_ENABLE_GO_CTS2SELF_FOR_STA);
738 		return QDF_STATUS_E_INVAL;
739 	}
740 
741 	*val = mlme_obj->cfg.sta.enable_go_cts2self_for_sta;
742 
743 	return QDF_STATUS_SUCCESS;
744 }
745 
746 QDF_STATUS
ucfg_mlme_get_qcn_ie_support(struct wlan_objmgr_psoc * psoc,bool * val)747 ucfg_mlme_get_qcn_ie_support(struct wlan_objmgr_psoc *psoc,
748 			     bool *val)
749 {
750 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
751 
752 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
753 	if (!mlme_obj) {
754 		*val = cfg_default(CFG_QCN_IE_SUPPORT);
755 		return QDF_STATUS_E_INVAL;
756 	}
757 
758 	*val = mlme_obj->cfg.sta.qcn_ie_support;
759 
760 	return QDF_STATUS_SUCCESS;
761 }
762 
763 QDF_STATUS
ucfg_mlme_get_tgt_gtx_usr_cfg(struct wlan_objmgr_psoc * psoc,uint32_t * val)764 ucfg_mlme_get_tgt_gtx_usr_cfg(struct wlan_objmgr_psoc *psoc,
765 			      uint32_t *val)
766 {
767 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
768 
769 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
770 	if (!mlme_obj) {
771 		*val = cfg_default(CFG_TGT_GTX_USR_CFG);
772 		return QDF_STATUS_E_INVAL;
773 	}
774 
775 	*val = mlme_obj->cfg.sta.tgt_gtx_usr_cfg;
776 
777 	return QDF_STATUS_SUCCESS;
778 }
779 
780 QDF_STATUS
ucfg_mlme_is_override_ht20_40_24g(struct wlan_objmgr_psoc * psoc,bool * val)781 ucfg_mlme_is_override_ht20_40_24g(struct wlan_objmgr_psoc *psoc, bool *val)
782 {
783 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
784 
785 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
786 	if (!mlme_obj) {
787 		*val = cfg_default(CFG_OBSS_HT40_OVERRIDE_HT40_20_24GHZ);
788 		return QDF_STATUS_E_INVAL;
789 	}
790 	*val = mlme_obj->cfg.obss_ht40.is_override_ht20_40_24g;
791 
792 	return QDF_STATUS_SUCCESS;
793 }
794 
795 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
796 QDF_STATUS
ucfg_mlme_get_roam_disable_config(struct wlan_objmgr_psoc * psoc,uint32_t * val)797 ucfg_mlme_get_roam_disable_config(struct wlan_objmgr_psoc *psoc,
798 				  uint32_t *val)
799 {
800 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
801 
802 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
803 	if (!mlme_obj) {
804 		*val = cfg_default(CFG_STA_DISABLE_ROAM);
805 		return QDF_STATUS_E_INVAL;
806 	}
807 
808 	*val = mlme_obj->cfg.lfr.sta_roam_disable;
809 
810 	return QDF_STATUS_SUCCESS;
811 }
812 
813 QDF_STATUS
ucfg_mlme_get_roaming_offload(struct wlan_objmgr_psoc * psoc,bool * val)814 ucfg_mlme_get_roaming_offload(struct wlan_objmgr_psoc *psoc,
815 			      bool *val)
816 {
817 	return wlan_mlme_get_roaming_offload(psoc, val);
818 }
819 
820 QDF_STATUS
ucfg_mlme_set_roaming_offload(struct wlan_objmgr_psoc * psoc,bool val)821 ucfg_mlme_set_roaming_offload(struct wlan_objmgr_psoc *psoc,
822 			      bool val)
823 {
824 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
825 
826 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
827 	if (!mlme_obj)
828 		return QDF_STATUS_E_INVAL;
829 
830 	mlme_obj->cfg.lfr.lfr3_roaming_offload = val;
831 
832 	return QDF_STATUS_SUCCESS;
833 }
834 #endif
835 
836 QDF_STATUS
ucfg_mlme_is_mawc_enabled(struct wlan_objmgr_psoc * psoc,bool * val)837 ucfg_mlme_is_mawc_enabled(struct wlan_objmgr_psoc *psoc, bool *val)
838 {
839 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
840 
841 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
842 	if (!mlme_obj) {
843 		*val = cfg_default(CFG_LFR_MAWC_FEATURE_ENABLED);
844 		return QDF_STATUS_E_INVAL;
845 	}
846 	*val = mlme_obj->cfg.lfr.mawc_enabled;
847 
848 	return QDF_STATUS_SUCCESS;
849 }
850 
851 QDF_STATUS
ucfg_mlme_set_mawc_enabled(struct wlan_objmgr_psoc * psoc,bool val)852 ucfg_mlme_set_mawc_enabled(struct wlan_objmgr_psoc *psoc, bool val)
853 {
854 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
855 
856 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
857 	if (!mlme_obj)
858 		return QDF_STATUS_E_INVAL;
859 
860 	mlme_obj->cfg.lfr.mawc_enabled = val;
861 
862 	return QDF_STATUS_SUCCESS;
863 }
864 
865 QDF_STATUS
ucfg_mlme_is_fast_transition_enabled(struct wlan_objmgr_psoc * psoc,bool * val)866 ucfg_mlme_is_fast_transition_enabled(struct wlan_objmgr_psoc *psoc,
867 				     bool *val)
868 {
869 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
870 
871 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
872 	if (!mlme_obj) {
873 		*val = cfg_default(CFG_LFR_FAST_TRANSITION_ENABLED);
874 		return QDF_STATUS_E_INVAL;
875 	}
876 
877 	*val = mlme_obj->cfg.lfr.fast_transition_enabled;
878 
879 	return QDF_STATUS_SUCCESS;
880 }
881 
882 QDF_STATUS
ucfg_mlme_set_fast_transition_enabled(struct wlan_objmgr_psoc * psoc,bool val)883 ucfg_mlme_set_fast_transition_enabled(struct wlan_objmgr_psoc *psoc,
884 				      bool val)
885 {
886 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
887 
888 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
889 	if (!mlme_obj)
890 		return QDF_STATUS_E_INVAL;
891 
892 	mlme_obj->cfg.lfr.fast_transition_enabled = val;
893 
894 	return QDF_STATUS_SUCCESS;
895 }
896 
897 #ifdef WLAN_ADAPTIVE_11R
898 QDF_STATUS
ucfg_mlme_set_tgt_adaptive_11r_cap(struct wlan_objmgr_psoc * psoc,bool val)899 ucfg_mlme_set_tgt_adaptive_11r_cap(struct wlan_objmgr_psoc *psoc,
900 				   bool val)
901 {
902 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
903 
904 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
905 	if (!mlme_obj)
906 		return QDF_STATUS_E_INVAL;
907 
908 	mlme_obj->cfg.lfr.tgt_adaptive_11r_cap = val;
909 
910 	return QDF_STATUS_SUCCESS;
911 }
912 
913 QDF_STATUS
ucfg_mlme_get_adaptive11r_enabled(struct wlan_objmgr_psoc * psoc,bool * val)914 ucfg_mlme_get_adaptive11r_enabled(struct wlan_objmgr_psoc *psoc, bool *val)
915 {
916 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
917 
918 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
919 	if (!mlme_obj) {
920 		*val = cfg_default(CFG_ADAPTIVE_11R);
921 		return QDF_STATUS_E_INVAL;
922 	}
923 
924 	*val = mlme_obj->cfg.lfr.enable_adaptive_11r;
925 
926 	return QDF_STATUS_SUCCESS;
927 }
928 #endif
929 
930 QDF_STATUS
ucfg_mlme_is_roam_scan_offload_enabled(struct wlan_objmgr_psoc * psoc,bool * val)931 ucfg_mlme_is_roam_scan_offload_enabled(struct wlan_objmgr_psoc *psoc,
932 				       bool *val)
933 {
934 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
935 
936 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
937 	if (!mlme_obj) {
938 		*val = cfg_default(CFG_LFR_ROAM_SCAN_OFFLOAD_ENABLED);
939 		return QDF_STATUS_E_INVAL;
940 	}
941 
942 	*val = mlme_obj->cfg.lfr.roam_scan_offload_enabled;
943 
944 	return QDF_STATUS_SUCCESS;
945 }
946 
947 QDF_STATUS
ucfg_mlme_set_roam_scan_offload_enabled(struct wlan_objmgr_psoc * psoc,bool val)948 ucfg_mlme_set_roam_scan_offload_enabled(struct wlan_objmgr_psoc *psoc,
949 					bool val)
950 {
951 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
952 
953 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
954 	if (!mlme_obj)
955 		return QDF_STATUS_E_INVAL;
956 
957 	mlme_obj->cfg.lfr.roam_scan_offload_enabled = val;
958 
959 	return QDF_STATUS_SUCCESS;
960 }
961 
962 QDF_STATUS
ucfg_mlme_get_neighbor_scan_max_chan_time(struct wlan_objmgr_psoc * psoc,uint16_t * val)963 ucfg_mlme_get_neighbor_scan_max_chan_time(struct wlan_objmgr_psoc *psoc,
964 					  uint16_t *val)
965 {
966 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
967 
968 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
969 	if (!mlme_obj) {
970 		*val = cfg_default(CFG_LFR_NEIGHBOR_SCAN_MAX_CHAN_TIME);
971 		return QDF_STATUS_E_INVAL;
972 	}
973 
974 	*val = mlme_obj->cfg.lfr.neighbor_scan_max_chan_time;
975 
976 	return QDF_STATUS_SUCCESS;
977 }
978 
979 QDF_STATUS
ucfg_mlme_get_neighbor_scan_min_chan_time(struct wlan_objmgr_psoc * psoc,uint16_t * val)980 ucfg_mlme_get_neighbor_scan_min_chan_time(struct wlan_objmgr_psoc *psoc,
981 					  uint16_t *val)
982 {
983 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
984 
985 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
986 	if (!mlme_obj) {
987 		*val = cfg_default(CFG_LFR_NEIGHBOR_SCAN_MIN_CHAN_TIME);
988 		return QDF_STATUS_E_INVAL;
989 	}
990 
991 	*val = mlme_obj->cfg.lfr.neighbor_scan_min_chan_time;
992 
993 	return QDF_STATUS_SUCCESS;
994 }
995 
996 QDF_STATUS
ucfg_mlme_get_delay_before_vdev_stop(struct wlan_objmgr_psoc * psoc,uint8_t * val)997 ucfg_mlme_get_delay_before_vdev_stop(struct wlan_objmgr_psoc *psoc,
998 				     uint8_t *val)
999 {
1000 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1001 
1002 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1003 	if (!mlme_obj) {
1004 		*val = cfg_default(CFG_LFR_DELAY_BEFORE_VDEV_STOP);
1005 		return QDF_STATUS_E_INVAL;
1006 	}
1007 
1008 	*val = mlme_obj->cfg.lfr.delay_before_vdev_stop;
1009 
1010 	return QDF_STATUS_SUCCESS;
1011 }
1012 
1013 QDF_STATUS
ucfg_mlme_get_roam_bmiss_final_bcnt(struct wlan_objmgr_psoc * psoc,uint8_t * val)1014 ucfg_mlme_get_roam_bmiss_final_bcnt(struct wlan_objmgr_psoc *psoc,
1015 				    uint8_t *val)
1016 {
1017 	return wlan_mlme_get_roam_bmiss_final_bcnt(psoc, val);
1018 }
1019 
1020 bool
ucfg_mlme_validate_roam_bmiss_final_bcnt(uint32_t bmiss_final_bcnt)1021 ucfg_mlme_validate_roam_bmiss_final_bcnt(uint32_t bmiss_final_bcnt)
1022 {
1023 	bool is_valid = true;
1024 	uint32_t min, max;
1025 
1026 	if (!cfg_in_range(CFG_LFR_ROAM_BMISS_FINAL_BCNT,
1027 			  bmiss_final_bcnt)) {
1028 		min = (cfg_min(CFG_LFR_ROAM_BMISS_FINAL_BCNT));
1029 		max = (cfg_max(CFG_LFR_ROAM_BMISS_FINAL_BCNT));
1030 		mlme_legacy_err("bmiss final bcnt %d is out of range "
1031 				"(Min: %d Max: %d)",
1032 				bmiss_final_bcnt, min, max);
1033 		is_valid = false;
1034 	}
1035 
1036 	return is_valid;
1037 }
1038 
ucfg_mlme_get_dual_sta_roaming_enabled(struct wlan_objmgr_psoc * psoc)1039 bool ucfg_mlme_get_dual_sta_roaming_enabled(struct wlan_objmgr_psoc *psoc)
1040 {
1041 	return wlan_mlme_get_dual_sta_roaming_enabled(psoc);
1042 }
1043 
1044 QDF_STATUS
ucfg_mlme_get_roam_bmiss_first_bcnt(struct wlan_objmgr_psoc * psoc,uint8_t * val)1045 ucfg_mlme_get_roam_bmiss_first_bcnt(struct wlan_objmgr_psoc *psoc,
1046 				    uint8_t *val)
1047 {
1048 	return wlan_mlme_get_roam_bmiss_first_bcnt(psoc, val);
1049 }
1050 
1051 QDF_STATUS
ucfg_mlme_is_lfr_enabled(struct wlan_objmgr_psoc * psoc,bool * val)1052 ucfg_mlme_is_lfr_enabled(struct wlan_objmgr_psoc *psoc, bool *val)
1053 {
1054 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1055 
1056 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1057 	if (!mlme_obj) {
1058 		*val = cfg_default(CFG_LFR_FEATURE_ENABLED);
1059 		return QDF_STATUS_E_INVAL;
1060 	}
1061 
1062 	*val = mlme_obj->cfg.lfr.lfr_enabled;
1063 
1064 	return QDF_STATUS_SUCCESS;
1065 }
1066 
1067 QDF_STATUS
ucfg_mlme_set_lfr_enabled(struct wlan_objmgr_psoc * psoc,bool val)1068 ucfg_mlme_set_lfr_enabled(struct wlan_objmgr_psoc *psoc, bool val)
1069 {
1070 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1071 
1072 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1073 	if (!mlme_obj)
1074 		return QDF_STATUS_E_INVAL;
1075 
1076 	mlme_obj->cfg.lfr.lfr_enabled = val;
1077 
1078 	return QDF_STATUS_SUCCESS;
1079 }
1080 
1081 QDF_STATUS
ucfg_mlme_is_roam_prefer_5ghz(struct wlan_objmgr_psoc * psoc,bool * val)1082 ucfg_mlme_is_roam_prefer_5ghz(struct wlan_objmgr_psoc *psoc, bool *val)
1083 {
1084 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1085 
1086 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1087 	if (!mlme_obj) {
1088 		*val = cfg_default(CFG_LFR_ROAM_PREFER_5GHZ);
1089 		return QDF_STATUS_E_INVAL;
1090 	}
1091 
1092 	*val = mlme_obj->cfg.lfr.roam_prefer_5ghz;
1093 
1094 	return QDF_STATUS_SUCCESS;
1095 }
1096 
ucfg_mlme_is_roam_intra_band(struct wlan_objmgr_psoc * psoc)1097 bool ucfg_mlme_is_roam_intra_band(struct wlan_objmgr_psoc *psoc)
1098 {
1099 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1100 
1101 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1102 	if (!mlme_obj)
1103 		return true;
1104 
1105 	return mlme_obj->cfg.lfr.roam_intra_band;
1106 }
1107 
1108 QDF_STATUS
ucfg_mlme_set_roam_intra_band(struct wlan_objmgr_psoc * psoc,bool val)1109 ucfg_mlme_set_roam_intra_band(struct wlan_objmgr_psoc *psoc, bool val)
1110 {
1111 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1112 
1113 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1114 	if (!mlme_obj)
1115 		return QDF_STATUS_E_INVAL;
1116 
1117 	mlme_obj->cfg.lfr.roam_intra_band = val;
1118 
1119 	return QDF_STATUS_SUCCESS;
1120 }
1121 
1122 QDF_STATUS
ucfg_mlme_get_home_away_time(struct wlan_objmgr_psoc * psoc,uint16_t * val)1123 ucfg_mlme_get_home_away_time(struct wlan_objmgr_psoc *psoc, uint16_t *val)
1124 {
1125 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1126 
1127 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1128 	if (!mlme_obj) {
1129 		*val = cfg_default(CFG_LFR_ROAM_SCAN_HOME_AWAY_TIME);
1130 		return QDF_STATUS_E_INVAL;
1131 	}
1132 
1133 	*val = mlme_obj->cfg.lfr.roam_scan_home_away_time;
1134 
1135 	return QDF_STATUS_SUCCESS;
1136 }
1137 
1138 QDF_STATUS
ucfg_mlme_set_fast_roam_in_concurrency_enabled(struct wlan_objmgr_psoc * psoc,bool val)1139 ucfg_mlme_set_fast_roam_in_concurrency_enabled(struct wlan_objmgr_psoc *psoc,
1140 					       bool val)
1141 {
1142 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1143 
1144 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1145 	if (!mlme_obj)
1146 		return QDF_STATUS_E_INVAL;
1147 
1148 	mlme_obj->cfg.lfr.enable_fast_roam_in_concurrency = val;
1149 
1150 	return QDF_STATUS_SUCCESS;
1151 }
1152 
1153 #ifdef MULTI_CLIENT_LL_SUPPORT
ucfg_mlme_get_wlm_multi_client_ll_caps(struct wlan_objmgr_psoc * psoc)1154 bool ucfg_mlme_get_wlm_multi_client_ll_caps(struct wlan_objmgr_psoc *psoc)
1155 {
1156 	return wlan_mlme_get_wlm_multi_client_ll_caps(psoc);
1157 }
1158 
1159 QDF_STATUS
ucfg_mlme_cfg_get_multi_client_ll_ini_support(struct wlan_objmgr_psoc * psoc,bool * multi_client_ll_support)1160 ucfg_mlme_cfg_get_multi_client_ll_ini_support(struct wlan_objmgr_psoc *psoc,
1161 					      bool *multi_client_ll_support)
1162 {
1163 	return mlme_get_cfg_multi_client_ll_ini_support(psoc,
1164 						multi_client_ll_support);
1165 }
1166 #endif
1167 
1168 #ifdef WLAN_VENDOR_HANDOFF_CONTROL
ucfg_mlme_get_vendor_handoff_control_caps(struct wlan_objmgr_psoc * psoc)1169 bool ucfg_mlme_get_vendor_handoff_control_caps(struct wlan_objmgr_psoc *psoc)
1170 {
1171 	return wlan_mlme_get_vendor_handoff_control_caps(psoc);
1172 }
1173 #endif
1174 
1175 #ifdef FEATURE_WLAN_ESE
1176 QDF_STATUS
ucfg_mlme_is_ese_enabled(struct wlan_objmgr_psoc * psoc,bool * val)1177 ucfg_mlme_is_ese_enabled(struct wlan_objmgr_psoc *psoc, bool *val)
1178 {
1179 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1180 
1181 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1182 	if (!mlme_obj) {
1183 		*val = cfg_default(CFG_LFR_ESE_FEATURE_ENABLED);
1184 		return QDF_STATUS_E_INVAL;
1185 	}
1186 
1187 	*val = mlme_obj->cfg.lfr.ese_enabled;
1188 
1189 	return QDF_STATUS_SUCCESS;
1190 }
1191 #endif /* FEATURE_WLAN_ESE */
1192 
1193 QDF_STATUS
ucfg_mlme_get_supported_mcs_set(struct wlan_objmgr_psoc * psoc,uint8_t * buf,qdf_size_t * len)1194 ucfg_mlme_get_supported_mcs_set(struct wlan_objmgr_psoc *psoc,
1195 				uint8_t *buf, qdf_size_t *len)
1196 {
1197 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1198 
1199 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1200 	if (!mlme_obj)
1201 		return QDF_STATUS_E_INVAL;
1202 
1203 	return wlan_mlme_get_cfg_str(buf,
1204 				     &mlme_obj->cfg.rates.supported_mcs_set,
1205 				     len);
1206 }
1207 
1208 QDF_STATUS
ucfg_mlme_set_supported_mcs_set(struct wlan_objmgr_psoc * psoc,uint8_t * buf,qdf_size_t len)1209 ucfg_mlme_set_supported_mcs_set(struct wlan_objmgr_psoc *psoc,
1210 				uint8_t *buf, qdf_size_t len)
1211 {
1212 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1213 
1214 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1215 	if (!mlme_obj)
1216 		return QDF_STATUS_E_INVAL;
1217 
1218 	return wlan_mlme_set_cfg_str(buf,
1219 				     &mlme_obj->cfg.rates.supported_mcs_set,
1220 				     len);
1221 }
1222 
1223 QDF_STATUS
ucfg_mlme_get_current_mcs_set(struct wlan_objmgr_psoc * psoc,uint8_t * buf,qdf_size_t * len)1224 ucfg_mlme_get_current_mcs_set(struct wlan_objmgr_psoc *psoc,
1225 			      uint8_t *buf, qdf_size_t *len)
1226 {
1227 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1228 
1229 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1230 	if (!mlme_obj)
1231 		return QDF_STATUS_E_INVAL;
1232 
1233 	return wlan_mlme_get_cfg_str(buf,
1234 				     &mlme_obj->cfg.rates.current_mcs_set,
1235 				     len);
1236 }
1237 
1238 QDF_STATUS
ucfg_mlme_get_wmi_wq_watchdog_timeout(struct wlan_objmgr_psoc * psoc,uint32_t * wmi_wq_watchdog_timeout)1239 ucfg_mlme_get_wmi_wq_watchdog_timeout(struct wlan_objmgr_psoc *psoc,
1240 				      uint32_t *wmi_wq_watchdog_timeout)
1241 {
1242 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1243 
1244 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1245 	if (!mlme_obj) {
1246 		*wmi_wq_watchdog_timeout = cfg_default(CFG_WMI_WQ_WATCHDOG);
1247 		return QDF_STATUS_E_INVAL;
1248 	}
1249 
1250 	*wmi_wq_watchdog_timeout =
1251 		mlme_obj->cfg.timeouts.wmi_wq_watchdog_timeout;
1252 
1253 	return QDF_STATUS_SUCCESS;
1254 }
1255 
1256 QDF_STATUS
ucfg_mlme_set_wmi_wq_watchdog_timeout(struct wlan_objmgr_psoc * psoc,uint32_t wmi_wq_watchdog_timeout)1257 ucfg_mlme_set_wmi_wq_watchdog_timeout(struct wlan_objmgr_psoc *psoc,
1258 				      uint32_t wmi_wq_watchdog_timeout)
1259 {
1260 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1261 
1262 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1263 	if (!mlme_obj)
1264 		return QDF_STATUS_E_INVAL;
1265 
1266 	if (!cfg_in_range(CFG_WMI_WQ_WATCHDOG, wmi_wq_watchdog_timeout)) {
1267 		mlme_legacy_err("wmi watchdog bite timeout is invalid %d",
1268 				wmi_wq_watchdog_timeout);
1269 		return QDF_STATUS_E_INVAL;
1270 	}
1271 
1272 	mlme_obj->cfg.timeouts.wmi_wq_watchdog_timeout =
1273 		wmi_wq_watchdog_timeout;
1274 
1275 	return QDF_STATUS_SUCCESS;
1276 }
1277 
1278 QDF_STATUS
ucfg_mlme_stats_get_periodic_display_time(struct wlan_objmgr_psoc * psoc,uint32_t * periodic_display_time)1279 ucfg_mlme_stats_get_periodic_display_time(struct wlan_objmgr_psoc *psoc,
1280 					  uint32_t *periodic_display_time)
1281 {
1282 	return wlan_mlme_stats_get_periodic_display_time(psoc,
1283 							 periodic_display_time);
1284 }
1285 
1286 QDF_STATUS
ucfg_mlme_stats_get_cfg_values(struct wlan_objmgr_psoc * psoc,int * link_speed_rssi_high,int * link_speed_rssi_mid,int * link_speed_rssi_low,uint32_t * link_speed_rssi_report)1287 ucfg_mlme_stats_get_cfg_values(struct wlan_objmgr_psoc *psoc,
1288 			       int *link_speed_rssi_high,
1289 			       int *link_speed_rssi_mid,
1290 			       int *link_speed_rssi_low,
1291 			       uint32_t *link_speed_rssi_report)
1292 {
1293 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1294 
1295 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1296 	if (!mlme_obj) {
1297 		*link_speed_rssi_high =
1298 			cfg_default(CFG_LINK_SPEED_RSSI_HIGH);
1299 		*link_speed_rssi_mid =
1300 			cfg_default(CFG_LINK_SPEED_RSSI_MID);
1301 		*link_speed_rssi_low =
1302 			cfg_default(CFG_LINK_SPEED_RSSI_LOW);
1303 		*link_speed_rssi_report =
1304 			cfg_default(CFG_REPORT_MAX_LINK_SPEED);
1305 		return QDF_STATUS_E_INVAL;
1306 	}
1307 
1308 	*link_speed_rssi_high =
1309 		mlme_obj->cfg.stats.stats_link_speed_rssi_high;
1310 	*link_speed_rssi_mid =
1311 		mlme_obj->cfg.stats.stats_link_speed_rssi_med;
1312 	*link_speed_rssi_low =
1313 		mlme_obj->cfg.stats.stats_link_speed_rssi_low;
1314 	*link_speed_rssi_report =
1315 		mlme_obj->cfg.stats.stats_report_max_link_speed_rssi;
1316 
1317 	return QDF_STATUS_SUCCESS;
1318 }
1319 
ucfg_mlme_stats_is_link_speed_report_actual(struct wlan_objmgr_psoc * psoc)1320 bool ucfg_mlme_stats_is_link_speed_report_actual(struct wlan_objmgr_psoc *psoc)
1321 {
1322 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1323 	int report_link_speed = 0;
1324 
1325 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1326 	if (!mlme_obj)
1327 		report_link_speed = cfg_default(CFG_REPORT_MAX_LINK_SPEED);
1328 	else
1329 		report_link_speed =
1330 			mlme_obj->cfg.stats.stats_report_max_link_speed_rssi;
1331 
1332 	return (report_link_speed == CFG_STATS_LINK_SPEED_REPORT_ACTUAL);
1333 }
1334 
ucfg_mlme_stats_is_link_speed_report_max(struct wlan_objmgr_psoc * psoc)1335 bool ucfg_mlme_stats_is_link_speed_report_max(struct wlan_objmgr_psoc *psoc)
1336 {
1337 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1338 	int report_link_speed = 0;
1339 
1340 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1341 	if (!mlme_obj)
1342 		report_link_speed = cfg_default(CFG_REPORT_MAX_LINK_SPEED);
1343 	else
1344 		report_link_speed =
1345 			mlme_obj->cfg.stats.stats_report_max_link_speed_rssi;
1346 
1347 	return (report_link_speed == CFG_STATS_LINK_SPEED_REPORT_MAX);
1348 }
1349 
1350 bool
ucfg_mlme_stats_is_link_speed_report_max_scaled(struct wlan_objmgr_psoc * psoc)1351 ucfg_mlme_stats_is_link_speed_report_max_scaled(struct wlan_objmgr_psoc *psoc)
1352 {
1353 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1354 	int report_link_speed = 0;
1355 
1356 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1357 	if (!mlme_obj)
1358 		report_link_speed = cfg_default(CFG_REPORT_MAX_LINK_SPEED);
1359 	else
1360 		report_link_speed =
1361 			mlme_obj->cfg.stats.stats_report_max_link_speed_rssi;
1362 
1363 	return (report_link_speed == CFG_STATS_LINK_SPEED_REPORT_MAX_SCALED);
1364 }
1365 
1366 QDF_STATUS
ucfg_mlme_get_sta_keepalive_method(struct wlan_objmgr_psoc * psoc,enum station_keepalive_method * val)1367 ucfg_mlme_get_sta_keepalive_method(struct wlan_objmgr_psoc *psoc,
1368 				   enum station_keepalive_method *val)
1369 {
1370 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1371 
1372 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1373 	if (!mlme_obj)
1374 		return QDF_STATUS_E_INVAL;
1375 
1376 	*val = mlme_obj->cfg.sta.sta_keepalive_method;
1377 	return QDF_STATUS_SUCCESS;
1378 }
1379 
1380 QDF_STATUS
ucfg_mlme_get_enable_deauth_to_disassoc_map(struct wlan_objmgr_psoc * psoc,bool * value)1381 ucfg_mlme_get_enable_deauth_to_disassoc_map(struct wlan_objmgr_psoc *psoc,
1382 					    bool *value)
1383 {
1384 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1385 
1386 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1387 	if (!mlme_obj)
1388 		return QDF_STATUS_E_INVAL;
1389 
1390 	*value = mlme_obj->cfg.gen.enable_deauth_to_disassoc_map;
1391 	return QDF_STATUS_SUCCESS;
1392 }
1393 
1394 
1395 QDF_STATUS
ucfg_mlme_get_ap_random_bssid_enable(struct wlan_objmgr_psoc * psoc,bool * value)1396 ucfg_mlme_get_ap_random_bssid_enable(struct wlan_objmgr_psoc *psoc,
1397 				     bool *value)
1398 {
1399 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1400 
1401 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1402 	if (!mlme_obj)
1403 		return QDF_STATUS_E_INVAL;
1404 
1405 	*value = mlme_obj->cfg.sap_cfg.ap_random_bssid_enable;
1406 	return QDF_STATUS_SUCCESS;
1407 }
1408 
1409 QDF_STATUS
ucfg_mlme_get_latency_enable(struct wlan_objmgr_psoc * psoc,bool * value)1410 ucfg_mlme_get_latency_enable(struct wlan_objmgr_psoc *psoc, bool *value)
1411 {
1412 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1413 
1414 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1415 	if (!mlme_obj) {
1416 		mlme_legacy_err("mlme obj null");
1417 		return QDF_STATUS_E_INVAL;
1418 	}
1419 
1420 	*value = mlme_obj->cfg.wlm_config.latency_enable;
1421 	return QDF_STATUS_SUCCESS;
1422 }
1423 
1424 QDF_STATUS
ucfg_mlme_get_latency_level(struct wlan_objmgr_psoc * psoc,uint8_t * value)1425 ucfg_mlme_get_latency_level(struct wlan_objmgr_psoc *psoc, uint8_t *value)
1426 {
1427 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1428 
1429 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1430 	if (!mlme_obj) {
1431 		mlme_legacy_err("mlme obj null");
1432 		return QDF_STATUS_E_INVAL;
1433 	}
1434 
1435 	*value = mlme_obj->cfg.wlm_config.latency_level;
1436 	return QDF_STATUS_SUCCESS;
1437 }
1438 
1439 QDF_STATUS
ucfg_mlme_get_latency_host_flags(struct wlan_objmgr_psoc * psoc,uint8_t latency_level,uint32_t * value)1440 ucfg_mlme_get_latency_host_flags(struct wlan_objmgr_psoc *psoc,
1441 				 uint8_t latency_level, uint32_t *value)
1442 {
1443 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1444 
1445 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1446 	if (!mlme_obj) {
1447 		mlme_legacy_err("mlme obj null");
1448 		return QDF_STATUS_E_INVAL;
1449 	}
1450 
1451 	*value = mlme_obj->cfg.wlm_config.latency_host_flags[latency_level];
1452 	return QDF_STATUS_SUCCESS;
1453 }
1454 
1455 #ifdef MWS_COEX
1456 QDF_STATUS
ucfg_mlme_get_mws_coex_4g_quick_tdm(struct wlan_objmgr_psoc * psoc,uint32_t * val)1457 ucfg_mlme_get_mws_coex_4g_quick_tdm(struct wlan_objmgr_psoc *psoc,
1458 				    uint32_t *val)
1459 {
1460 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1461 
1462 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1463 	if (!mlme_obj) {
1464 		*val = cfg_default(CFG_MWS_COEX_4G_QUICK_FTDM);
1465 		mlme_legacy_err("mlme obj null");
1466 		return QDF_STATUS_E_INVAL;
1467 	}
1468 
1469 	*val = mlme_obj->cfg.mwc.mws_coex_4g_quick_tdm;
1470 
1471 	return QDF_STATUS_SUCCESS;
1472 }
1473 
1474 QDF_STATUS
ucfg_mlme_get_mws_coex_5g_nr_pwr_limit(struct wlan_objmgr_psoc * psoc,uint32_t * val)1475 ucfg_mlme_get_mws_coex_5g_nr_pwr_limit(struct wlan_objmgr_psoc *psoc,
1476 				       uint32_t *val)
1477 {
1478 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1479 
1480 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1481 	if (!mlme_obj) {
1482 		*val = cfg_default(CFG_MWS_COEX_5G_NR_PWR_LIMIT);
1483 		mlme_legacy_err("mlme obj null");
1484 		return QDF_STATUS_E_INVAL;
1485 	}
1486 
1487 	*val = mlme_obj->cfg.mwc.mws_coex_5g_nr_pwr_limit;
1488 
1489 	return QDF_STATUS_SUCCESS;
1490 }
1491 
1492 QDF_STATUS
ucfg_mlme_get_mws_coex_pcc_channel_avoid_delay(struct wlan_objmgr_psoc * psoc,uint32_t * val)1493 ucfg_mlme_get_mws_coex_pcc_channel_avoid_delay(struct wlan_objmgr_psoc *psoc,
1494 					       uint32_t *val)
1495 {
1496 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1497 
1498 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1499 	if (!mlme_obj) {
1500 		*val = cfg_default(CFG_MWS_COEX_PCC_CHANNEL_AVOID_DELAY);
1501 		mlme_legacy_err("mlme obj null");
1502 		return QDF_STATUS_SUCCESS;
1503 	}
1504 
1505 	*val = mlme_obj->cfg.mwc.mws_coex_pcc_channel_avoid_delay;
1506 
1507 	return QDF_STATUS_SUCCESS;
1508 }
1509 
1510 QDF_STATUS
ucfg_mlme_get_mws_coex_scc_channel_avoid_delay(struct wlan_objmgr_psoc * psoc,uint32_t * val)1511 ucfg_mlme_get_mws_coex_scc_channel_avoid_delay(struct wlan_objmgr_psoc *psoc,
1512 					       uint32_t *val)
1513 {
1514 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1515 
1516 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1517 	if (!mlme_obj) {
1518 		*val = cfg_default(CFG_MWS_COEX_SCC_CHANNEL_AVOID_DELAY);
1519 		mlme_legacy_err("mlme obj null");
1520 		return QDF_STATUS_SUCCESS;
1521 	}
1522 
1523 	*val = mlme_obj->cfg.mwc.mws_coex_scc_channel_avoid_delay;
1524 
1525 	return QDF_STATUS_SUCCESS;
1526 }
1527 #endif
1528 
1529 QDF_STATUS
ucfg_mlme_get_etsi_srd_chan_in_master_mode(struct wlan_objmgr_psoc * psoc,uint8_t * value)1530 ucfg_mlme_get_etsi_srd_chan_in_master_mode(struct wlan_objmgr_psoc *psoc,
1531 					   uint8_t *value)
1532 {
1533 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1534 
1535 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1536 	if (!mlme_obj) {
1537 		*value = cfg_default(CFG_ETSI_SRD_CHAN_IN_MASTER_MODE);
1538 		mlme_legacy_err("Failed to get MLME Obj");
1539 		return QDF_STATUS_E_INVAL;
1540 	}
1541 
1542 	*value = mlme_obj->cfg.reg.etsi_srd_chan_in_master_mode;
1543 
1544 	return QDF_STATUS_SUCCESS;
1545 }
1546 
1547 QDF_STATUS
ucfg_mlme_get_5dot9_ghz_chan_in_master_mode(struct wlan_objmgr_psoc * psoc,bool * value)1548 ucfg_mlme_get_5dot9_ghz_chan_in_master_mode(struct wlan_objmgr_psoc *psoc,
1549 					    bool *value)
1550 {
1551 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1552 
1553 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1554 	if (!mlme_obj) {
1555 		*value = cfg_default(CFG_FCC_5DOT9_GHZ_CHAN_IN_MASTER_MODE);
1556 		mlme_legacy_err("Failed to get MLME Obj");
1557 		return QDF_STATUS_E_INVAL;
1558 	}
1559 
1560 	*value = mlme_obj->cfg.reg.fcc_5dot9_ghz_chan_in_master_mode;
1561 
1562 	return QDF_STATUS_SUCCESS;
1563 }
1564 
1565 QDF_STATUS
ucfg_mlme_get_srd_master_mode_for_vdev(struct wlan_objmgr_psoc * psoc,enum QDF_OPMODE vdev_opmode,bool * value)1566 ucfg_mlme_get_srd_master_mode_for_vdev(struct wlan_objmgr_psoc *psoc,
1567 				       enum QDF_OPMODE vdev_opmode,
1568 				       bool *value)
1569 {
1570 	return wlan_mlme_get_srd_master_mode_for_vdev(psoc, vdev_opmode, value);
1571 }
1572 
1573 #ifdef SAP_AVOID_ACS_FREQ_LIST
1574 QDF_STATUS
ucfg_mlme_get_acs_avoid_freq_list(struct wlan_objmgr_psoc * psoc,uint16_t * freq_list,uint8_t * freq_list_num)1575 ucfg_mlme_get_acs_avoid_freq_list(struct wlan_objmgr_psoc *psoc,
1576 				  uint16_t *freq_list, uint8_t *freq_list_num)
1577 {
1578 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1579 	qdf_size_t avoid_acs_freq_list_num;
1580 
1581 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1582 	if (!mlme_obj) {
1583 		qdf_uint16_array_parse(
1584 				cfg_default(CFG_SAP_AVOID_ACS_FREQ_LIST),
1585 				freq_list, CFG_VALID_CHANNEL_LIST_LEN,
1586 				&avoid_acs_freq_list_num);
1587 		*freq_list_num = avoid_acs_freq_list_num;
1588 
1589 		mlme_legacy_err("Failed to get MLME Obj");
1590 		return QDF_STATUS_E_INVAL;
1591 	}
1592 
1593 	*freq_list_num = mlme_obj->cfg.reg.avoid_acs_freq_list_num;
1594 	qdf_mem_copy(freq_list, mlme_obj->cfg.reg.avoid_acs_freq_list,
1595 		     *freq_list_num * sizeof(uint16_t));
1596 
1597 	return QDF_STATUS_SUCCESS;
1598 }
1599 #endif
1600 
1601 QDF_STATUS
ucfg_mlme_get_11d_in_world_mode(struct wlan_objmgr_psoc * psoc,bool * value)1602 ucfg_mlme_get_11d_in_world_mode(struct wlan_objmgr_psoc *psoc,
1603 				bool *value)
1604 {
1605 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1606 
1607 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1608 	if (!mlme_obj) {
1609 		*value = cfg_default(CFG_ENABLE_11D_IN_WORLD_MODE);
1610 		mlme_legacy_err("Failed to get MLME Obj");
1611 		return QDF_STATUS_E_INVAL;
1612 	}
1613 
1614 	*value = mlme_obj->cfg.reg.enable_11d_in_world_mode;
1615 
1616 	return QDF_STATUS_SUCCESS;
1617 }
1618 
1619 QDF_STATUS
ucfg_mlme_get_restart_beaconing_on_ch_avoid(struct wlan_objmgr_psoc * psoc,uint32_t * value)1620 ucfg_mlme_get_restart_beaconing_on_ch_avoid(struct wlan_objmgr_psoc *psoc,
1621 					    uint32_t *value)
1622 {
1623 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1624 
1625 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1626 	if (!mlme_obj) {
1627 		*value = cfg_default(CFG_RESTART_BEACONING_ON_CH_AVOID);
1628 		mlme_legacy_err("Failed to get MLME Obj");
1629 		return QDF_STATUS_E_INVAL;
1630 	}
1631 
1632 	*value = mlme_obj->cfg.reg.restart_beaconing_on_ch_avoid;
1633 
1634 	return QDF_STATUS_SUCCESS;
1635 }
1636 
1637 QDF_STATUS
ucfg_mlme_get_indoor_channel_support(struct wlan_objmgr_psoc * psoc,bool * value)1638 ucfg_mlme_get_indoor_channel_support(struct wlan_objmgr_psoc *psoc,
1639 				     bool *value)
1640 {
1641 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1642 
1643 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1644 	if (!mlme_obj) {
1645 		*value = cfg_default(CFG_INDOOR_CHANNEL_SUPPORT);
1646 		mlme_legacy_err("Failed to get MLME Obj");
1647 		return QDF_STATUS_E_INVAL;
1648 	}
1649 
1650 	*value = mlme_obj->cfg.reg.indoor_channel_support;
1651 
1652 	return QDF_STATUS_SUCCESS;
1653 }
1654 
1655 QDF_STATUS
ucfg_mlme_get_scan_11d_interval(struct wlan_objmgr_psoc * psoc,uint32_t * value)1656 ucfg_mlme_get_scan_11d_interval(struct wlan_objmgr_psoc *psoc,
1657 				uint32_t *value)
1658 {
1659 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1660 
1661 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1662 	if (!mlme_obj) {
1663 		*value = cfg_default(CFG_SCAN_11D_INTERVAL);
1664 		mlme_legacy_err("Failed to get MLME Obj");
1665 		return QDF_STATUS_E_INVAL;
1666 	}
1667 
1668 	*value = mlme_obj->cfg.reg.scan_11d_interval;
1669 	return QDF_STATUS_SUCCESS;
1670 }
1671 
1672 QDF_STATUS
ucfg_mlme_get_nol_across_regdmn(struct wlan_objmgr_psoc * psoc,bool * value)1673 ucfg_mlme_get_nol_across_regdmn(struct wlan_objmgr_psoc *psoc, bool *value)
1674 {
1675 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1676 
1677 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1678 	if (!mlme_obj) {
1679 		*value = cfg_default(CFG_RETAIN_NOL_ACROSS_REG_DOMAIN);
1680 		mlme_legacy_err("Failed to get MLME Obj");
1681 		return QDF_STATUS_E_INVAL;
1682 	}
1683 
1684 	*value = mlme_obj->cfg.reg.retain_nol_across_regdmn_update;
1685 	return QDF_STATUS_SUCCESS;
1686 }
1687 
1688 #ifdef FEATURE_LFR_SUBNET_DETECTION
1689 QDF_STATUS
ucfg_mlme_is_subnet_detection_enabled(struct wlan_objmgr_psoc * psoc,bool * val)1690 ucfg_mlme_is_subnet_detection_enabled(struct wlan_objmgr_psoc *psoc, bool *val)
1691 {
1692 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1693 
1694 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1695 	if (!mlme_obj) {
1696 		*val = cfg_default(CFG_LFR3_ENABLE_SUBNET_DETECTION);
1697 		return QDF_STATUS_E_INVAL;
1698 	}
1699 	*val = mlme_obj->cfg.lfr.enable_lfr_subnet_detection;
1700 
1701 	return QDF_STATUS_SUCCESS;
1702 }
1703 #endif
1704 
1705 QDF_STATUS
ucfg_mlme_set_current_tx_power_level(struct wlan_objmgr_psoc * psoc,uint8_t value)1706 ucfg_mlme_set_current_tx_power_level(struct wlan_objmgr_psoc *psoc,
1707 				     uint8_t value)
1708 {
1709 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1710 
1711 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1712 	if (!mlme_obj)
1713 		return QDF_STATUS_E_INVAL;
1714 
1715 	mlme_obj->cfg.power.current_tx_power_level = value;
1716 
1717 	return QDF_STATUS_SUCCESS;
1718 }
1719 
1720 QDF_STATUS
ucfg_mlme_get_current_tx_power_level(struct wlan_objmgr_psoc * psoc,uint8_t * value)1721 ucfg_mlme_get_current_tx_power_level(struct wlan_objmgr_psoc *psoc,
1722 				     uint8_t *value)
1723 {
1724 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1725 
1726 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1727 	if (!mlme_obj) {
1728 		*value = cfg_default(CFG_CURRENT_TX_POWER_LEVEL);
1729 		return QDF_STATUS_E_INVAL;
1730 	}
1731 
1732 	*value = mlme_obj->cfg.power.current_tx_power_level;
1733 
1734 	return QDF_STATUS_SUCCESS;
1735 }
1736 
ucfg_wlan_mlme_get_reg_tpc_info(struct wlan_objmgr_vdev * vdev,struct reg_tpc_power_info * tpc_info)1737 QDF_STATUS ucfg_wlan_mlme_get_reg_tpc_info(struct wlan_objmgr_vdev *vdev,
1738 					   struct reg_tpc_power_info *tpc_info)
1739 {
1740 	struct vdev_mlme_obj *mlme_obj;
1741 
1742 	mlme_obj = wlan_vdev_mlme_get_cmpt_obj(vdev);
1743 
1744 	if (!mlme_obj) {
1745 		mlme_legacy_err("vdev component object is NULL");
1746 		return QDF_STATUS_E_INVAL;
1747 	}
1748 
1749 	qdf_mem_copy(tpc_info, &mlme_obj->reg_tpc_obj,
1750 		     sizeof(struct reg_tpc_power_info));
1751 
1752 	return QDF_STATUS_SUCCESS;
1753 }
1754 
1755 QDF_STATUS
ucfg_mlme_set_obss_detection_offload_enabled(struct wlan_objmgr_psoc * psoc,uint8_t value)1756 ucfg_mlme_set_obss_detection_offload_enabled(struct wlan_objmgr_psoc *psoc,
1757 					     uint8_t value)
1758 {
1759 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1760 
1761 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1762 	if (!mlme_obj)
1763 		return QDF_STATUS_E_INVAL;
1764 
1765 	mlme_obj->cfg.obss_ht40.obss_detection_offload_enabled = value;
1766 
1767 	return QDF_STATUS_SUCCESS;
1768 }
1769 
1770 QDF_STATUS
ucfg_mlme_set_bss_color_collision_det_sta(struct wlan_objmgr_psoc * psoc,bool value)1771 ucfg_mlme_set_bss_color_collision_det_sta(struct wlan_objmgr_psoc *psoc,
1772 					  bool value)
1773 {
1774 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1775 
1776 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1777 	if (!mlme_obj)
1778 		return QDF_STATUS_E_INVAL;
1779 
1780 	mlme_obj->cfg.obss_ht40.bss_color_collision_det_sta = value;
1781 
1782 	return QDF_STATUS_SUCCESS;
1783 }
1784 
1785 QDF_STATUS
ucfg_mlme_set_bss_color_collision_det_support(struct wlan_objmgr_psoc * psoc,bool val)1786 ucfg_mlme_set_bss_color_collision_det_support(struct wlan_objmgr_psoc *psoc,
1787 					      bool val)
1788 {
1789 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1790 
1791 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1792 	if (!mlme_obj)
1793 		return QDF_STATUS_E_INVAL;
1794 
1795 	mlme_obj->cfg.obss_ht40.bss_color_collision_det_tgt_support = val;
1796 
1797 	return QDF_STATUS_SUCCESS;
1798 }
1799 
1800 QDF_STATUS
ucfg_mlme_get_bss_color_collision_det_support(struct wlan_objmgr_psoc * psoc,bool * val)1801 ucfg_mlme_get_bss_color_collision_det_support(struct wlan_objmgr_psoc *psoc,
1802 					      bool *val)
1803 {
1804 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1805 
1806 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1807 	if (!mlme_obj)
1808 		return QDF_STATUS_E_INVAL;
1809 
1810 	*val = mlme_obj->cfg.obss_ht40.bss_color_collision_det_tgt_support;
1811 
1812 	return QDF_STATUS_SUCCESS;
1813 }
1814 
1815 QDF_STATUS
ucfg_mlme_set_obss_color_collision_offload_enabled(struct wlan_objmgr_psoc * psoc,uint8_t value)1816 ucfg_mlme_set_obss_color_collision_offload_enabled(
1817 		struct wlan_objmgr_psoc *psoc, uint8_t value)
1818 {
1819 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1820 
1821 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1822 	if (!mlme_obj)
1823 		return QDF_STATUS_E_INVAL;
1824 
1825 	mlme_obj->cfg.obss_ht40.obss_color_collision_offload_enabled = value;
1826 
1827 	return QDF_STATUS_SUCCESS;
1828 }
1829 
ucfg_mlme_set_restricted_80p80_bw_supp(struct wlan_objmgr_psoc * psoc,bool restricted_80p80_supp)1830 QDF_STATUS ucfg_mlme_set_restricted_80p80_bw_supp(struct wlan_objmgr_psoc *psoc,
1831 						  bool restricted_80p80_supp)
1832 {
1833 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1834 
1835 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1836 	if (!mlme_obj)
1837 		return QDF_STATUS_E_INVAL;
1838 
1839 	mlme_obj->cfg.vht_caps.vht_cap_info.restricted_80p80_bw_supp =
1840 					restricted_80p80_supp;
1841 
1842 	return QDF_STATUS_SUCCESS;
1843 }
1844 
ucfg_mlme_get_restricted_80p80_bw_supp(struct wlan_objmgr_psoc * psoc)1845 bool ucfg_mlme_get_restricted_80p80_bw_supp(struct wlan_objmgr_psoc *psoc)
1846 {
1847 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1848 
1849 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1850 
1851 	if (!mlme_obj)
1852 		return true;
1853 
1854 	return mlme_obj->cfg.vht_caps.vht_cap_info.restricted_80p80_bw_supp;
1855 }
1856 
1857 QDF_STATUS
ucfg_mlme_get_channel_bonding_24ghz(struct wlan_objmgr_psoc * psoc,uint32_t * val)1858 ucfg_mlme_get_channel_bonding_24ghz(struct wlan_objmgr_psoc *psoc,
1859 				    uint32_t *val)
1860 {
1861 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1862 
1863 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1864 	if (!mlme_obj) {
1865 		*val = cfg_default(CFG_CHANNEL_BONDING_MODE_24GHZ);
1866 		return QDF_STATUS_E_INVAL;
1867 	}
1868 	*val = mlme_obj->cfg.feature_flags.channel_bonding_mode_24ghz;
1869 
1870 	return QDF_STATUS_SUCCESS;
1871 }
1872 
1873 QDF_STATUS
ucfg_mlme_set_channel_bonding_24ghz(struct wlan_objmgr_psoc * psoc,uint32_t value)1874 ucfg_mlme_set_channel_bonding_24ghz(struct wlan_objmgr_psoc *psoc,
1875 				    uint32_t value)
1876 {
1877 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1878 
1879 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1880 	if (!mlme_obj)
1881 		return QDF_STATUS_E_INVAL;
1882 
1883 	mlme_obj->cfg.feature_flags.channel_bonding_mode_24ghz = value;
1884 
1885 	return QDF_STATUS_SUCCESS;
1886 }
1887 
1888 QDF_STATUS
ucfg_mlme_get_update_chan_width_allowed(struct wlan_objmgr_psoc * psoc,bool * value)1889 ucfg_mlme_get_update_chan_width_allowed(struct wlan_objmgr_psoc *psoc,
1890 					   bool *value)
1891 {
1892 	return wlan_mlme_get_update_chan_width_allowed(psoc, value);
1893 }
1894 
1895 QDF_STATUS
ucfg_mlme_get_channel_bonding_5ghz(struct wlan_objmgr_psoc * psoc,uint32_t * value)1896 ucfg_mlme_get_channel_bonding_5ghz(struct wlan_objmgr_psoc *psoc,
1897 				   uint32_t *value)
1898 {
1899 	return wlan_mlme_get_channel_bonding_5ghz(psoc, value);
1900 }
1901 
1902 QDF_STATUS
ucfg_mlme_set_channel_bonding_5ghz(struct wlan_objmgr_psoc * psoc,uint32_t value)1903 ucfg_mlme_set_channel_bonding_5ghz(struct wlan_objmgr_psoc *psoc,
1904 				   uint32_t value)
1905 {
1906 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1907 
1908 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1909 	if (!mlme_obj)
1910 		return QDF_STATUS_E_INVAL;
1911 
1912 	mlme_obj->cfg.feature_flags.channel_bonding_mode_5ghz = value;
1913 
1914 	return QDF_STATUS_SUCCESS;
1915 }
1916 
ucfg_mlme_validate_full_roam_scan_period(uint32_t full_roam_scan_period)1917 bool ucfg_mlme_validate_full_roam_scan_period(uint32_t full_roam_scan_period)
1918 {
1919 	bool is_valid = true;
1920 	uint32_t min, max;
1921 
1922 	if (!cfg_in_range(CFG_LFR_FULL_ROAM_SCAN_REFRESH_PERIOD,
1923 			  full_roam_scan_period)) {
1924 		min = (cfg_min(CFG_LFR_FULL_ROAM_SCAN_REFRESH_PERIOD));
1925 		max = (cfg_max(CFG_LFR_FULL_ROAM_SCAN_REFRESH_PERIOD));
1926 		mlme_legacy_err("Full roam scan period value %d is out of range (Min: %d Max: %d)",
1927 				full_roam_scan_period, min, max);
1928 		is_valid = false;
1929 	}
1930 
1931 	return is_valid;
1932 }
1933 
ucfg_mlme_validate_scan_period(struct wlan_objmgr_psoc * psoc,uint32_t roam_scan_period)1934 bool ucfg_mlme_validate_scan_period(struct wlan_objmgr_psoc *psoc,
1935 				    uint32_t roam_scan_period)
1936 {
1937 	bool is_valid = true, val = false;
1938 
1939 	if (!cfg_in_range(CFG_LFR_EMPTY_SCAN_REFRESH_PERIOD,
1940 			  roam_scan_period)) {
1941 		ucfg_mlme_get_connection_roaming_ini_present(psoc, &val);
1942 		if (val)
1943 			mlme_legacy_err("Roam scan period value %d msec is out of range (Min: %d msec Max: %d msec)",
1944 					roam_scan_period,
1945 					cfg_min(CFG_ROAM_SCAN_FIRST_TIMER) * 1000,
1946 					cfg_max(CFG_ROAM_SCAN_FIRST_TIMER) * 1000);
1947 		else
1948 			mlme_legacy_err("Roam scan period value %d msec is out of range (Min: %d msec Max: %d msec)",
1949 					roam_scan_period,
1950 					cfg_min(CFG_LFR_EMPTY_SCAN_REFRESH_PERIOD),
1951 					cfg_max(CFG_LFR_EMPTY_SCAN_REFRESH_PERIOD));
1952 		is_valid = false;
1953 	}
1954 
1955 	return is_valid;
1956 }
1957 
1958 #ifdef FEATURE_WLAN_CH_AVOID_EXT
ucfg_mlme_get_coex_unsafe_chan_nb_user_prefer(struct wlan_objmgr_psoc * psoc)1959 bool ucfg_mlme_get_coex_unsafe_chan_nb_user_prefer(
1960 		struct wlan_objmgr_psoc *psoc)
1961 {
1962 	return wlan_mlme_get_coex_unsafe_chan_nb_user_prefer_for_sap(psoc);
1963 }
1964 
ucfg_mlme_get_coex_unsafe_chan_nb_user_prefer_for_sap(struct wlan_objmgr_psoc * psoc)1965 bool ucfg_mlme_get_coex_unsafe_chan_nb_user_prefer_for_sap(
1966 		struct wlan_objmgr_psoc *psoc)
1967 {
1968 	return wlan_mlme_get_coex_unsafe_chan_nb_user_prefer_for_sap(psoc);
1969 }
1970 
ucfg_mlme_get_coex_unsafe_chan_reg_disable(struct wlan_objmgr_psoc * psoc)1971 bool ucfg_mlme_get_coex_unsafe_chan_reg_disable(
1972 		struct wlan_objmgr_psoc *psoc)
1973 {
1974 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1975 
1976 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1977 	if (!mlme_obj) {
1978 		mlme_legacy_err("Failed to get MLME Obj");
1979 		return cfg_default(CFG_COEX_UNSAFE_CHAN_REG_DISABLE);
1980 	}
1981 	return mlme_obj->cfg.reg.coex_unsafe_chan_reg_disable;
1982 }
1983 #endif
1984 
1985 #if defined(CONFIG_AFC_SUPPORT) && defined(CONFIG_BAND_6GHZ)
1986 QDF_STATUS
ucfg_mlme_get_enable_6ghz_sp_mode_support(struct wlan_objmgr_psoc * psoc,bool * value)1987 ucfg_mlme_get_enable_6ghz_sp_mode_support(struct wlan_objmgr_psoc *psoc,
1988 					  bool *value)
1989 {
1990 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
1991 
1992 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
1993 	if (!mlme_obj)
1994 		return QDF_STATUS_E_INVAL;
1995 
1996 	*value = mlme_obj->cfg.reg.enable_6ghz_sp_pwrmode_supp;
1997 
1998 	return QDF_STATUS_SUCCESS;
1999 }
2000 
2001 QDF_STATUS
ucfg_mlme_get_afc_disable_timer_check(struct wlan_objmgr_psoc * psoc,bool * value)2002 ucfg_mlme_get_afc_disable_timer_check(struct wlan_objmgr_psoc *psoc,
2003 				      bool *value)
2004 {
2005 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
2006 
2007 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
2008 	if (!mlme_obj)
2009 		return QDF_STATUS_E_INVAL;
2010 
2011 	*value = mlme_obj->cfg.reg.afc_disable_timer_check;
2012 
2013 	return QDF_STATUS_SUCCESS;
2014 }
2015 
2016 QDF_STATUS
ucfg_mlme_get_afc_disable_request_id_check(struct wlan_objmgr_psoc * psoc,bool * value)2017 ucfg_mlme_get_afc_disable_request_id_check(struct wlan_objmgr_psoc *psoc,
2018 					   bool *value)
2019 {
2020 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
2021 
2022 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
2023 	if (!mlme_obj)
2024 		return QDF_STATUS_E_INVAL;
2025 
2026 	*value = mlme_obj->cfg.reg.afc_disable_request_id_check;
2027 
2028 	return QDF_STATUS_SUCCESS;
2029 }
2030 
2031 QDF_STATUS
ucfg_mlme_get_afc_reg_noaction(struct wlan_objmgr_psoc * psoc,bool * value)2032 ucfg_mlme_get_afc_reg_noaction(struct wlan_objmgr_psoc *psoc, bool *value)
2033 {
2034 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
2035 
2036 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
2037 	if (!mlme_obj)
2038 		return QDF_STATUS_E_INVAL;
2039 
2040 	*value = mlme_obj->cfg.reg.is_afc_reg_noaction;
2041 
2042 	return QDF_STATUS_SUCCESS;
2043 }
2044 #endif
2045 
2046 #ifdef CONNECTION_ROAMING_CFG
2047 QDF_STATUS
ucfg_mlme_set_connection_roaming_ini_present(struct wlan_objmgr_psoc * psoc,bool value)2048 ucfg_mlme_set_connection_roaming_ini_present(struct wlan_objmgr_psoc *psoc,
2049 					     bool value)
2050 {
2051 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
2052 
2053 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
2054 	if (!mlme_obj)
2055 		return QDF_STATUS_E_INVAL;
2056 
2057 	mlme_obj->cfg.connection_roaming_ini_flag = value;
2058 
2059 	return QDF_STATUS_SUCCESS;
2060 }
2061 
2062 QDF_STATUS
ucfg_mlme_get_connection_roaming_ini_present(struct wlan_objmgr_psoc * psoc,bool * value)2063 ucfg_mlme_get_connection_roaming_ini_present(struct wlan_objmgr_psoc *psoc,
2064 					     bool *value)
2065 {
2066 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
2067 
2068 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
2069 
2070 	if (!mlme_obj)
2071 		return QDF_STATUS_E_INVAL;
2072 
2073 	*value = mlme_obj->cfg.connection_roaming_ini_flag;
2074 
2075 	return QDF_STATUS_SUCCESS;
2076 }
2077 #endif
2078 
2079 enum wlan_phymode
ucfg_mlme_get_vdev_phy_mode(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id)2080 ucfg_mlme_get_vdev_phy_mode(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id)
2081 {
2082 	struct wlan_objmgr_vdev *vdev;
2083 	struct vdev_mlme_obj *mlme_obj;
2084 	enum wlan_phymode phymode;
2085 
2086 	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
2087 						    WLAN_MLME_OBJMGR_ID);
2088 	if (!vdev) {
2089 		mlme_err("get vdev failed for vdev_id: %d", vdev_id);
2090 		return WLAN_PHYMODE_AUTO;
2091 	}
2092 
2093 	mlme_obj = wlan_vdev_mlme_get_cmpt_obj(vdev);
2094 	if (!mlme_obj) {
2095 		mlme_err("failed to get mlme_obj vdev_id: %d", vdev_id);
2096 		phymode = WLAN_PHYMODE_AUTO;
2097 		goto done;
2098 	}
2099 	phymode = mlme_obj->mgmt.generic.phy_mode;
2100 
2101 done:
2102 	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
2103 
2104 	return phymode;
2105 }
2106 
2107 QDF_STATUS
ucfg_mlme_get_valid_channels(struct wlan_objmgr_psoc * psoc,uint32_t * ch_freq_list,uint32_t * list_len)2108 ucfg_mlme_get_valid_channels(struct wlan_objmgr_psoc *psoc,
2109 			     uint32_t *ch_freq_list, uint32_t *list_len)
2110 {
2111 	struct wlan_mlme_psoc_ext_obj *mlme_obj;
2112 	uint32_t num_valid_chan;
2113 	uint8_t i;
2114 
2115 	mlme_obj = mlme_get_psoc_ext_obj(psoc);
2116 	if (!mlme_obj) {
2117 		*list_len = 0;
2118 		mlme_legacy_err("Failed to get MLME Obj");
2119 		return QDF_STATUS_E_FAILURE;
2120 	}
2121 
2122 	num_valid_chan =  mlme_obj->cfg.reg.valid_channel_list_num;
2123 	if (num_valid_chan > *list_len) {
2124 		mlme_err("list len size %d less than expected %d", *list_len,
2125 			 num_valid_chan);
2126 		num_valid_chan = *list_len;
2127 	}
2128 	*list_len = num_valid_chan;
2129 	for (i = 0; i < *list_len; i++)
2130 		ch_freq_list[i] = mlme_obj->cfg.reg.valid_channel_freq_list[i];
2131 
2132 	return QDF_STATUS_SUCCESS;
2133 }
2134