1 /* 2 * Copyright (c) 2018-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 * DOC: define public APIs exposed by the mlme component 21 */ 22 23 #include "cfg_ucfg_api.h" 24 #include "wlan_mlme_main.h" 25 #include "wlan_mlme_ucfg_api.h" 26 #include "wma_types.h" 27 #include "wmi_unified.h" 28 #include "wma.h" 29 #include "wma_internal.h" 30 #include "wlan_crypto_global_api.h" 31 #include "wlan_utility.h" 32 #include "wlan_policy_mgr_ucfg.h" 33 #include "wlan_vdev_mgr_utils_api.h" 34 #include <../../core/src/wlan_cm_vdev_api.h> 35 #include "wlan_psoc_mlme_api.h" 36 #include "wlan_action_oui_main.h" 37 #include "target_if.h" 38 #include "wlan_vdev_mgr_tgt_if_tx_api.h" 39 #include "wmi_unified_vdev_api.h" 40 #include "wlan_mlme_api.h" 41 #include "../../core/src/wlan_cp_stats_defs.h" 42 #include "wlan_reg_services_api.h" 43 44 /* quota in milliseconds */ 45 #define MCC_DUTY_CYCLE 70 46 wlan_mlme_get_cfg_str(uint8_t * dst,struct mlme_cfg_str * cfg_str,qdf_size_t * len)47 QDF_STATUS wlan_mlme_get_cfg_str(uint8_t *dst, struct mlme_cfg_str *cfg_str, 48 qdf_size_t *len) 49 { 50 if (*len < cfg_str->len) { 51 mlme_legacy_err("Invalid len %zd", *len); 52 return QDF_STATUS_E_INVAL; 53 } 54 55 *len = cfg_str->len; 56 qdf_mem_copy(dst, cfg_str->data, *len); 57 58 return QDF_STATUS_SUCCESS; 59 } 60 wlan_mlme_set_cfg_str(uint8_t * src,struct mlme_cfg_str * dst_cfg_str,qdf_size_t len)61 QDF_STATUS wlan_mlme_set_cfg_str(uint8_t *src, struct mlme_cfg_str *dst_cfg_str, 62 qdf_size_t len) 63 { 64 if (len > dst_cfg_str->max_len) { 65 mlme_legacy_err("Invalid len %zd (>%zd)", len, 66 dst_cfg_str->max_len); 67 return QDF_STATUS_E_INVAL; 68 } 69 70 dst_cfg_str->len = len; 71 qdf_mem_copy(dst_cfg_str->data, src, len); 72 73 return QDF_STATUS_SUCCESS; 74 } 75 wlan_mlme_get_tx_power(struct wlan_objmgr_psoc * psoc,enum band_info band)76 uint8_t wlan_mlme_get_tx_power(struct wlan_objmgr_psoc *psoc, 77 enum band_info band) 78 { 79 struct wlan_mlme_psoc_ext_obj *mlme_obj; 80 81 mlme_obj = mlme_get_psoc_ext_obj(psoc); 82 if (!mlme_obj) 83 return 0; 84 85 switch (band) { 86 case BAND_2G: 87 return mlme_obj->cfg.power.tx_power_2g; 88 case BAND_5G: 89 return mlme_obj->cfg.power.tx_power_5g; 90 default: 91 break; 92 } 93 return 0; 94 } 95 wlan_mlme_get_power_usage(struct wlan_objmgr_psoc * psoc)96 char *wlan_mlme_get_power_usage(struct wlan_objmgr_psoc *psoc) 97 { 98 struct wlan_mlme_psoc_ext_obj *mlme_obj; 99 100 mlme_obj = mlme_get_psoc_ext_obj(psoc); 101 if (!mlme_obj) 102 return NULL; 103 104 return mlme_obj->cfg.power.power_usage.data; 105 } 106 107 QDF_STATUS wlan_mlme_get_enable_deauth_to_disassoc_map(struct wlan_objmgr_psoc * psoc,bool * value)108 wlan_mlme_get_enable_deauth_to_disassoc_map(struct wlan_objmgr_psoc *psoc, 109 bool *value) 110 { 111 struct wlan_mlme_psoc_ext_obj *mlme_obj; 112 113 mlme_obj = mlme_get_psoc_ext_obj(psoc); 114 if (!mlme_obj) 115 return QDF_STATUS_E_INVAL; 116 117 *value = mlme_obj->cfg.gen.enable_deauth_to_disassoc_map; 118 return QDF_STATUS_SUCCESS; 119 } 120 wlan_mlme_get_ht_cap_info(struct wlan_objmgr_psoc * psoc,struct mlme_ht_capabilities_info * ht_cap_info)121 QDF_STATUS wlan_mlme_get_ht_cap_info(struct wlan_objmgr_psoc *psoc, 122 struct mlme_ht_capabilities_info 123 *ht_cap_info) 124 { 125 struct wlan_mlme_psoc_ext_obj *mlme_obj; 126 127 mlme_obj = mlme_get_psoc_ext_obj(psoc); 128 if (!mlme_obj) 129 return QDF_STATUS_E_FAILURE; 130 131 *ht_cap_info = mlme_obj->cfg.ht_caps.ht_cap_info; 132 133 return QDF_STATUS_SUCCESS; 134 } 135 wlan_mlme_set_ht_cap_info(struct wlan_objmgr_psoc * psoc,struct mlme_ht_capabilities_info ht_cap_info)136 QDF_STATUS wlan_mlme_set_ht_cap_info(struct wlan_objmgr_psoc *psoc, 137 struct mlme_ht_capabilities_info 138 ht_cap_info) 139 { 140 struct wlan_mlme_psoc_ext_obj *mlme_obj; 141 142 mlme_obj = mlme_get_psoc_ext_obj(psoc); 143 if (!mlme_obj) 144 return QDF_STATUS_E_FAILURE; 145 146 mlme_obj->cfg.ht_caps.ht_cap_info = ht_cap_info; 147 148 return QDF_STATUS_SUCCESS; 149 } 150 wlan_mlme_get_max_amsdu_num(struct wlan_objmgr_psoc * psoc,uint8_t * value)151 QDF_STATUS wlan_mlme_get_max_amsdu_num(struct wlan_objmgr_psoc *psoc, 152 uint8_t *value) 153 { 154 struct wlan_mlme_psoc_ext_obj *mlme_obj; 155 156 mlme_obj = mlme_get_psoc_ext_obj(psoc); 157 if (!mlme_obj) 158 return QDF_STATUS_E_FAILURE; 159 160 *value = mlme_obj->cfg.ht_caps.max_num_amsdu; 161 162 return QDF_STATUS_SUCCESS; 163 } 164 wlan_mlme_set_max_amsdu_num(struct wlan_objmgr_psoc * psoc,uint8_t value)165 QDF_STATUS wlan_mlme_set_max_amsdu_num(struct wlan_objmgr_psoc *psoc, 166 uint8_t value) 167 { 168 struct wlan_mlme_psoc_ext_obj *mlme_obj; 169 170 mlme_obj = mlme_get_psoc_ext_obj(psoc); 171 if (!mlme_obj) 172 return QDF_STATUS_E_FAILURE; 173 174 if (!cfg_in_range(CFG_MAX_AMSDU_NUM, value)) { 175 mlme_legacy_err("Error in setting Max AMSDU Num"); 176 return QDF_STATUS_E_INVAL; 177 } 178 179 mlme_obj->cfg.ht_caps.max_num_amsdu = value; 180 181 return QDF_STATUS_SUCCESS; 182 } 183 wlan_mlme_get_ht_mpdu_density(struct wlan_objmgr_psoc * psoc,uint8_t * value)184 QDF_STATUS wlan_mlme_get_ht_mpdu_density(struct wlan_objmgr_psoc *psoc, 185 uint8_t *value) 186 { 187 struct wlan_mlme_psoc_ext_obj *mlme_obj; 188 189 mlme_obj = mlme_get_psoc_ext_obj(psoc); 190 if (!mlme_obj) 191 return QDF_STATUS_E_FAILURE; 192 193 *value = (uint8_t)mlme_obj->cfg.ht_caps.ampdu_params.mpdu_density; 194 195 return QDF_STATUS_SUCCESS; 196 } 197 wlan_mlme_set_ht_mpdu_density(struct wlan_objmgr_psoc * psoc,uint8_t value)198 QDF_STATUS wlan_mlme_set_ht_mpdu_density(struct wlan_objmgr_psoc *psoc, 199 uint8_t value) 200 { 201 struct wlan_mlme_psoc_ext_obj *mlme_obj; 202 203 mlme_obj = mlme_get_psoc_ext_obj(psoc); 204 if (!mlme_obj) 205 return QDF_STATUS_E_FAILURE; 206 207 if (!cfg_in_range(CFG_MPDU_DENSITY, value)) { 208 mlme_legacy_err("Invalid value %d", value); 209 return QDF_STATUS_E_INVAL; 210 } 211 212 mlme_obj->cfg.ht_caps.ampdu_params.mpdu_density = value; 213 214 return QDF_STATUS_SUCCESS; 215 } 216 217 #ifdef MULTI_CLIENT_LL_SUPPORT wlan_mlme_get_wlm_multi_client_ll_caps(struct wlan_objmgr_psoc * psoc)218 bool wlan_mlme_get_wlm_multi_client_ll_caps(struct wlan_objmgr_psoc *psoc) 219 { 220 return wlan_psoc_nif_fw_ext2_cap_get(psoc, 221 WLAN_SOC_WLM_MULTI_CLIENT_LL_SUPPORT); 222 } 223 #endif 224 225 #ifdef FEATURE_WLAN_CH_AVOID_EXT wlan_mlme_get_coex_unsafe_chan_nb_user_prefer(struct wlan_objmgr_psoc * psoc)226 uint32_t wlan_mlme_get_coex_unsafe_chan_nb_user_prefer( 227 struct wlan_objmgr_psoc *psoc) 228 { 229 struct wlan_mlme_psoc_ext_obj *mlme_obj; 230 231 mlme_obj = mlme_get_psoc_ext_obj(psoc); 232 if (!mlme_obj) { 233 mlme_legacy_err("Failed to get MLME Obj"); 234 return cfg_default(CFG_COEX_UNSAFE_CHAN_NB_USER_PREFER); 235 } 236 237 return mlme_obj->cfg.reg.coex_unsafe_chan_nb_user_prefer; 238 } 239 wlan_mlme_get_coex_unsafe_chan_nb_user_prefer_for_sap(struct wlan_objmgr_psoc * psoc)240 bool wlan_mlme_get_coex_unsafe_chan_nb_user_prefer_for_sap( 241 struct wlan_objmgr_psoc *psoc) 242 { 243 return !!(wlan_mlme_get_coex_unsafe_chan_nb_user_prefer(psoc) & 244 IGNORE_FW_COEX_INFO_ON_SAP_MODE); 245 } 246 wlan_mlme_get_coex_unsafe_chan_nb_user_prefer_for_p2p_go(struct wlan_objmgr_psoc * psoc)247 bool wlan_mlme_get_coex_unsafe_chan_nb_user_prefer_for_p2p_go( 248 struct wlan_objmgr_psoc *psoc) 249 { 250 return !!(wlan_mlme_get_coex_unsafe_chan_nb_user_prefer(psoc) & 251 IGNORE_FW_COEX_INFO_ON_P2P_GO_MODE); 252 } 253 #endif 254 wlan_mlme_get_band_capability(struct wlan_objmgr_psoc * psoc,uint32_t * band_capability)255 QDF_STATUS wlan_mlme_get_band_capability(struct wlan_objmgr_psoc *psoc, 256 uint32_t *band_capability) 257 { 258 struct wlan_mlme_psoc_ext_obj *mlme_obj; 259 260 mlme_obj = mlme_get_psoc_ext_obj(psoc); 261 if (!mlme_obj) 262 return QDF_STATUS_E_FAILURE; 263 264 *band_capability = mlme_obj->cfg.gen.band_capability; 265 266 return QDF_STATUS_SUCCESS; 267 } 268 269 #ifdef QCA_MULTIPASS_SUPPORT 270 QDF_STATUS wlan_mlme_peer_config_vlan(struct wlan_objmgr_vdev * vdev,uint8_t * mac_addr)271 wlan_mlme_peer_config_vlan(struct wlan_objmgr_vdev *vdev, 272 uint8_t *mac_addr) 273 { 274 QDF_STATUS status; 275 wmi_unified_t wmi_handle; 276 struct peer_vlan_config_param param; 277 278 wmi_handle = get_wmi_unified_hdl_from_pdev(wlan_vdev_get_pdev(vdev)); 279 if (!wmi_handle) { 280 mlme_err("unable to get wmi_handle"); 281 return QDF_STATUS_E_INVAL; 282 } 283 284 qdf_mem_set(¶m, sizeof(param), 0); 285 286 param.rx_cmd = 1; 287 /* Enabling Rx_insert_inner_vlan_tag */ 288 param.rx_insert_c_tag = 1; 289 param.vdev_id = wlan_vdev_get_id(vdev); 290 291 status = wmi_send_peer_vlan_config(wmi_handle, mac_addr, param); 292 if (QDF_IS_STATUS_ERROR(status)) 293 return status; 294 295 return QDF_STATUS_SUCCESS; 296 } 297 #endif 298 wlan_mlme_set_band_capability(struct wlan_objmgr_psoc * psoc,uint32_t band_capability)299 QDF_STATUS wlan_mlme_set_band_capability(struct wlan_objmgr_psoc *psoc, 300 uint32_t band_capability) 301 302 { 303 struct wlan_mlme_psoc_ext_obj *mlme_obj; 304 305 mlme_obj = mlme_get_psoc_ext_obj(psoc); 306 if (!mlme_obj) 307 return QDF_STATUS_E_FAILURE; 308 309 mlme_obj->cfg.gen.band_capability = band_capability; 310 311 return QDF_STATUS_SUCCESS; 312 } 313 314 #ifdef WLAN_VENDOR_HANDOFF_CONTROL wlan_mlme_get_vendor_handoff_control_caps(struct wlan_objmgr_psoc * psoc)315 bool wlan_mlme_get_vendor_handoff_control_caps(struct wlan_objmgr_psoc *psoc) 316 { 317 return wlan_psoc_nif_fw_ext2_cap_get(psoc, 318 WLAN_SOC_VENDOR_HANDOFF_CONTROL); 319 } 320 #endif 321 wlan_mlme_set_dual_sta_policy(struct wlan_objmgr_psoc * psoc,uint8_t dual_sta_config)322 QDF_STATUS wlan_mlme_set_dual_sta_policy(struct wlan_objmgr_psoc *psoc, 323 uint8_t dual_sta_config) 324 325 { 326 struct wlan_mlme_psoc_ext_obj *mlme_obj; 327 328 mlme_obj = mlme_get_psoc_ext_obj(psoc); 329 if (!mlme_obj) 330 return QDF_STATUS_E_FAILURE; 331 332 mlme_obj->cfg.gen.dual_sta_policy.concurrent_sta_policy = 333 dual_sta_config; 334 mlme_debug("Set dual_sta_config to :%d", dual_sta_config); 335 336 return QDF_STATUS_SUCCESS; 337 } 338 wlan_mlme_get_dual_sta_policy(struct wlan_objmgr_psoc * psoc,uint8_t * dual_sta_config)339 QDF_STATUS wlan_mlme_get_dual_sta_policy(struct wlan_objmgr_psoc *psoc, 340 uint8_t *dual_sta_config) 341 342 { 343 struct wlan_mlme_psoc_ext_obj *mlme_obj; 344 345 mlme_obj = mlme_get_psoc_ext_obj(psoc); 346 if (!mlme_obj) 347 return QDF_STATUS_E_FAILURE; 348 349 *dual_sta_config = 350 mlme_obj->cfg.gen.dual_sta_policy.concurrent_sta_policy; 351 352 return QDF_STATUS_SUCCESS; 353 } 354 355 enum host_concurrent_ap_policy wlan_mlme_convert_ap_policy_config(enum qca_wlan_concurrent_ap_policy_config ap_config)356 wlan_mlme_convert_ap_policy_config( 357 enum qca_wlan_concurrent_ap_policy_config ap_config) 358 { 359 switch (ap_config) { 360 case QCA_WLAN_CONCURRENT_AP_POLICY_UNSPECIFIED: 361 return HOST_CONCURRENT_AP_POLICY_UNSPECIFIED; 362 case QCA_WLAN_CONCURRENT_AP_POLICY_GAMING_AUDIO: 363 return HOST_CONCURRENT_AP_POLICY_GAMING_AUDIO; 364 case QCA_WLAN_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING: 365 return HOST_CONCURRENT_AP_POLICY_LOSSLESS_AUDIO_STREAMING; 366 case QCA_WLAN_CONCURRENT_AP_POLICY_XR: 367 return HOST_CONCURRENT_AP_POLICY_XR; 368 default: 369 return HOST_CONCURRENT_AP_POLICY_UNSPECIFIED; 370 } 371 } 372 wlan_mlme_ll_lt_sap_send_oce_flags_fw(struct wlan_objmgr_vdev * vdev)373 void wlan_mlme_ll_lt_sap_send_oce_flags_fw(struct wlan_objmgr_vdev *vdev) 374 { 375 struct wlan_objmgr_psoc *psoc = NULL; 376 uint8_t vdev_id; 377 uint8_t updated_fw_value = 0; 378 struct wlan_mlme_psoc_ext_obj *mlme_obj; 379 380 psoc = wlan_vdev_get_psoc(vdev); 381 if (!psoc) 382 return; 383 384 mlme_obj = mlme_get_psoc_ext_obj(psoc); 385 386 if (!mlme_obj) 387 return; 388 389 updated_fw_value = mlme_obj->cfg.oce.feature_bitmap; 390 vdev_id = wlan_vdev_get_id(vdev); 391 wma_debug("Vdev %d Disable FILS discovery", vdev_id); 392 updated_fw_value &= ~(WMI_VDEV_OCE_FILS_DISCOVERY_FRAME_FEATURE_BITMAP); 393 if (wma_cli_set_command(vdev_id, 394 wmi_vdev_param_enable_disable_oce_features, 395 updated_fw_value, VDEV_CMD)) 396 mlme_legacy_err("Vdev %d failed to send OCE update", vdev_id); 397 } 398 wlan_mlme_set_ap_policy(struct wlan_objmgr_vdev * vdev,enum host_concurrent_ap_policy ap_cfg_policy)399 QDF_STATUS wlan_mlme_set_ap_policy(struct wlan_objmgr_vdev *vdev, 400 enum host_concurrent_ap_policy ap_cfg_policy) 401 402 { 403 struct mlme_legacy_priv *mlme_priv; 404 405 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 406 if (!mlme_priv) { 407 mlme_legacy_err("vdev legacy private object is NULL"); 408 return QDF_STATUS_E_FAILURE; 409 } 410 411 mlme_priv->mlme_ap.ap_policy = ap_cfg_policy; 412 mlme_debug("Set ap_cfg_policy to :%d", mlme_priv->mlme_ap.ap_policy); 413 414 return QDF_STATUS_SUCCESS; 415 } 416 417 enum host_concurrent_ap_policy wlan_mlme_get_ap_policy(struct wlan_objmgr_vdev * vdev)418 wlan_mlme_get_ap_policy(struct wlan_objmgr_vdev *vdev) 419 { 420 struct mlme_legacy_priv *mlme_priv; 421 422 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 423 if (!mlme_priv) { 424 mlme_legacy_err("vdev legacy private object is NULL"); 425 return HOST_CONCURRENT_AP_POLICY_UNSPECIFIED; 426 } 427 428 mlme_debug("Get ap_cfg_policy to :%d", mlme_priv->mlme_ap.ap_policy); 429 430 return mlme_priv->mlme_ap.ap_policy; 431 } 432 wlan_mlme_get_prevent_link_down(struct wlan_objmgr_psoc * psoc,bool * prevent_link_down)433 QDF_STATUS wlan_mlme_get_prevent_link_down(struct wlan_objmgr_psoc *psoc, 434 bool *prevent_link_down) 435 { 436 struct wlan_mlme_psoc_ext_obj *mlme_obj; 437 438 mlme_obj = mlme_get_psoc_ext_obj(psoc); 439 if (!mlme_obj) 440 return QDF_STATUS_E_FAILURE; 441 442 *prevent_link_down = mlme_obj->cfg.gen.prevent_link_down; 443 444 return QDF_STATUS_SUCCESS; 445 } 446 wlan_mlme_get_select_5ghz_margin(struct wlan_objmgr_psoc * psoc,uint8_t * select_5ghz_margin)447 QDF_STATUS wlan_mlme_get_select_5ghz_margin(struct wlan_objmgr_psoc *psoc, 448 uint8_t *select_5ghz_margin) 449 { 450 struct wlan_mlme_psoc_ext_obj *mlme_obj; 451 452 mlme_obj = mlme_get_psoc_ext_obj(psoc); 453 if (!mlme_obj) 454 return QDF_STATUS_E_FAILURE; 455 456 *select_5ghz_margin = mlme_obj->cfg.gen.select_5ghz_margin; 457 458 return QDF_STATUS_SUCCESS; 459 } 460 wlan_mlme_get_rtt_mac_randomization(struct wlan_objmgr_psoc * psoc,bool * rtt_mac_randomization)461 QDF_STATUS wlan_mlme_get_rtt_mac_randomization(struct wlan_objmgr_psoc *psoc, 462 bool *rtt_mac_randomization) 463 { 464 struct wlan_mlme_psoc_ext_obj *mlme_obj; 465 466 mlme_obj = mlme_get_psoc_ext_obj(psoc); 467 if (!mlme_obj) 468 return QDF_STATUS_E_FAILURE; 469 470 *rtt_mac_randomization = mlme_obj->cfg.gen.rtt_mac_randomization; 471 472 return QDF_STATUS_SUCCESS; 473 } 474 wlan_mlme_get_crash_inject(struct wlan_objmgr_psoc * psoc,bool * crash_inject)475 QDF_STATUS wlan_mlme_get_crash_inject(struct wlan_objmgr_psoc *psoc, 476 bool *crash_inject) 477 { 478 struct wlan_mlme_psoc_ext_obj *mlme_obj; 479 480 mlme_obj = mlme_get_psoc_ext_obj(psoc); 481 if (!mlme_obj) 482 return QDF_STATUS_E_FAILURE; 483 484 *crash_inject = mlme_obj->cfg.gen.crash_inject; 485 486 return QDF_STATUS_SUCCESS; 487 } 488 wlan_mlme_get_lpass_support(struct wlan_objmgr_psoc * psoc,bool * lpass_support)489 QDF_STATUS wlan_mlme_get_lpass_support(struct wlan_objmgr_psoc *psoc, 490 bool *lpass_support) 491 { 492 struct wlan_mlme_psoc_ext_obj *mlme_obj; 493 494 mlme_obj = mlme_get_psoc_ext_obj(psoc); 495 if (!mlme_obj) 496 return QDF_STATUS_E_FAILURE; 497 498 *lpass_support = mlme_obj->cfg.gen.lpass_support; 499 500 return QDF_STATUS_SUCCESS; 501 } 502 wlan_mlme_get_wls_6ghz_cap(struct wlan_objmgr_psoc * psoc,bool * wls_6ghz_capable)503 void wlan_mlme_get_wls_6ghz_cap(struct wlan_objmgr_psoc *psoc, 504 bool *wls_6ghz_capable) 505 { 506 struct wlan_mlme_psoc_ext_obj *mlme_obj; 507 508 mlme_obj = mlme_get_psoc_ext_obj(psoc); 509 if (!mlme_obj) { 510 *wls_6ghz_capable = cfg_default(CFG_WLS_6GHZ_CAPABLE); 511 return; 512 } 513 *wls_6ghz_capable = mlme_obj->cfg.gen.wls_6ghz_capable; 514 } 515 wlan_mlme_get_self_recovery(struct wlan_objmgr_psoc * psoc,bool * self_recovery)516 QDF_STATUS wlan_mlme_get_self_recovery(struct wlan_objmgr_psoc *psoc, 517 bool *self_recovery) 518 { 519 struct wlan_mlme_psoc_ext_obj *mlme_obj; 520 521 mlme_obj = mlme_get_psoc_ext_obj(psoc); 522 if (!mlme_obj) 523 return QDF_STATUS_E_FAILURE; 524 525 *self_recovery = mlme_obj->cfg.gen.self_recovery; 526 527 return QDF_STATUS_SUCCESS; 528 } 529 wlan_mlme_get_sub_20_chan_width(struct wlan_objmgr_psoc * psoc,uint8_t * sub_20_chan_width)530 QDF_STATUS wlan_mlme_get_sub_20_chan_width(struct wlan_objmgr_psoc *psoc, 531 uint8_t *sub_20_chan_width) 532 { 533 struct wlan_mlme_psoc_ext_obj *mlme_obj; 534 535 mlme_obj = mlme_get_psoc_ext_obj(psoc); 536 if (!mlme_obj) 537 return QDF_STATUS_E_FAILURE; 538 539 *sub_20_chan_width = mlme_obj->cfg.gen.sub_20_chan_width; 540 541 return QDF_STATUS_SUCCESS; 542 } 543 wlan_mlme_get_fw_timeout_crash(struct wlan_objmgr_psoc * psoc,bool * fw_timeout_crash)544 QDF_STATUS wlan_mlme_get_fw_timeout_crash(struct wlan_objmgr_psoc *psoc, 545 bool *fw_timeout_crash) 546 { 547 struct wlan_mlme_psoc_ext_obj *mlme_obj; 548 549 mlme_obj = mlme_get_psoc_ext_obj(psoc); 550 if (!mlme_obj) 551 return QDF_STATUS_E_FAILURE; 552 553 *fw_timeout_crash = mlme_obj->cfg.gen.fw_timeout_crash; 554 555 return QDF_STATUS_SUCCESS; 556 } 557 wlan_mlme_get_ito_repeat_count(struct wlan_objmgr_psoc * psoc,uint8_t * ito_repeat_count)558 QDF_STATUS wlan_mlme_get_ito_repeat_count(struct wlan_objmgr_psoc *psoc, 559 uint8_t *ito_repeat_count) 560 { 561 struct wlan_mlme_psoc_ext_obj *mlme_obj; 562 563 mlme_obj = mlme_get_psoc_ext_obj(psoc); 564 if (!mlme_obj) 565 return QDF_STATUS_E_FAILURE; 566 567 *ito_repeat_count = mlme_obj->cfg.gen.ito_repeat_count; 568 569 return QDF_STATUS_SUCCESS; 570 } 571 wlan_mlme_get_sap_inactivity_override(struct wlan_objmgr_psoc * psoc,bool * val)572 void wlan_mlme_get_sap_inactivity_override(struct wlan_objmgr_psoc *psoc, 573 bool *val) 574 { 575 struct wlan_mlme_psoc_ext_obj *mlme_obj; 576 577 mlme_obj = mlme_get_psoc_ext_obj(psoc); 578 if (!mlme_obj) 579 return; 580 581 *val = mlme_obj->cfg.qos_mlme_params.sap_max_inactivity_override; 582 } 583 wlan_mlme_get_acs_with_more_param(struct wlan_objmgr_psoc * psoc,bool * value)584 QDF_STATUS wlan_mlme_get_acs_with_more_param(struct wlan_objmgr_psoc *psoc, 585 bool *value) 586 { 587 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 588 589 if (!mlme_obj) 590 return QDF_STATUS_E_FAILURE; 591 592 *value = mlme_obj->cfg.acs.is_acs_with_more_param; 593 return QDF_STATUS_SUCCESS; 594 } 595 wlan_mlme_get_auto_channel_weight(struct wlan_objmgr_psoc * psoc,uint32_t * value)596 QDF_STATUS wlan_mlme_get_auto_channel_weight(struct wlan_objmgr_psoc *psoc, 597 uint32_t *value) 598 { 599 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 600 601 if (!mlme_obj) { 602 *value = cfg_default(CFG_AUTO_CHANNEL_SELECT_WEIGHT); 603 return QDF_STATUS_E_FAILURE; 604 } 605 606 *value = mlme_obj->cfg.acs.auto_channel_select_weight; 607 return QDF_STATUS_SUCCESS; 608 } 609 wlan_mlme_get_vendor_acs_support(struct wlan_objmgr_psoc * psoc,bool * value)610 QDF_STATUS wlan_mlme_get_vendor_acs_support(struct wlan_objmgr_psoc *psoc, 611 bool *value) 612 { 613 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 614 615 if (!mlme_obj) 616 return QDF_STATUS_E_FAILURE; 617 618 *value = mlme_obj->cfg.acs.is_vendor_acs_support; 619 return QDF_STATUS_SUCCESS; 620 } 621 622 QDF_STATUS wlan_mlme_get_acs_support_for_dfs_ltecoex(struct wlan_objmgr_psoc * psoc,bool * value)623 wlan_mlme_get_acs_support_for_dfs_ltecoex(struct wlan_objmgr_psoc *psoc, 624 bool *value) 625 { 626 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 627 628 if (!mlme_obj) 629 return QDF_STATUS_E_FAILURE; 630 631 *value = mlme_obj->cfg.acs.is_acs_support_for_dfs_ltecoex; 632 return QDF_STATUS_SUCCESS; 633 } 634 635 QDF_STATUS wlan_mlme_get_external_acs_policy(struct wlan_objmgr_psoc * psoc,bool * value)636 wlan_mlme_get_external_acs_policy(struct wlan_objmgr_psoc *psoc, 637 bool *value) 638 { 639 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 640 641 if (!mlme_obj) 642 return QDF_STATUS_E_FAILURE; 643 644 *value = mlme_obj->cfg.acs.is_external_acs_policy; 645 return QDF_STATUS_SUCCESS; 646 } 647 wlan_mlme_get_tx_chainmask_cck(struct wlan_objmgr_psoc * psoc,bool * value)648 QDF_STATUS wlan_mlme_get_tx_chainmask_cck(struct wlan_objmgr_psoc *psoc, 649 bool *value) 650 { 651 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 652 653 if (!mlme_obj) 654 return QDF_STATUS_E_FAILURE; 655 656 *value = mlme_obj->cfg.chainmask_cfg.tx_chain_mask_cck; 657 return QDF_STATUS_SUCCESS; 658 } 659 wlan_mlme_get_tx_chainmask_1ss(struct wlan_objmgr_psoc * psoc,uint8_t * value)660 QDF_STATUS wlan_mlme_get_tx_chainmask_1ss(struct wlan_objmgr_psoc *psoc, 661 uint8_t *value) 662 { 663 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 664 665 if (!mlme_obj) 666 return QDF_STATUS_E_FAILURE; 667 668 *value = mlme_obj->cfg.chainmask_cfg.tx_chain_mask_1ss; 669 return QDF_STATUS_SUCCESS; 670 } 671 672 bool wlan_mlme_is_data_stall_recovery_fw_supported(struct wlan_objmgr_psoc * psoc)673 wlan_mlme_is_data_stall_recovery_fw_supported(struct wlan_objmgr_psoc *psoc) 674 { 675 struct wlan_mlme_psoc_ext_obj *mlme_obj; 676 677 mlme_obj = mlme_get_psoc_ext_obj(psoc); 678 if (!mlme_obj) { 679 mlme_err("MLME obj is NULL"); 680 return false; 681 } 682 683 return mlme_obj->cfg.gen.data_stall_recovery_fw_support; 684 } 685 686 void wlan_mlme_update_cfg_with_tgt_caps(struct wlan_objmgr_psoc * psoc,struct mlme_tgt_caps * tgt_caps)687 wlan_mlme_update_cfg_with_tgt_caps(struct wlan_objmgr_psoc *psoc, 688 struct mlme_tgt_caps *tgt_caps) 689 { 690 struct wlan_mlme_psoc_ext_obj *mlme_obj; 691 692 mlme_obj = mlme_get_psoc_ext_obj(psoc); 693 if (!mlme_obj) 694 return; 695 696 /* Update the mlme cfg according to the tgt capability received */ 697 698 mlme_obj->cfg.gen.data_stall_recovery_fw_support = 699 tgt_caps->data_stall_recovery_fw_support; 700 701 mlme_obj->cfg.gen.bigtk_support = tgt_caps->bigtk_support; 702 mlme_obj->cfg.gen.stop_all_host_scan_support = 703 tgt_caps->stop_all_host_scan_support; 704 mlme_obj->cfg.gen.dual_sta_roam_fw_support = 705 tgt_caps->dual_sta_roam_fw_support; 706 mlme_obj->cfg.gen.ocv_support = tgt_caps->ocv_support; 707 } 708 709 void wlan_mlme_update_aux_dev_caps(struct wlan_objmgr_psoc * psoc,struct wlan_mlme_aux_dev_caps wlan_mlme_aux_dev_caps[])710 wlan_mlme_update_aux_dev_caps( 711 struct wlan_objmgr_psoc *psoc, 712 struct wlan_mlme_aux_dev_caps wlan_mlme_aux_dev_caps[]) 713 { 714 struct wlan_mlme_psoc_ext_obj *mlme_obj; 715 716 mlme_obj = mlme_get_psoc_ext_obj(psoc); 717 if (!mlme_obj) 718 return; 719 720 qdf_mem_copy(&mlme_obj->cfg.gen.wlan_mlme_aux0_dev_caps[0], 721 &wlan_mlme_aux_dev_caps[0], 722 sizeof(mlme_obj->cfg.gen.wlan_mlme_aux0_dev_caps)); 723 } 724 wlan_mlme_cfg_get_aux_supported_modes(struct wlan_objmgr_psoc * psoc,uint32_t aux_index,enum wlan_mlme_hw_mode_config_type hw_mode_id,uint32_t * supported_modes_bitmap)725 bool wlan_mlme_cfg_get_aux_supported_modes( 726 struct wlan_objmgr_psoc *psoc, 727 uint32_t aux_index, 728 enum wlan_mlme_hw_mode_config_type hw_mode_id, 729 uint32_t *supported_modes_bitmap) 730 { 731 struct wlan_mlme_psoc_ext_obj *mlme_obj; 732 struct wlan_mlme_aux_dev_caps *wlan_mlme_aux0_dev_caps; 733 734 if (aux_index != 0) { 735 mlme_err("current only support aux0"); 736 return false; 737 } 738 739 if (hw_mode_id >= WLAN_MLME_HW_MODE_MAX) { 740 mlme_err("invalid hw mode id %d.", hw_mode_id); 741 return false; 742 } 743 744 mlme_obj = mlme_get_psoc_ext_obj(psoc); 745 if (!mlme_obj) { 746 mlme_err("MLME obj is NULL"); 747 return false; 748 } 749 wlan_mlme_aux0_dev_caps = mlme_obj->cfg.gen.wlan_mlme_aux0_dev_caps; 750 *supported_modes_bitmap = 751 wlan_mlme_aux0_dev_caps[hw_mode_id].supported_modes_bitmap; 752 return true; 753 } 754 755 /** 756 * wlan_mlme_is_aux_cap_support() - checking the corresponding capability 757 * @psoc: wlan_objmgr_psoc pointer 758 * @bit: the corresponding bit 759 * @hw_mode_id: hw mode id 760 * 761 * Return: true if corresponding capability supporting 762 */ 763 static bool wlan_mlme_is_aux_cap_support(struct wlan_objmgr_psoc * psoc,enum wlan_mlme_aux_caps_bit bit,enum wlan_mlme_hw_mode_config_type hw_mode_id)764 wlan_mlme_is_aux_cap_support(struct wlan_objmgr_psoc *psoc, 765 enum wlan_mlme_aux_caps_bit bit, 766 enum wlan_mlme_hw_mode_config_type hw_mode_id) 767 { 768 uint32_t supported_modes_bitmap = 0; 769 struct wlan_mlme_psoc_ext_obj *mlme_obj; 770 struct wlan_mlme_aux_dev_caps *wlan_mlme_aux0_dev_caps; 771 int idx; 772 773 mlme_obj = mlme_get_psoc_ext_obj(psoc); 774 if (!mlme_obj) { 775 mlme_err("MLME obj is NULL"); 776 return false; 777 } 778 779 wlan_mlme_aux0_dev_caps = mlme_obj->cfg.gen.wlan_mlme_aux0_dev_caps; 780 if (hw_mode_id >= WLAN_MLME_HW_MODE_MAX) { 781 for (idx = 0; idx < WLAN_MLME_HW_MODE_MAX; idx++) 782 supported_modes_bitmap |= 783 wlan_mlme_aux0_dev_caps[idx].supported_modes_bitmap; 784 } else { 785 supported_modes_bitmap = 786 wlan_mlme_aux0_dev_caps[hw_mode_id].supported_modes_bitmap; 787 } 788 789 return (supported_modes_bitmap & (0x1 << bit)) ? true : false; 790 } 791 792 bool wlan_mlme_is_aux_scan_support(struct wlan_objmgr_psoc * psoc,enum wlan_mlme_hw_mode_config_type hw_mode_id)793 wlan_mlme_is_aux_scan_support(struct wlan_objmgr_psoc *psoc, 794 enum wlan_mlme_hw_mode_config_type hw_mode_id) 795 { 796 return wlan_mlme_is_aux_cap_support(psoc, WLAN_MLME_AUX_MODE_SCAN_BIT, 797 hw_mode_id); 798 } 799 800 bool wlan_mlme_is_aux_listen_support(struct wlan_objmgr_psoc * psoc,enum wlan_mlme_hw_mode_config_type hw_mode_id)801 wlan_mlme_is_aux_listen_support(struct wlan_objmgr_psoc *psoc, 802 enum wlan_mlme_hw_mode_config_type hw_mode_id) 803 { 804 return wlan_mlme_is_aux_cap_support(psoc, WLAN_MLME_AUX_MODE_LISTEN_BIT, 805 hw_mode_id); 806 } 807 808 bool wlan_mlme_is_aux_emlsr_support(struct wlan_objmgr_psoc * psoc,enum wlan_mlme_hw_mode_config_type hw_mode_id)809 wlan_mlme_is_aux_emlsr_support(struct wlan_objmgr_psoc *psoc, 810 enum wlan_mlme_hw_mode_config_type hw_mode_id) 811 { 812 return wlan_mlme_is_aux_cap_support(psoc, WLAN_MLME_AUX_MODE_EMLSR_BIT, 813 hw_mode_id); 814 } 815 816 #ifdef WLAN_FEATURE_11AX wlan_mlme_cfg_get_he_ul_mumimo(struct wlan_objmgr_psoc * psoc,uint32_t * value)817 QDF_STATUS wlan_mlme_cfg_get_he_ul_mumimo(struct wlan_objmgr_psoc *psoc, 818 uint32_t *value) 819 { 820 struct wlan_mlme_psoc_ext_obj *mlme_obj; 821 822 mlme_obj = mlme_get_psoc_ext_obj(psoc); 823 if (!mlme_obj) 824 return QDF_STATUS_E_FAILURE; 825 826 *value = mlme_obj->cfg.he_caps.dot11_he_cap.ul_mu; 827 828 return QDF_STATUS_SUCCESS; 829 } 830 mlme_cfg_get_he_caps(struct wlan_objmgr_psoc * psoc,tDot11fIEhe_cap * he_cap)831 QDF_STATUS mlme_cfg_get_he_caps(struct wlan_objmgr_psoc *psoc, 832 tDot11fIEhe_cap *he_cap) 833 { 834 struct wlan_mlme_psoc_ext_obj *mlme_obj; 835 836 mlme_obj = mlme_get_psoc_ext_obj(psoc); 837 if (!mlme_obj) 838 return QDF_STATUS_E_FAILURE; 839 840 *he_cap = mlme_obj->cfg.he_caps.he_cap_orig; 841 842 return QDF_STATUS_SUCCESS; 843 } 844 wlan_mlme_cfg_set_he_ul_mumimo(struct wlan_objmgr_psoc * psoc,uint32_t value)845 QDF_STATUS wlan_mlme_cfg_set_he_ul_mumimo(struct wlan_objmgr_psoc *psoc, 846 uint32_t value) 847 { 848 struct wlan_mlme_psoc_ext_obj *mlme_obj; 849 850 mlme_obj = mlme_get_psoc_ext_obj(psoc); 851 if (!mlme_obj) 852 return QDF_STATUS_E_FAILURE; 853 854 if (!cfg_in_range(CFG_HE_UL_MUMIMO, value)) { 855 mlme_legacy_debug("Failed to set CFG_HE_UL_MUMIMO with %d", 856 value); 857 return QDF_STATUS_E_FAILURE; 858 } 859 860 mlme_obj->cfg.he_caps.dot11_he_cap.ul_mu = value; 861 862 return QDF_STATUS_SUCCESS; 863 } 864 wlan_mlme_cfg_get_enable_ul_mimo(struct wlan_objmgr_psoc * psoc,uint8_t * value)865 QDF_STATUS wlan_mlme_cfg_get_enable_ul_mimo(struct wlan_objmgr_psoc *psoc, 866 uint8_t *value) 867 { 868 struct wlan_mlme_psoc_ext_obj *mlme_obj; 869 870 mlme_obj = mlme_get_psoc_ext_obj(psoc); 871 if (!mlme_obj) 872 return QDF_STATUS_E_FAILURE; 873 874 *value = mlme_obj->cfg.he_caps.enable_ul_mimo; 875 876 return QDF_STATUS_SUCCESS; 877 } 878 wlan_mlme_cfg_get_enable_ul_ofdm(struct wlan_objmgr_psoc * psoc,uint8_t * value)879 QDF_STATUS wlan_mlme_cfg_get_enable_ul_ofdm(struct wlan_objmgr_psoc *psoc, 880 uint8_t *value) 881 { 882 struct wlan_mlme_psoc_ext_obj *mlme_obj; 883 884 mlme_obj = mlme_get_psoc_ext_obj(psoc); 885 if (!mlme_obj) 886 return QDF_STATUS_E_FAILURE; 887 888 889 *value = mlme_obj->cfg.he_caps.enable_ul_ofdm; 890 891 return QDF_STATUS_SUCCESS; 892 } 893 894 /* mlme_get_min_rate_cap() - get minimum capability for HE-MCS between 895 * ini value and fw capability. 896 * 897 * Rx HE-MCS Map and Tx HE-MCS Map subfields format where 2-bit indicates 898 * 0 indicates support for HE-MCS 0-7 for n spatial streams 899 * 1 indicates support for HE-MCS 0-9 for n spatial streams 900 * 2 indicates support for HE-MCS 0-11 for n spatial streams 901 * 3 indicates that n spatial streams is not supported for HE PPDUs 902 * 903 */ mlme_get_min_rate_cap(uint16_t val1,uint16_t val2)904 static uint16_t mlme_get_min_rate_cap(uint16_t val1, uint16_t val2) 905 { 906 uint16_t ret = 0, i; 907 908 for (i = 0; i < 8; i++) { 909 if (((val1 >> (2 * i)) & 0x3) == 0x3 || 910 ((val2 >> (2 * i)) & 0x3) == 0x3) { 911 ret |= 0x3 << (2 * i); 912 continue; 913 } 914 ret |= QDF_MIN((val1 >> (2 * i)) & 0x3, 915 (val2 >> (2 * i)) & 0x3) << (2 * i); 916 } 917 return ret; 918 } 919 mlme_update_tgt_he_caps_in_cfg(struct wlan_objmgr_psoc * psoc,struct wma_tgt_cfg * wma_cfg)920 QDF_STATUS mlme_update_tgt_he_caps_in_cfg(struct wlan_objmgr_psoc *psoc, 921 struct wma_tgt_cfg *wma_cfg) 922 { 923 uint8_t chan_width; 924 QDF_STATUS status = QDF_STATUS_SUCCESS; 925 tDot11fIEhe_cap *he_cap = &wma_cfg->he_cap; 926 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 927 uint8_t value, twt_req, twt_resp; 928 uint16_t tx_mcs_map = 0; 929 uint16_t rx_mcs_map = 0; 930 uint8_t nss; 931 932 if (!mlme_obj) 933 return QDF_STATUS_E_FAILURE; 934 935 mlme_obj->cfg.he_caps.dot11_he_cap.present = 1; 936 mlme_obj->cfg.he_caps.dot11_he_cap.htc_he = he_cap->htc_he; 937 938 twt_req = QDF_MIN(he_cap->twt_request, 939 mlme_obj->cfg.he_caps.dot11_he_cap.twt_request); 940 mlme_obj->cfg.he_caps.dot11_he_cap.twt_request = twt_req; 941 942 twt_resp = QDF_MIN(he_cap->twt_responder, 943 mlme_obj->cfg.he_caps.dot11_he_cap.twt_responder); 944 mlme_obj->cfg.he_caps.dot11_he_cap.twt_responder = twt_resp; 945 946 value = QDF_MIN(he_cap->fragmentation, 947 mlme_obj->cfg.he_caps.he_dynamic_fragmentation); 948 949 if (cfg_in_range(CFG_HE_FRAGMENTATION, value)) 950 mlme_obj->cfg.he_caps.dot11_he_cap.fragmentation = value; 951 952 if (cfg_in_range(CFG_HE_MAX_FRAG_MSDU, 953 he_cap->max_num_frag_msdu_amsdu_exp)) 954 mlme_obj->cfg.he_caps.dot11_he_cap.max_num_frag_msdu_amsdu_exp = 955 he_cap->max_num_frag_msdu_amsdu_exp; 956 if (cfg_in_range(CFG_HE_MIN_FRAG_SIZE, he_cap->min_frag_size)) 957 mlme_obj->cfg.he_caps.dot11_he_cap.min_frag_size = 958 he_cap->min_frag_size; 959 if (cfg_in_range(CFG_HE_TRIG_PAD, he_cap->trigger_frm_mac_pad)) 960 mlme_obj->cfg.he_caps.dot11_he_cap.trigger_frm_mac_pad = 961 QDF_MIN(he_cap->trigger_frm_mac_pad, 962 mlme_obj->cfg.he_caps.dot11_he_cap.trigger_frm_mac_pad); 963 if (cfg_in_range(CFG_HE_MTID_AGGR_RX, he_cap->multi_tid_aggr_rx_supp)) 964 mlme_obj->cfg.he_caps.dot11_he_cap.multi_tid_aggr_rx_supp = 965 he_cap->multi_tid_aggr_rx_supp; 966 if (cfg_in_range(CFG_HE_MTID_AGGR_TX, he_cap->multi_tid_aggr_tx_supp)) 967 mlme_obj->cfg.he_caps.dot11_he_cap.multi_tid_aggr_tx_supp = 968 he_cap->multi_tid_aggr_tx_supp; 969 if (cfg_in_range(CFG_HE_LINK_ADAPTATION, he_cap->he_link_adaptation)) 970 mlme_obj->cfg.he_caps.dot11_he_cap.he_link_adaptation = 971 he_cap->he_link_adaptation; 972 mlme_obj->cfg.he_caps.dot11_he_cap.all_ack = he_cap->all_ack; 973 mlme_obj->cfg.he_caps.dot11_he_cap.trigd_rsp_sched = 974 he_cap->trigd_rsp_sched; 975 mlme_obj->cfg.he_caps.dot11_he_cap.a_bsr = he_cap->a_bsr; 976 977 value = QDF_MIN(he_cap->broadcast_twt, 978 mlme_obj->cfg.he_caps.dot11_he_cap.broadcast_twt); 979 mlme_obj->cfg.he_caps.dot11_he_cap.broadcast_twt = value; 980 981 /* 982 * As per 802.11ax spec, Flexible TWT capability can be set 983 * independent of TWT Requestor/Responder capability. 984 * But currently we don't have any such usecase and firmware 985 * does not support it. Hence enabling Flexible TWT only when 986 * either or both of the TWT Requestor/Responder capability 987 * is set/enabled. 988 */ 989 value = QDF_MIN(he_cap->flex_twt_sched, (twt_req || twt_resp)); 990 mlme_obj->cfg.he_caps.dot11_he_cap.flex_twt_sched = value; 991 992 mlme_obj->cfg.he_caps.dot11_he_cap.ba_32bit_bitmap = 993 he_cap->ba_32bit_bitmap; 994 mlme_obj->cfg.he_caps.dot11_he_cap.mu_cascade = he_cap->mu_cascade; 995 mlme_obj->cfg.he_caps.dot11_he_cap.ack_enabled_multitid = 996 he_cap->ack_enabled_multitid; 997 mlme_obj->cfg.he_caps.dot11_he_cap.omi_a_ctrl = he_cap->omi_a_ctrl; 998 mlme_obj->cfg.he_caps.dot11_he_cap.ofdma_ra = he_cap->ofdma_ra; 999 if (cfg_in_range(CFG_HE_MAX_AMPDU_LEN, he_cap->max_ampdu_len_exp_ext)) 1000 mlme_obj->cfg.he_caps.dot11_he_cap.max_ampdu_len_exp_ext = 1001 he_cap->max_ampdu_len_exp_ext; 1002 mlme_obj->cfg.he_caps.dot11_he_cap.amsdu_frag = he_cap->amsdu_frag; 1003 mlme_obj->cfg.he_caps.dot11_he_cap.rx_ctrl_frame = 1004 he_cap->rx_ctrl_frame; 1005 mlme_obj->cfg.he_caps.dot11_he_cap.bsrp_ampdu_aggr = 1006 he_cap->bsrp_ampdu_aggr; 1007 mlme_obj->cfg.he_caps.dot11_he_cap.qtp = he_cap->qtp; 1008 mlme_obj->cfg.he_caps.dot11_he_cap.a_bqr = he_cap->a_bqr; 1009 mlme_obj->cfg.he_caps.dot11_he_cap.spatial_reuse_param_rspder = 1010 he_cap->spatial_reuse_param_rspder; 1011 mlme_obj->cfg.he_caps.dot11_he_cap.ndp_feedback_supp = 1012 he_cap->ndp_feedback_supp; 1013 mlme_obj->cfg.he_caps.dot11_he_cap.ops_supp = he_cap->ops_supp; 1014 mlme_obj->cfg.he_caps.dot11_he_cap.amsdu_in_ampdu = 1015 he_cap->amsdu_in_ampdu; 1016 mlme_obj->cfg.he_caps.dot11_he_cap.he_sub_ch_sel_tx_supp = 1017 he_cap->he_sub_ch_sel_tx_supp; 1018 mlme_obj->cfg.he_caps.dot11_he_cap.ul_2x996_tone_ru_supp = 1019 he_cap->ul_2x996_tone_ru_supp; 1020 mlme_obj->cfg.he_caps.dot11_he_cap.om_ctrl_ul_mu_data_dis_rx = 1021 he_cap->om_ctrl_ul_mu_data_dis_rx; 1022 mlme_obj->cfg.he_caps.dot11_he_cap.he_dynamic_smps = 1023 he_cap->he_dynamic_smps; 1024 mlme_obj->cfg.he_caps.dot11_he_cap.punctured_sounding_supp = 1025 he_cap->punctured_sounding_supp; 1026 mlme_obj->cfg.he_caps.dot11_he_cap.ht_vht_trg_frm_rx_supp = 1027 he_cap->ht_vht_trg_frm_rx_supp; 1028 1029 chan_width = HE_CH_WIDTH_COMBINE(he_cap->chan_width_0, 1030 he_cap->chan_width_1, 1031 he_cap->chan_width_2, 1032 he_cap->chan_width_3, 1033 he_cap->chan_width_4, 1034 he_cap->chan_width_5, 1035 he_cap->chan_width_6); 1036 if (cfg_in_range(CFG_HE_CHAN_WIDTH, chan_width)) { 1037 mlme_obj->cfg.he_caps.dot11_he_cap.chan_width_0 = 1038 he_cap->chan_width_0; 1039 mlme_obj->cfg.he_caps.dot11_he_cap.chan_width_1 = 1040 he_cap->chan_width_1; 1041 mlme_obj->cfg.he_caps.dot11_he_cap.chan_width_2 = 1042 he_cap->chan_width_2; 1043 mlme_obj->cfg.he_caps.dot11_he_cap.chan_width_3 = 1044 he_cap->chan_width_3; 1045 mlme_obj->cfg.he_caps.dot11_he_cap.chan_width_4 = 1046 he_cap->chan_width_4; 1047 mlme_obj->cfg.he_caps.dot11_he_cap.chan_width_5 = 1048 he_cap->chan_width_5; 1049 mlme_obj->cfg.he_caps.dot11_he_cap.chan_width_6 = 1050 he_cap->chan_width_6; 1051 } 1052 if (cfg_in_range(CFG_HE_RX_PREAM_PUNC, he_cap->rx_pream_puncturing)) 1053 mlme_obj->cfg.he_caps.dot11_he_cap.rx_pream_puncturing = 1054 he_cap->rx_pream_puncturing; 1055 mlme_obj->cfg.he_caps.dot11_he_cap.device_class = he_cap->device_class; 1056 mlme_obj->cfg.he_caps.dot11_he_cap.ldpc_coding = he_cap->ldpc_coding; 1057 if (cfg_in_range(CFG_HE_LTF_PPDU, he_cap->he_1x_ltf_800_gi_ppdu)) 1058 mlme_obj->cfg.he_caps.dot11_he_cap.he_1x_ltf_800_gi_ppdu = 1059 he_cap->he_1x_ltf_800_gi_ppdu; 1060 if (cfg_in_range(CFG_HE_MIDAMBLE_RX_MAX_NSTS, 1061 he_cap->midamble_tx_rx_max_nsts)) 1062 mlme_obj->cfg.he_caps.dot11_he_cap.midamble_tx_rx_max_nsts = 1063 he_cap->midamble_tx_rx_max_nsts; 1064 mlme_obj->cfg.he_caps.dot11_he_cap.he_4x_ltf_3200_gi_ndp = 1065 he_cap->he_4x_ltf_3200_gi_ndp; 1066 if (mlme_obj->cfg.vht_caps.vht_cap_info.rx_stbc) { 1067 mlme_obj->cfg.he_caps.dot11_he_cap.rx_stbc_lt_80mhz = 1068 he_cap->rx_stbc_lt_80mhz; 1069 mlme_obj->cfg.he_caps.dot11_he_cap.rx_stbc_gt_80mhz = 1070 he_cap->rx_stbc_gt_80mhz; 1071 } else { 1072 mlme_obj->cfg.he_caps.dot11_he_cap.rx_stbc_lt_80mhz = 0; 1073 mlme_obj->cfg.he_caps.dot11_he_cap.rx_stbc_gt_80mhz = 0; 1074 } 1075 if (mlme_obj->cfg.vht_caps.vht_cap_info.tx_stbc) { 1076 mlme_obj->cfg.he_caps.dot11_he_cap.tb_ppdu_tx_stbc_lt_80mhz = 1077 he_cap->tb_ppdu_tx_stbc_lt_80mhz; 1078 mlme_obj->cfg.he_caps.dot11_he_cap.tb_ppdu_tx_stbc_gt_80mhz = 1079 he_cap->tb_ppdu_tx_stbc_gt_80mhz; 1080 } else { 1081 mlme_obj->cfg.he_caps.dot11_he_cap.tb_ppdu_tx_stbc_lt_80mhz = 0; 1082 mlme_obj->cfg.he_caps.dot11_he_cap.tb_ppdu_tx_stbc_gt_80mhz = 0; 1083 } 1084 1085 if (cfg_in_range(CFG_HE_DOPPLER, he_cap->doppler)) 1086 mlme_obj->cfg.he_caps.dot11_he_cap.doppler = he_cap->doppler; 1087 if (cfg_in_range(CFG_HE_DCM_TX, he_cap->dcm_enc_tx)) 1088 mlme_obj->cfg.he_caps.dot11_he_cap.dcm_enc_tx = 1089 he_cap->dcm_enc_tx; 1090 if (cfg_in_range(CFG_HE_DCM_RX, he_cap->dcm_enc_rx)) 1091 mlme_obj->cfg.he_caps.dot11_he_cap.dcm_enc_rx = 1092 he_cap->dcm_enc_rx; 1093 mlme_obj->cfg.he_caps.dot11_he_cap.ul_he_mu = he_cap->ul_he_mu; 1094 if (mlme_obj->cfg.vht_caps.vht_cap_info.su_bformer) { 1095 mlme_obj->cfg.he_caps.dot11_he_cap.su_beamformer = 1096 he_cap->su_beamformer; 1097 if (cfg_in_range(CFG_HE_NUM_SOUND_LT80, 1098 he_cap->num_sounding_lt_80)) 1099 mlme_obj->cfg.he_caps.dot11_he_cap.num_sounding_lt_80 = 1100 he_cap->num_sounding_lt_80; 1101 if (cfg_in_range(CFG_HE_NUM_SOUND_GT80, 1102 he_cap->num_sounding_gt_80)) 1103 mlme_obj->cfg.he_caps.dot11_he_cap.num_sounding_gt_80 = 1104 he_cap->num_sounding_gt_80; 1105 mlme_obj->cfg.he_caps.dot11_he_cap.mu_beamformer = 1106 he_cap->mu_beamformer; 1107 1108 } else { 1109 mlme_obj->cfg.he_caps.dot11_he_cap.su_beamformer = 0; 1110 mlme_obj->cfg.he_caps.dot11_he_cap.num_sounding_lt_80 = 0; 1111 mlme_obj->cfg.he_caps.dot11_he_cap.num_sounding_gt_80 = 0; 1112 mlme_obj->cfg.he_caps.dot11_he_cap.mu_beamformer = 0; 1113 } 1114 1115 if (mlme_obj->cfg.vht_caps.vht_cap_info.su_bformee) { 1116 mlme_obj->cfg.he_caps.dot11_he_cap.su_beamformee = 1117 he_cap->su_beamformee; 1118 if (cfg_in_range(CFG_HE_BFEE_STS_LT80, he_cap->bfee_sts_lt_80)) 1119 mlme_obj->cfg.he_caps.dot11_he_cap.bfee_sts_lt_80 = 1120 he_cap->bfee_sts_lt_80; 1121 if (cfg_in_range(CFG_HE_BFEE_STS_GT80, he_cap->bfee_sts_gt_80)) 1122 mlme_obj->cfg.he_caps.dot11_he_cap.bfee_sts_gt_80 = 1123 he_cap->bfee_sts_gt_80; 1124 1125 } else { 1126 mlme_obj->cfg.he_caps.dot11_he_cap.su_beamformee = 0; 1127 mlme_obj->cfg.he_caps.dot11_he_cap.bfee_sts_lt_80 = 0; 1128 mlme_obj->cfg.he_caps.dot11_he_cap.bfee_sts_gt_80 = 0; 1129 } 1130 1131 if (!mlme_obj->cfg.he_caps.enable_ul_mimo) { 1132 mlme_debug("UL MIMO feature is disabled via ini, fw caps :%d", 1133 he_cap->ul_mu); 1134 mlme_obj->cfg.he_caps.dot11_he_cap.ul_mu = 0; 1135 } else { 1136 mlme_obj->cfg.he_caps.dot11_he_cap.ul_mu = he_cap->ul_mu; 1137 } 1138 1139 mlme_obj->cfg.he_caps.dot11_he_cap.su_feedback_tone16 = 1140 he_cap->su_feedback_tone16; 1141 mlme_obj->cfg.he_caps.dot11_he_cap.mu_feedback_tone16 = 1142 he_cap->mu_feedback_tone16; 1143 mlme_obj->cfg.he_caps.dot11_he_cap.codebook_su = he_cap->codebook_su; 1144 mlme_obj->cfg.he_caps.dot11_he_cap.codebook_mu = he_cap->codebook_mu; 1145 if (cfg_in_range(CFG_HE_BFRM_FEED, he_cap->beamforming_feedback)) 1146 mlme_obj->cfg.he_caps.dot11_he_cap.beamforming_feedback = 1147 he_cap->beamforming_feedback; 1148 mlme_obj->cfg.he_caps.dot11_he_cap.he_er_su_ppdu = 1149 he_cap->he_er_su_ppdu; 1150 mlme_obj->cfg.he_caps.dot11_he_cap.dl_mu_mimo_part_bw = 1151 he_cap->dl_mu_mimo_part_bw; 1152 mlme_obj->cfg.he_caps.dot11_he_cap.ppet_present = he_cap->ppet_present; 1153 mlme_obj->cfg.he_caps.dot11_he_cap.srp = he_cap->srp; 1154 mlme_obj->cfg.he_caps.dot11_he_cap.power_boost = he_cap->power_boost; 1155 mlme_obj->cfg.he_caps.dot11_he_cap.he_ltf_800_gi_4x = 1156 he_cap->he_ltf_800_gi_4x; 1157 if (cfg_in_range(CFG_HE_MAX_NC, he_cap->max_nc)) 1158 mlme_obj->cfg.he_caps.dot11_he_cap.max_nc = he_cap->max_nc; 1159 mlme_obj->cfg.he_caps.dot11_he_cap.er_he_ltf_800_gi_4x = 1160 he_cap->er_he_ltf_800_gi_4x; 1161 mlme_obj->cfg.he_caps.dot11_he_cap.he_ppdu_20_in_40Mhz_2G = 1162 he_cap->he_ppdu_20_in_40Mhz_2G; 1163 mlme_obj->cfg.he_caps.dot11_he_cap.he_ppdu_20_in_160_80p80Mhz = 1164 he_cap->he_ppdu_20_in_160_80p80Mhz; 1165 mlme_obj->cfg.he_caps.dot11_he_cap.he_ppdu_80_in_160_80p80Mhz = 1166 he_cap->he_ppdu_80_in_160_80p80Mhz; 1167 mlme_obj->cfg.he_caps.dot11_he_cap.er_1x_he_ltf_gi = 1168 he_cap->er_1x_he_ltf_gi; 1169 mlme_obj->cfg.he_caps.dot11_he_cap.midamble_tx_rx_1x_he_ltf = 1170 he_cap->midamble_tx_rx_1x_he_ltf; 1171 if (cfg_in_range(CFG_HE_DCM_MAX_BW, he_cap->dcm_max_bw)) 1172 mlme_obj->cfg.he_caps.dot11_he_cap.dcm_max_bw = 1173 he_cap->dcm_max_bw; 1174 mlme_obj->cfg.he_caps.dot11_he_cap.longer_than_16_he_sigb_ofdm_sym = 1175 he_cap->longer_than_16_he_sigb_ofdm_sym; 1176 mlme_obj->cfg.he_caps.dot11_he_cap.tx_1024_qam_lt_242_tone_ru = 1177 he_cap->tx_1024_qam_lt_242_tone_ru; 1178 mlme_obj->cfg.he_caps.dot11_he_cap.rx_1024_qam_lt_242_tone_ru = 1179 he_cap->rx_1024_qam_lt_242_tone_ru; 1180 mlme_obj->cfg.he_caps.dot11_he_cap.non_trig_cqi_feedback = 1181 he_cap->non_trig_cqi_feedback; 1182 mlme_obj->cfg.he_caps.dot11_he_cap.rx_full_bw_su_he_mu_compress_sigb = 1183 he_cap->rx_full_bw_su_he_mu_compress_sigb; 1184 mlme_obj->cfg.he_caps.dot11_he_cap.rx_full_bw_su_he_mu_non_cmpr_sigb = 1185 he_cap->rx_full_bw_su_he_mu_non_cmpr_sigb; 1186 1187 tx_mcs_map = mlme_get_min_rate_cap( 1188 mlme_obj->cfg.he_caps.dot11_he_cap.tx_he_mcs_map_lt_80, 1189 he_cap->tx_he_mcs_map_lt_80); 1190 rx_mcs_map = mlme_get_min_rate_cap( 1191 mlme_obj->cfg.he_caps.dot11_he_cap.rx_he_mcs_map_lt_80, 1192 he_cap->rx_he_mcs_map_lt_80); 1193 if (!mlme_obj->cfg.vht_caps.vht_cap_info.enable2x2) { 1194 nss = 2; 1195 tx_mcs_map = HE_SET_MCS_4_NSS(tx_mcs_map, HE_MCS_DISABLE, nss); 1196 rx_mcs_map = HE_SET_MCS_4_NSS(rx_mcs_map, HE_MCS_DISABLE, nss); 1197 } 1198 1199 if (cfg_in_range(CFG_HE_RX_MCS_MAP_LT_80, rx_mcs_map)) 1200 mlme_obj->cfg.he_caps.dot11_he_cap.rx_he_mcs_map_lt_80 = 1201 rx_mcs_map; 1202 if (cfg_in_range(CFG_HE_TX_MCS_MAP_LT_80, tx_mcs_map)) 1203 mlme_obj->cfg.he_caps.dot11_he_cap.tx_he_mcs_map_lt_80 = 1204 tx_mcs_map; 1205 tx_mcs_map = mlme_get_min_rate_cap( 1206 *((uint16_t *)mlme_obj->cfg.he_caps.dot11_he_cap.tx_he_mcs_map_160), 1207 *((uint16_t *)he_cap->tx_he_mcs_map_160)); 1208 rx_mcs_map = mlme_get_min_rate_cap( 1209 *((uint16_t *)mlme_obj->cfg.he_caps.dot11_he_cap.rx_he_mcs_map_160), 1210 *((uint16_t *)he_cap->rx_he_mcs_map_160)); 1211 1212 if (!mlme_obj->cfg.vht_caps.vht_cap_info.enable2x2) { 1213 nss = 2; 1214 tx_mcs_map = HE_SET_MCS_4_NSS(tx_mcs_map, HE_MCS_DISABLE, nss); 1215 rx_mcs_map = HE_SET_MCS_4_NSS(rx_mcs_map, HE_MCS_DISABLE, nss); 1216 } 1217 1218 if (cfg_in_range(CFG_HE_RX_MCS_MAP_160, rx_mcs_map)) 1219 qdf_mem_copy(mlme_obj->cfg.he_caps.dot11_he_cap. 1220 rx_he_mcs_map_160, 1221 &rx_mcs_map, sizeof(uint16_t)); 1222 1223 if (cfg_in_range(CFG_HE_TX_MCS_MAP_160, tx_mcs_map)) 1224 qdf_mem_copy(mlme_obj->cfg.he_caps.dot11_he_cap. 1225 tx_he_mcs_map_160, 1226 &tx_mcs_map, sizeof(uint16_t)); 1227 1228 if (cfg_in_range(CFG_HE_RX_MCS_MAP_80_80, 1229 *((uint16_t *)he_cap->rx_he_mcs_map_80_80))) 1230 qdf_mem_copy(mlme_obj->cfg.he_caps.dot11_he_cap. 1231 rx_he_mcs_map_80_80, 1232 he_cap->rx_he_mcs_map_80_80, sizeof(uint16_t)); 1233 1234 if (cfg_in_range(CFG_HE_TX_MCS_MAP_80_80, 1235 *((uint16_t *)he_cap->tx_he_mcs_map_80_80))) 1236 qdf_mem_copy(mlme_obj->cfg.he_caps.dot11_he_cap. 1237 tx_he_mcs_map_80_80, 1238 he_cap->tx_he_mcs_map_80_80, sizeof(uint16_t)); 1239 1240 qdf_mem_copy(mlme_obj->cfg.he_caps.he_ppet_2g, wma_cfg->ppet_2g, 1241 HE_MAX_PPET_SIZE); 1242 1243 qdf_mem_copy(mlme_obj->cfg.he_caps.he_ppet_5g, wma_cfg->ppet_5g, 1244 HE_MAX_PPET_SIZE); 1245 1246 mlme_obj->cfg.he_caps.he_cap_orig = mlme_obj->cfg.he_caps.dot11_he_cap; 1247 /* Take intersection of host and FW capabilities */ 1248 mlme_obj->cfg.he_caps.he_mcs_12_13_supp_2g &= 1249 wma_cfg->he_mcs_12_13_supp_2g; 1250 mlme_obj->cfg.he_caps.he_mcs_12_13_supp_5g &= 1251 wma_cfg->he_mcs_12_13_supp_5g; 1252 mlme_debug("mcs_12_13 2G: %x 5G: %x FW_cap: 2G: %x 5G: %x", 1253 mlme_obj->cfg.he_caps.he_mcs_12_13_supp_2g, 1254 mlme_obj->cfg.he_caps.he_mcs_12_13_supp_5g, 1255 wma_cfg->he_mcs_12_13_supp_2g, 1256 wma_cfg->he_mcs_12_13_supp_5g); 1257 1258 return status; 1259 } 1260 #ifdef WLAN_FEATURE_SR 1261 void wlan_mlme_get_sr_enable_modes(struct wlan_objmgr_psoc * psoc,uint8_t * val)1262 wlan_mlme_get_sr_enable_modes(struct wlan_objmgr_psoc *psoc, uint8_t *val) 1263 { 1264 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 1265 1266 if (!mlme_obj) { 1267 *val = cfg_default(CFG_SR_ENABLE_MODES); 1268 return; 1269 } 1270 *val = mlme_obj->cfg.gen.sr_enable_modes; 1271 } 1272 #endif 1273 #endif 1274 1275 #ifdef WLAN_FEATURE_11BE mlme_update_tgt_eht_caps_in_cfg(struct wlan_objmgr_psoc * psoc,struct wma_tgt_cfg * wma_cfg)1276 QDF_STATUS mlme_update_tgt_eht_caps_in_cfg(struct wlan_objmgr_psoc *psoc, 1277 struct wma_tgt_cfg *wma_cfg) 1278 { 1279 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 1280 tDot11fIEeht_cap *eht_cap = &wma_cfg->eht_cap; 1281 tDot11fIEeht_cap *mlme_eht_cap; 1282 bool eht_capab; 1283 1284 if (!mlme_obj) 1285 return QDF_STATUS_E_FAILURE; 1286 1287 wlan_psoc_mlme_get_11be_capab(psoc, &eht_capab); 1288 if (!eht_capab) 1289 return QDF_STATUS_SUCCESS; 1290 1291 mlme_obj->cfg.eht_caps.dot11_eht_cap.present = 1; 1292 qdf_mem_copy(&mlme_obj->cfg.eht_caps.dot11_eht_cap, eht_cap, 1293 sizeof(tDot11fIEeht_cap)); 1294 mlme_eht_cap = &mlme_obj->cfg.eht_caps.dot11_eht_cap; 1295 if (mlme_obj->cfg.vht_caps.vht_cap_info.su_bformer) { 1296 mlme_eht_cap->su_beamformer = eht_cap->su_beamformer; 1297 if (cfg_in_range(CFG_EHT_NUM_SOUNDING_DIM_LE_80MHZ, 1298 eht_cap->num_sounding_dim_le_80mhz)) 1299 mlme_eht_cap->num_sounding_dim_le_80mhz = 1300 eht_cap->num_sounding_dim_le_80mhz; 1301 if (cfg_in_range(CFG_EHT_NUM_SOUNDING_DIM_160MHZ, 1302 eht_cap->num_sounding_dim_160mhz)) 1303 mlme_eht_cap->num_sounding_dim_160mhz = 1304 eht_cap->num_sounding_dim_160mhz; 1305 if (cfg_in_range(CFG_EHT_NUM_SOUNDING_DIM_320MHZ, 1306 eht_cap->num_sounding_dim_320mhz)) 1307 mlme_eht_cap->num_sounding_dim_320mhz = 1308 eht_cap->num_sounding_dim_320mhz; 1309 mlme_eht_cap->mu_bformer_le_80mhz = 1310 eht_cap->mu_bformer_le_80mhz; 1311 mlme_eht_cap->mu_bformer_160mhz = eht_cap->mu_bformer_160mhz; 1312 mlme_eht_cap->mu_bformer_320mhz = eht_cap->mu_bformer_320mhz; 1313 1314 } else { 1315 mlme_eht_cap->su_beamformer = 0; 1316 mlme_eht_cap->num_sounding_dim_le_80mhz = 0; 1317 mlme_eht_cap->num_sounding_dim_160mhz = 0; 1318 mlme_eht_cap->num_sounding_dim_320mhz = 0; 1319 mlme_eht_cap->mu_bformer_le_80mhz = 0; 1320 mlme_eht_cap->mu_bformer_160mhz = 0; 1321 mlme_eht_cap->mu_bformer_320mhz = 0; 1322 } 1323 1324 if (mlme_obj->cfg.vht_caps.vht_cap_info.su_bformee) { 1325 mlme_eht_cap->su_beamformee = eht_cap->su_beamformee; 1326 if (cfg_in_range(CFG_EHT_BFEE_SS_LE_80MHZ, 1327 eht_cap->bfee_ss_le_80mhz)) 1328 mlme_eht_cap->bfee_ss_le_80mhz = 1329 eht_cap->bfee_ss_le_80mhz; 1330 if (cfg_in_range(CFG_EHT_BFEE_SS_160MHZ, 1331 eht_cap->bfee_ss_160mhz)) 1332 mlme_eht_cap->bfee_ss_160mhz = eht_cap->bfee_ss_160mhz; 1333 if (cfg_in_range(CFG_EHT_BFEE_SS_320MHZ, 1334 eht_cap->bfee_ss_320mhz)) 1335 mlme_eht_cap->bfee_ss_320mhz = eht_cap->bfee_ss_320mhz; 1336 1337 } else { 1338 mlme_eht_cap->su_beamformee = 0; 1339 mlme_eht_cap->bfee_ss_le_80mhz = 0; 1340 mlme_eht_cap->bfee_ss_160mhz = 0; 1341 mlme_eht_cap->bfee_ss_320mhz = 0; 1342 } 1343 mlme_obj->cfg.eht_caps.eht_cap_orig = 1344 mlme_obj->cfg.eht_caps.dot11_eht_cap; 1345 1346 return QDF_STATUS_SUCCESS; 1347 } 1348 mlme_update_tgt_mlo_caps_in_cfg(struct wlan_objmgr_psoc * psoc)1349 QDF_STATUS mlme_update_tgt_mlo_caps_in_cfg(struct wlan_objmgr_psoc *psoc) 1350 { 1351 struct target_psoc_info *tgt_hdl; 1352 QDF_STATUS status; 1353 uint16_t value; 1354 1355 tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc); 1356 if (!tgt_hdl) { 1357 mlme_debug("target psoc info is NULL"); 1358 return QDF_STATUS_E_FAILURE; 1359 } 1360 1361 value = target_if_res_cfg_get_num_max_mlo_link(tgt_hdl); 1362 status = wlan_mlme_set_sta_mlo_conn_max_num(psoc, value); 1363 mlme_debug("Max ML link supported: %d", value); 1364 1365 return status; 1366 } 1367 wlan_mlme_convert_phy_ch_width_to_eht_op_bw(enum phy_ch_width ch_width)1368 uint8_t wlan_mlme_convert_phy_ch_width_to_eht_op_bw(enum phy_ch_width ch_width) 1369 { 1370 switch (ch_width) { 1371 case CH_WIDTH_320MHZ: 1372 return WLAN_EHT_CHWIDTH_320; 1373 case CH_WIDTH_160MHZ: 1374 return WLAN_EHT_CHWIDTH_160; 1375 case CH_WIDTH_80MHZ: 1376 return WLAN_EHT_CHWIDTH_80; 1377 case CH_WIDTH_40MHZ: 1378 return WLAN_EHT_CHWIDTH_40; 1379 default: 1380 return WLAN_EHT_CHWIDTH_20; 1381 } 1382 } 1383 wlan_mlme_convert_eht_op_bw_to_phy_ch_width(uint8_t channel_width)1384 enum phy_ch_width wlan_mlme_convert_eht_op_bw_to_phy_ch_width( 1385 uint8_t channel_width) 1386 { 1387 enum phy_ch_width phy_bw = CH_WIDTH_20MHZ; 1388 1389 if (channel_width == WLAN_EHT_CHWIDTH_320) 1390 phy_bw = CH_WIDTH_320MHZ; 1391 else if (channel_width == WLAN_EHT_CHWIDTH_160) 1392 phy_bw = CH_WIDTH_160MHZ; 1393 else if (channel_width == WLAN_EHT_CHWIDTH_80) 1394 phy_bw = CH_WIDTH_80MHZ; 1395 else if (channel_width == WLAN_EHT_CHWIDTH_40) 1396 phy_bw = CH_WIDTH_40MHZ; 1397 1398 return phy_bw; 1399 } 1400 wlan_mlme_get_epcs_capability(struct wlan_objmgr_psoc * psoc)1401 bool wlan_mlme_get_epcs_capability(struct wlan_objmgr_psoc *psoc) 1402 { 1403 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 1404 1405 if (!mlme_obj) 1406 return true; 1407 1408 return mlme_obj->cfg.sta.epcs_capability; 1409 } 1410 wlan_mlme_set_epcs_capability(struct wlan_objmgr_psoc * psoc,bool flag)1411 void wlan_mlme_set_epcs_capability(struct wlan_objmgr_psoc *psoc, bool flag) 1412 { 1413 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 1414 struct mac_context *mac_ctx = cds_get_context(QDF_MODULE_ID_PE); 1415 1416 if (!mlme_obj || !mac_ctx) 1417 return; 1418 1419 mlme_debug("set mlme epcs capability from %d to %d", 1420 mlme_obj->cfg.sta.epcs_capability, flag); 1421 mlme_obj->cfg.sta.epcs_capability = flag; 1422 if (flag) { 1423 mlme_obj->cfg.eht_caps.dot11_eht_cap.epcs_pri_access = 1; 1424 mac_ctx->eht_cap_2g.epcs_pri_access = 1; 1425 mac_ctx->eht_cap_5g.epcs_pri_access = 1; 1426 } else { 1427 mlme_obj->cfg.eht_caps.dot11_eht_cap.epcs_pri_access = 0; 1428 mac_ctx->eht_cap_2g.epcs_pri_access = 0; 1429 mac_ctx->eht_cap_5g.epcs_pri_access = 0; 1430 } 1431 } 1432 wlan_mlme_get_eht_disable_punct_in_us_lpi(struct wlan_objmgr_psoc * psoc)1433 bool wlan_mlme_get_eht_disable_punct_in_us_lpi(struct wlan_objmgr_psoc *psoc) 1434 { 1435 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 1436 1437 if (!mlme_obj) 1438 return false; 1439 1440 return mlme_obj->cfg.sta.eht_disable_punct_in_us_lpi; 1441 } 1442 wlan_mlme_set_eht_disable_punct_in_us_lpi(struct wlan_objmgr_psoc * psoc,bool flag)1443 void wlan_mlme_set_eht_disable_punct_in_us_lpi(struct wlan_objmgr_psoc *psoc, bool flag) 1444 { 1445 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 1446 1447 if (!mlme_obj) 1448 return; 1449 1450 mlme_debug("set mlme epcs capability to %d", flag); 1451 mlme_obj->cfg.sta.eht_disable_punct_in_us_lpi = flag; 1452 } 1453 wlan_mlme_get_usr_disable_sta_eht(struct wlan_objmgr_psoc * psoc)1454 bool wlan_mlme_get_usr_disable_sta_eht(struct wlan_objmgr_psoc *psoc) 1455 { 1456 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 1457 1458 if (!mlme_obj) 1459 return true; 1460 1461 return mlme_obj->cfg.sta.usr_disable_eht; 1462 } 1463 wlan_mlme_set_usr_disable_sta_eht(struct wlan_objmgr_psoc * psoc,bool disable)1464 void wlan_mlme_set_usr_disable_sta_eht(struct wlan_objmgr_psoc *psoc, 1465 bool disable) 1466 { 1467 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 1468 1469 if (!mlme_obj) 1470 return; 1471 1472 mlme_debug("set usr_disable_eht from %d to %d", 1473 mlme_obj->cfg.sta.usr_disable_eht, disable); 1474 mlme_obj->cfg.sta.usr_disable_eht = disable; 1475 } 1476 wlan_mlme_get_max_bw(void)1477 enum phy_ch_width wlan_mlme_get_max_bw(void) 1478 { 1479 uint32_t max_bw = wma_get_eht_ch_width(); 1480 1481 if (max_bw == WNI_CFG_EHT_CHANNEL_WIDTH_320MHZ) 1482 return CH_WIDTH_320MHZ; 1483 else if (max_bw == WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ) 1484 return CH_WIDTH_160MHZ; 1485 else if (max_bw == WNI_CFG_VHT_CHANNEL_WIDTH_80_PLUS_80MHZ) 1486 return CH_WIDTH_80P80MHZ; 1487 else if (max_bw == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ) 1488 return CH_WIDTH_80MHZ; 1489 else 1490 return CH_WIDTH_40MHZ; 1491 } 1492 #else wlan_mlme_get_max_bw(void)1493 enum phy_ch_width wlan_mlme_get_max_bw(void) 1494 { 1495 uint32_t max_bw = wma_get_vht_ch_width(); 1496 1497 if (max_bw == WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ) 1498 return CH_WIDTH_160MHZ; 1499 else if (max_bw == WNI_CFG_VHT_CHANNEL_WIDTH_80_PLUS_80MHZ) 1500 return CH_WIDTH_80P80MHZ; 1501 else if (max_bw == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ) 1502 return CH_WIDTH_80MHZ; 1503 else 1504 return CH_WIDTH_40MHZ; 1505 } 1506 #endif 1507 wlan_mlme_get_sta_ch_width(struct wlan_objmgr_vdev * vdev,enum phy_ch_width * ch_width)1508 QDF_STATUS wlan_mlme_get_sta_ch_width(struct wlan_objmgr_vdev *vdev, 1509 enum phy_ch_width *ch_width) 1510 { 1511 QDF_STATUS status = QDF_STATUS_E_INVAL; 1512 struct wlan_objmgr_peer *peer; 1513 enum wlan_phymode phymode; 1514 enum QDF_OPMODE op_mode; 1515 1516 peer = wlan_vdev_get_bsspeer(vdev); 1517 op_mode = wlan_vdev_mlme_get_opmode(vdev); 1518 1519 if (ch_width && peer && 1520 (op_mode == QDF_STA_MODE || 1521 op_mode == QDF_P2P_CLIENT_MODE)) { 1522 wlan_peer_obj_lock(peer); 1523 phymode = wlan_peer_get_phymode(peer); 1524 wlan_peer_obj_unlock(peer); 1525 *ch_width = wlan_mlme_get_ch_width_from_phymode(phymode); 1526 status = QDF_STATUS_SUCCESS; 1527 } 1528 1529 return status; 1530 } 1531 1532 void wlan_mlme_set_bt_profile_con(struct wlan_objmgr_psoc * psoc,bool bt_profile_con)1533 wlan_mlme_set_bt_profile_con(struct wlan_objmgr_psoc *psoc, 1534 bool bt_profile_con) 1535 { 1536 struct wlan_mlme_psoc_ext_obj *mlme_obj; 1537 1538 mlme_obj = mlme_get_psoc_ext_obj(psoc); 1539 if (!mlme_obj) 1540 return; 1541 1542 mlme_obj->cfg.gen.bt_profile_con = bt_profile_con; 1543 } 1544 1545 bool wlan_mlme_get_bt_profile_con(struct wlan_objmgr_psoc * psoc)1546 wlan_mlme_get_bt_profile_con(struct wlan_objmgr_psoc *psoc) 1547 { 1548 struct wlan_mlme_psoc_ext_obj *mlme_obj; 1549 1550 mlme_obj = mlme_get_psoc_ext_obj(psoc); 1551 if (!mlme_obj) 1552 return false; 1553 1554 return mlme_obj->cfg.gen.bt_profile_con; 1555 } 1556 1557 #ifdef WLAN_FEATURE_11BE_MLO wlan_mlme_get_sta_mlo_simultaneous_links(struct wlan_objmgr_psoc * psoc)1558 uint8_t wlan_mlme_get_sta_mlo_simultaneous_links(struct wlan_objmgr_psoc *psoc) 1559 { 1560 struct wlan_mlme_psoc_ext_obj *mlme_obj; 1561 1562 mlme_obj = mlme_get_psoc_ext_obj(psoc); 1563 if (!mlme_obj) 1564 return 0; 1565 1566 return mlme_obj->cfg.sta.mlo_max_simultaneous_links; 1567 } 1568 1569 QDF_STATUS wlan_mlme_set_sta_mlo_simultaneous_links(struct wlan_objmgr_psoc * psoc,uint8_t value)1570 wlan_mlme_set_sta_mlo_simultaneous_links(struct wlan_objmgr_psoc *psoc, 1571 uint8_t value) 1572 { 1573 struct wlan_mlme_psoc_ext_obj *mlme_obj; 1574 1575 mlme_obj = mlme_get_psoc_ext_obj(psoc); 1576 if (!mlme_obj) 1577 return QDF_STATUS_E_FAILURE; 1578 1579 mlme_obj->cfg.sta.mlo_max_simultaneous_links = value; 1580 mlme_legacy_debug("mlo_max_simultaneous_links %d", value); 1581 1582 return QDF_STATUS_SUCCESS; 1583 } 1584 wlan_mlme_get_sta_mlo_conn_max_num(struct wlan_objmgr_psoc * psoc)1585 uint8_t wlan_mlme_get_sta_mlo_conn_max_num(struct wlan_objmgr_psoc *psoc) 1586 { 1587 struct wlan_mlme_psoc_ext_obj *mlme_obj; 1588 1589 mlme_obj = mlme_get_psoc_ext_obj(psoc); 1590 if (!mlme_obj) 1591 return 0; 1592 1593 return mlme_obj->cfg.sta.mlo_support_link_num; 1594 } 1595 wlan_mlme_set_sta_mlo_conn_max_num(struct wlan_objmgr_psoc * psoc,uint8_t value)1596 QDF_STATUS wlan_mlme_set_sta_mlo_conn_max_num(struct wlan_objmgr_psoc *psoc, 1597 uint8_t value) 1598 { 1599 struct wlan_mlme_psoc_ext_obj *mlme_obj; 1600 struct target_psoc_info *tgt_hdl; 1601 1602 mlme_obj = mlme_get_psoc_ext_obj(psoc); 1603 if (!mlme_obj) 1604 return QDF_STATUS_E_FAILURE; 1605 1606 tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc); 1607 if (!tgt_hdl) { 1608 mlme_err("target psoc info is NULL"); 1609 return QDF_STATUS_E_FAILURE; 1610 } 1611 1612 if (!value) 1613 mlme_obj->cfg.sta.mlo_support_link_num = 1614 target_if_res_cfg_get_num_max_mlo_link(tgt_hdl); 1615 else 1616 mlme_obj->cfg.sta.mlo_support_link_num = value; 1617 1618 mlme_legacy_debug("mlo_support_link_num user input %d intersected value :%d", 1619 value, mlme_obj->cfg.sta.mlo_support_link_num); 1620 1621 return QDF_STATUS_SUCCESS; 1622 } 1623 wlan_mlme_set_user_set_link_num(struct wlan_objmgr_psoc * psoc,uint8_t value)1624 QDF_STATUS wlan_mlme_set_user_set_link_num(struct wlan_objmgr_psoc *psoc, 1625 uint8_t value) 1626 { 1627 struct wlan_mlme_psoc_ext_obj *mlme_obj; 1628 1629 mlme_obj = mlme_get_psoc_ext_obj(psoc); 1630 if (!mlme_obj) 1631 return QDF_STATUS_E_FAILURE; 1632 1633 mlme_obj->cfg.sta.user_set_link_num = value; 1634 mlme_legacy_debug("user_set_link_num %d", value); 1635 1636 return QDF_STATUS_SUCCESS; 1637 } 1638 wlan_mlme_set_ml_link_control_mode(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,uint8_t value)1639 void wlan_mlme_set_ml_link_control_mode(struct wlan_objmgr_psoc *psoc, 1640 uint8_t vdev_id, uint8_t value) 1641 { 1642 struct wlan_mlme_psoc_ext_obj *mlme_obj; 1643 struct wlan_objmgr_vdev *vdev; 1644 1645 mlme_obj = mlme_get_psoc_ext_obj(psoc); 1646 if (!mlme_obj) 1647 return; 1648 1649 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id, 1650 WLAN_MLME_SB_ID); 1651 if (!vdev) 1652 return; 1653 1654 if (!wlan_vdev_mlme_is_mlo_vdev(vdev)) { 1655 mlme_legacy_debug("not mlo vdev"); 1656 goto release_ref; 1657 } 1658 1659 if (!vdev->mlo_dev_ctx || !vdev->mlo_dev_ctx->sta_ctx) { 1660 mlme_legacy_debug("mlo dev/sta ctx is null"); 1661 goto release_ref; 1662 } 1663 1664 vdev->mlo_dev_ctx->sta_ctx->ml_link_control_mode = value; 1665 mlme_legacy_debug("set ml_link_control_mode %d", value); 1666 1667 release_ref: 1668 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_SB_ID); 1669 return; 1670 } 1671 wlan_mlme_get_ml_link_control_mode(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id)1672 uint8_t wlan_mlme_get_ml_link_control_mode(struct wlan_objmgr_psoc *psoc, 1673 uint8_t vdev_id) 1674 { 1675 struct wlan_mlme_psoc_ext_obj *mlme_obj; 1676 struct wlan_objmgr_vdev *vdev; 1677 uint8_t value = 0; 1678 1679 mlme_obj = mlme_get_psoc_ext_obj(psoc); 1680 if (!mlme_obj) 1681 return 0; 1682 1683 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id, 1684 WLAN_MLME_SB_ID); 1685 if (!vdev) 1686 return 0; 1687 1688 if (!wlan_vdev_mlme_is_mlo_vdev(vdev)) { 1689 mlme_legacy_debug("not mlo vdev"); 1690 goto release_ref; 1691 } 1692 1693 if (!vdev->mlo_dev_ctx || !vdev->mlo_dev_ctx->sta_ctx) { 1694 mlme_legacy_debug("mlo dev/sta ctx is null"); 1695 goto release_ref; 1696 } 1697 1698 value = vdev->mlo_dev_ctx->sta_ctx->ml_link_control_mode; 1699 mlme_legacy_debug("get ml_link_control_mode %d", value); 1700 release_ref: 1701 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_SB_ID); 1702 return value; 1703 } 1704 wlan_mlme_restore_user_set_link_num(struct wlan_objmgr_psoc * psoc)1705 void wlan_mlme_restore_user_set_link_num(struct wlan_objmgr_psoc *psoc) 1706 { 1707 struct wlan_mlme_psoc_ext_obj *mlme_obj; 1708 1709 mlme_obj = mlme_get_psoc_ext_obj(psoc); 1710 if (!mlme_obj) 1711 return; 1712 1713 if (!mlme_obj->cfg.sta.user_set_link_num) 1714 return; 1715 1716 mlme_obj->cfg.sta.mlo_support_link_num = 1717 mlme_obj->cfg.sta.user_set_link_num; 1718 mlme_legacy_debug("restore mlo_support_link_num %d", 1719 mlme_obj->cfg.sta.user_set_link_num); 1720 } 1721 wlan_mlme_clear_user_set_link_num(struct wlan_objmgr_psoc * psoc)1722 void wlan_mlme_clear_user_set_link_num(struct wlan_objmgr_psoc *psoc) 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 return; 1729 1730 mlme_obj->cfg.sta.user_set_link_num = 0; 1731 } 1732 wlan_mlme_get_sta_mlo_conn_band_bmp(struct wlan_objmgr_psoc * psoc)1733 uint8_t wlan_mlme_get_sta_mlo_conn_band_bmp(struct wlan_objmgr_psoc *psoc) 1734 { 1735 struct wlan_mlme_psoc_ext_obj *mlme_obj; 1736 1737 mlme_obj = mlme_get_psoc_ext_obj(psoc); 1738 if (!mlme_obj) 1739 return 0; 1740 1741 return mlme_obj->cfg.sta.mlo_support_link_band; 1742 } 1743 wlan_mlme_set_sta_mlo_conn_band_bmp(struct wlan_objmgr_psoc * psoc,uint8_t value)1744 QDF_STATUS wlan_mlme_set_sta_mlo_conn_band_bmp(struct wlan_objmgr_psoc *psoc, 1745 uint8_t value) 1746 { 1747 struct wlan_mlme_psoc_ext_obj *mlme_obj; 1748 1749 mlme_obj = mlme_get_psoc_ext_obj(psoc); 1750 if (!mlme_obj) 1751 return QDF_STATUS_E_FAILURE; 1752 1753 mlme_obj->cfg.sta.mlo_support_link_band = value; 1754 mlme_legacy_debug("mlo_support_link_conn band %d", value); 1755 1756 return QDF_STATUS_SUCCESS; 1757 } 1758 wlan_mlme_is_5gl_5gh_mlsr_supported(struct wlan_objmgr_psoc * psoc)1759 bool wlan_mlme_is_5gl_5gh_mlsr_supported(struct wlan_objmgr_psoc *psoc) 1760 { 1761 struct wlan_mlme_psoc_ext_obj *mlme_obj; 1762 1763 mlme_obj = mlme_get_psoc_ext_obj(psoc); 1764 if (!mlme_obj) 1765 return 0; 1766 return mlme_obj->cfg.sta.mlo_5gl_5gh_mlsr; 1767 } 1768 1769 void wlan_mlme_get_mlo_prefer_percentage(struct wlan_objmgr_psoc * psoc,int8_t * mlo_prefer_percentage)1770 wlan_mlme_get_mlo_prefer_percentage(struct wlan_objmgr_psoc *psoc, 1771 int8_t *mlo_prefer_percentage) 1772 { 1773 struct wlan_mlme_psoc_ext_obj *mlme_obj; 1774 1775 mlme_obj = mlme_get_psoc_ext_obj(psoc); 1776 if (!mlme_obj) { 1777 mlme_legacy_err("invalid mlo object"); 1778 return; 1779 } 1780 1781 *mlo_prefer_percentage = mlme_obj->cfg.sta.mlo_prefer_percentage; 1782 mlme_legacy_debug("mlo_prefer_percentage %d", *mlo_prefer_percentage); 1783 } 1784 wlan_mlme_get_sta_same_link_mld_addr(struct wlan_objmgr_psoc * psoc)1785 bool wlan_mlme_get_sta_same_link_mld_addr(struct wlan_objmgr_psoc *psoc) 1786 { 1787 struct wlan_mlme_psoc_ext_obj *mlme_obj; 1788 1789 mlme_obj = mlme_get_psoc_ext_obj(psoc); 1790 if (!mlme_obj) 1791 return false; 1792 1793 return mlme_obj->cfg.sta.mlo_same_link_mld_address; 1794 } 1795 #endif 1796 wlan_mlme_get_num_11b_tx_chains(struct wlan_objmgr_psoc * psoc,uint16_t * value)1797 QDF_STATUS wlan_mlme_get_num_11b_tx_chains(struct wlan_objmgr_psoc *psoc, 1798 uint16_t *value) 1799 { 1800 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 1801 1802 if (!mlme_obj) 1803 return QDF_STATUS_E_FAILURE; 1804 1805 *value = mlme_obj->cfg.chainmask_cfg.num_11b_tx_chains; 1806 return QDF_STATUS_SUCCESS; 1807 } 1808 wlan_mlme_get_bt_chain_separation_flag(struct wlan_objmgr_psoc * psoc,bool * value)1809 QDF_STATUS wlan_mlme_get_bt_chain_separation_flag(struct wlan_objmgr_psoc *psoc, 1810 bool *value) 1811 { 1812 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 1813 1814 if (!mlme_obj) 1815 return QDF_STATUS_E_FAILURE; 1816 1817 *value = mlme_obj->cfg.chainmask_cfg.enable_bt_chain_separation; 1818 return QDF_STATUS_SUCCESS; 1819 } 1820 wlan_mlme_get_num_11ag_tx_chains(struct wlan_objmgr_psoc * psoc,uint16_t * value)1821 QDF_STATUS wlan_mlme_get_num_11ag_tx_chains(struct wlan_objmgr_psoc *psoc, 1822 uint16_t *value) 1823 { 1824 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 1825 1826 if (!mlme_obj) 1827 return QDF_STATUS_E_FAILURE; 1828 1829 *value = mlme_obj->cfg.chainmask_cfg.num_11ag_tx_chains; 1830 return QDF_STATUS_SUCCESS; 1831 } 1832 1833 1834 static wlan_mlme_configure_chain_mask_supported(struct wlan_objmgr_psoc * psoc)1835 bool wlan_mlme_configure_chain_mask_supported(struct wlan_objmgr_psoc *psoc) 1836 { 1837 struct wma_caps_per_phy non_dbs_phy_cap = {0}; 1838 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 1839 QDF_STATUS status; 1840 bool as_enabled, enable_bt_chain_sep, enable2x2; 1841 uint8_t dual_mac_feature; 1842 bool hw_dbs_2x2_cap; 1843 1844 if (!mlme_obj) 1845 return false; 1846 1847 status = wma_get_caps_for_phyidx_hwmode(&non_dbs_phy_cap, 1848 HW_MODE_DBS_NONE, 1849 CDS_BAND_ALL); 1850 if (QDF_IS_STATUS_ERROR(status)) { 1851 mlme_legacy_err("couldn't get phy caps. skip chain mask programming"); 1852 return false; 1853 } 1854 1855 if (non_dbs_phy_cap.tx_chain_mask_2G < 3 || 1856 non_dbs_phy_cap.rx_chain_mask_2G < 3 || 1857 non_dbs_phy_cap.tx_chain_mask_5G < 3 || 1858 non_dbs_phy_cap.rx_chain_mask_5G < 3) { 1859 mlme_legacy_debug("firmware not capable. skip chain mask programming"); 1860 return false; 1861 } 1862 1863 enable_bt_chain_sep = 1864 mlme_obj->cfg.chainmask_cfg.enable_bt_chain_separation; 1865 as_enabled = mlme_obj->cfg.gen.as_enabled; 1866 ucfg_policy_mgr_get_dual_mac_feature(psoc, &dual_mac_feature); 1867 1868 hw_dbs_2x2_cap = policy_mgr_is_hw_dbs_2x2_capable(psoc); 1869 enable2x2 = mlme_obj->cfg.vht_caps.vht_cap_info.enable2x2; 1870 1871 if ((enable2x2 && !enable_bt_chain_sep) || as_enabled || 1872 (!hw_dbs_2x2_cap && (dual_mac_feature != DISABLE_DBS_CXN_AND_SCAN) && 1873 enable2x2)) { 1874 mlme_legacy_debug("Cannot configure chainmask enable_bt_chain_sep %d as_enabled %d enable2x2 %d hw_dbs_2x2_cap %d dual_mac_feature %d", 1875 enable_bt_chain_sep, as_enabled, enable2x2, 1876 hw_dbs_2x2_cap, dual_mac_feature); 1877 return false; 1878 } 1879 1880 return true; 1881 } 1882 wlan_mlme_is_chain_mask_supported(struct wlan_objmgr_psoc * psoc)1883 bool wlan_mlme_is_chain_mask_supported(struct wlan_objmgr_psoc *psoc) 1884 1885 { 1886 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 1887 1888 if (!mlme_obj) 1889 return false; 1890 1891 if (!wlan_mlme_configure_chain_mask_supported(psoc)) 1892 return false; 1893 1894 /* If user has configured 1x1 from INI */ 1895 if (mlme_obj->cfg.chainmask_cfg.txchainmask1x1 != 3 || 1896 mlme_obj->cfg.chainmask_cfg.rxchainmask1x1 != 3) { 1897 mlme_legacy_debug("txchainmask1x1 %d rxchainmask1x1 %d", 1898 mlme_obj->cfg.chainmask_cfg.txchainmask1x1, 1899 mlme_obj->cfg.chainmask_cfg.rxchainmask1x1); 1900 return false; 1901 } 1902 1903 return true; 1904 1905 } 1906 1907 #define MAX_PDEV_CHAIN_MASK_PARAMS 6 1908 /* params being sent: 1909 * wmi_pdev_param_tx_chain_mask 1910 * wmi_pdev_param_rx_chain_mask 1911 * wmi_pdev_param_tx_chain_mask_2g 1912 * wmi_pdev_param_rx_chain_mask_2g 1913 * wmi_pdev_param_tx_chain_mask_5g 1914 * wmi_pdev_param_rx_chain_mask_5g 1915 */ wlan_mlme_configure_chain_mask(struct wlan_objmgr_psoc * psoc,uint8_t session_id)1916 QDF_STATUS wlan_mlme_configure_chain_mask(struct wlan_objmgr_psoc *psoc, 1917 uint8_t session_id) 1918 { 1919 QDF_STATUS ret_val = QDF_STATUS_E_FAILURE; 1920 uint8_t ch_msk_val; 1921 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 1922 bool mrc_disabled_2g_rx, mrc_disabled_2g_tx; 1923 bool mrc_disabled_5g_rx, mrc_disabled_5g_tx; 1924 struct dev_set_param setparam[MAX_PDEV_CHAIN_MASK_PARAMS]; 1925 uint8_t index = 0; 1926 1927 if (!mlme_obj) 1928 return QDF_STATUS_E_FAILURE; 1929 1930 mlme_legacy_debug("txchainmask1x1: %d rxchainmask1x1: %d", 1931 mlme_obj->cfg.chainmask_cfg.txchainmask1x1, 1932 mlme_obj->cfg.chainmask_cfg.rxchainmask1x1); 1933 mlme_legacy_debug("tx_chain_mask_2g: %d, rx_chain_mask_2g: %d", 1934 mlme_obj->cfg.chainmask_cfg.tx_chain_mask_2g, 1935 mlme_obj->cfg.chainmask_cfg.rx_chain_mask_2g); 1936 mlme_legacy_debug("tx_chain_mask_5g: %d, rx_chain_mask_5g: %d", 1937 mlme_obj->cfg.chainmask_cfg.tx_chain_mask_5g, 1938 mlme_obj->cfg.chainmask_cfg.rx_chain_mask_5g); 1939 1940 mrc_disabled_2g_rx = 1941 mlme_obj->cfg.nss_chains_ini_cfg.disable_rx_mrc[NSS_CHAINS_BAND_2GHZ]; 1942 mrc_disabled_2g_tx = 1943 mlme_obj->cfg.nss_chains_ini_cfg.disable_tx_mrc[NSS_CHAINS_BAND_2GHZ]; 1944 mrc_disabled_5g_rx = 1945 mlme_obj->cfg.nss_chains_ini_cfg.disable_rx_mrc[NSS_CHAINS_BAND_5GHZ]; 1946 mrc_disabled_5g_tx = 1947 mlme_obj->cfg.nss_chains_ini_cfg.disable_tx_mrc[NSS_CHAINS_BAND_5GHZ]; 1948 1949 mlme_legacy_debug("MRC values TX:- 2g %d 5g %d RX:- 2g %d 5g %d", 1950 mrc_disabled_2g_tx, mrc_disabled_5g_tx, 1951 mrc_disabled_2g_rx, mrc_disabled_5g_rx); 1952 1953 if (!wlan_mlme_configure_chain_mask_supported(psoc)) 1954 return QDF_STATUS_E_FAILURE; 1955 1956 if (mlme_obj->cfg.chainmask_cfg.txchainmask1x1) { 1957 ch_msk_val = mlme_obj->cfg.chainmask_cfg.txchainmask1x1; 1958 if (wma_validate_txrx_chain_mask(wmi_pdev_param_tx_chain_mask, 1959 ch_msk_val)) { 1960 goto error; 1961 } 1962 ret_val = mlme_check_index_setparam( 1963 setparam, 1964 wmi_pdev_param_tx_chain_mask, 1965 ch_msk_val, index++, 1966 MAX_PDEV_CHAIN_MASK_PARAMS); 1967 if (QDF_IS_STATUS_ERROR(ret_val)) { 1968 mlme_err("failed at wmi_pdev_param_tx_chain_mask"); 1969 goto error; 1970 } 1971 } 1972 1973 if (mlme_obj->cfg.chainmask_cfg.rxchainmask1x1) { 1974 ch_msk_val = mlme_obj->cfg.chainmask_cfg.rxchainmask1x1; 1975 if (wma_validate_txrx_chain_mask(wmi_pdev_param_rx_chain_mask, 1976 ch_msk_val)) { 1977 goto error; 1978 } 1979 ret_val = mlme_check_index_setparam( 1980 setparam, 1981 wmi_pdev_param_rx_chain_mask, 1982 ch_msk_val, index++, 1983 MAX_PDEV_CHAIN_MASK_PARAMS); 1984 if (QDF_IS_STATUS_ERROR(ret_val)) { 1985 mlme_err("failed at wmi_pdev_param_rx_chain_mask"); 1986 goto error; 1987 } 1988 } 1989 1990 if (mlme_obj->cfg.chainmask_cfg.txchainmask1x1 || 1991 mlme_obj->cfg.chainmask_cfg.rxchainmask1x1) { 1992 mlme_legacy_debug("band agnostic tx/rx chain mask set. skip per band chain mask"); 1993 goto sendparam; 1994 } 1995 1996 if (mlme_obj->cfg.chainmask_cfg.tx_chain_mask_2g && 1997 mrc_disabled_2g_tx) { 1998 ch_msk_val = mlme_obj->cfg.chainmask_cfg.tx_chain_mask_2g; 1999 ret_val = mlme_check_index_setparam( 2000 setparam, 2001 wmi_pdev_param_tx_chain_mask_2g, 2002 ch_msk_val, index++, 2003 MAX_PDEV_CHAIN_MASK_PARAMS); 2004 if (QDF_IS_STATUS_ERROR(ret_val)) { 2005 mlme_err("failed at wmi_pdev_param_tx_chain_mask_2g"); 2006 goto error; 2007 } 2008 } 2009 2010 if (mlme_obj->cfg.chainmask_cfg.rx_chain_mask_2g && 2011 mrc_disabled_2g_rx) { 2012 ch_msk_val = mlme_obj->cfg.chainmask_cfg.rx_chain_mask_2g; 2013 ret_val = mlme_check_index_setparam( 2014 setparam, 2015 wmi_pdev_param_rx_chain_mask_2g, 2016 ch_msk_val, index++, 2017 MAX_PDEV_CHAIN_MASK_PARAMS); 2018 if (QDF_IS_STATUS_ERROR(ret_val)) { 2019 mlme_err("failed at wmi_pdev_param_rx_chain_mask_2g"); 2020 goto error; 2021 } 2022 } 2023 2024 if (mlme_obj->cfg.chainmask_cfg.tx_chain_mask_5g && 2025 mrc_disabled_5g_tx) { 2026 ch_msk_val = mlme_obj->cfg.chainmask_cfg.tx_chain_mask_5g; 2027 ret_val = mlme_check_index_setparam( 2028 setparam, 2029 wmi_pdev_param_tx_chain_mask_5g, 2030 ch_msk_val, index++, 2031 MAX_PDEV_CHAIN_MASK_PARAMS); 2032 if (QDF_IS_STATUS_ERROR(ret_val)) { 2033 mlme_err("failed at wmi_pdev_param_tx_chain_mask_5g"); 2034 goto error; 2035 } 2036 } 2037 2038 if (mlme_obj->cfg.chainmask_cfg.rx_chain_mask_5g && 2039 mrc_disabled_5g_rx) { 2040 ch_msk_val = mlme_obj->cfg.chainmask_cfg.rx_chain_mask_5g; 2041 ret_val = mlme_check_index_setparam( 2042 setparam, 2043 wmi_pdev_param_rx_chain_mask_5g, 2044 ch_msk_val, index++, 2045 MAX_PDEV_CHAIN_MASK_PARAMS); 2046 if (QDF_IS_STATUS_ERROR(ret_val)) { 2047 mlme_err("failed at wmi_pdev_param_rx_chain_mask_5g"); 2048 goto error; 2049 } 2050 } 2051 sendparam: 2052 ret_val = wma_send_multi_pdev_vdev_set_params(MLME_PDEV_SETPARAM, 2053 WMI_PDEV_ID_SOC, setparam, 2054 index); 2055 if (QDF_IS_STATUS_ERROR(ret_val)) 2056 mlme_err("failed to send chainmask params"); 2057 error: 2058 return ret_val; 2059 } 2060 2061 QDF_STATUS wlan_mlme_get_manufacturer_name(struct wlan_objmgr_psoc * psoc,uint8_t * pbuf,uint32_t * plen)2062 wlan_mlme_get_manufacturer_name(struct wlan_objmgr_psoc *psoc, 2063 uint8_t *pbuf, uint32_t *plen) 2064 { 2065 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2066 2067 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2068 if (!mlme_obj) 2069 return QDF_STATUS_E_FAILURE; 2070 2071 *plen = qdf_str_lcopy(pbuf, 2072 mlme_obj->cfg.product_details.manufacturer_name, 2073 *plen); 2074 return QDF_STATUS_SUCCESS; 2075 } 2076 2077 QDF_STATUS wlan_mlme_get_model_number(struct wlan_objmgr_psoc * psoc,uint8_t * pbuf,uint32_t * plen)2078 wlan_mlme_get_model_number(struct wlan_objmgr_psoc *psoc, 2079 uint8_t *pbuf, uint32_t *plen) 2080 { 2081 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2082 2083 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2084 if (!mlme_obj) 2085 return QDF_STATUS_E_FAILURE; 2086 2087 *plen = qdf_str_lcopy(pbuf, 2088 mlme_obj->cfg.product_details.model_number, 2089 *plen); 2090 2091 return QDF_STATUS_SUCCESS; 2092 } 2093 2094 QDF_STATUS wlan_mlme_get_model_name(struct wlan_objmgr_psoc * psoc,uint8_t * pbuf,uint32_t * plen)2095 wlan_mlme_get_model_name(struct wlan_objmgr_psoc *psoc, 2096 uint8_t *pbuf, uint32_t *plen) 2097 { 2098 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2099 2100 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2101 if (!mlme_obj) 2102 return QDF_STATUS_E_FAILURE; 2103 2104 *plen = qdf_str_lcopy(pbuf, 2105 mlme_obj->cfg.product_details.model_name, 2106 *plen); 2107 return QDF_STATUS_SUCCESS; 2108 } 2109 2110 QDF_STATUS wlan_mlme_get_manufacture_product_version(struct wlan_objmgr_psoc * psoc,uint8_t * pbuf,uint32_t * plen)2111 wlan_mlme_get_manufacture_product_version(struct wlan_objmgr_psoc *psoc, 2112 uint8_t *pbuf, uint32_t *plen) 2113 { 2114 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2115 2116 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2117 if (!mlme_obj) 2118 return QDF_STATUS_E_FAILURE; 2119 2120 *plen = qdf_str_lcopy(pbuf, 2121 mlme_obj->cfg.product_details.manufacture_product_version, 2122 *plen); 2123 return QDF_STATUS_SUCCESS; 2124 } 2125 2126 QDF_STATUS wlan_mlme_get_manufacture_product_name(struct wlan_objmgr_psoc * psoc,uint8_t * pbuf,uint32_t * plen)2127 wlan_mlme_get_manufacture_product_name(struct wlan_objmgr_psoc *psoc, 2128 uint8_t *pbuf, uint32_t *plen) 2129 { 2130 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2131 2132 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2133 if (!mlme_obj) 2134 return QDF_STATUS_E_FAILURE; 2135 2136 *plen = qdf_str_lcopy(pbuf, 2137 mlme_obj->cfg.product_details.manufacture_product_name, 2138 *plen); 2139 return QDF_STATUS_SUCCESS; 2140 } 2141 2142 wlan_mlme_get_tl_delayed_trgr_frm_int(struct wlan_objmgr_psoc * psoc,uint32_t * value)2143 void wlan_mlme_get_tl_delayed_trgr_frm_int(struct wlan_objmgr_psoc *psoc, 2144 uint32_t *value) 2145 { 2146 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2147 2148 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2149 if (!mlme_obj) { 2150 *value = cfg_default(CFG_TL_DELAYED_TRGR_FRM_INTERVAL); 2151 return; 2152 } 2153 2154 *value = mlme_obj->cfg.wmm_params.delayed_trigger_frm_int; 2155 } 2156 2157 wlan_mlme_get_wmm_dir_ac_vo(struct wlan_objmgr_psoc * psoc,uint8_t * value)2158 QDF_STATUS wlan_mlme_get_wmm_dir_ac_vo(struct wlan_objmgr_psoc *psoc, 2159 uint8_t *value) 2160 { 2161 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2162 2163 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2164 if (!mlme_obj) 2165 return QDF_STATUS_E_FAILURE; 2166 2167 *value = mlme_obj->cfg.wmm_params.ac_vo.dir_ac_vo; 2168 2169 return QDF_STATUS_SUCCESS; 2170 } 2171 2172 wlan_mlme_get_wmm_nom_msdu_size_ac_vo(struct wlan_objmgr_psoc * psoc,uint16_t * value)2173 QDF_STATUS wlan_mlme_get_wmm_nom_msdu_size_ac_vo(struct wlan_objmgr_psoc *psoc, 2174 uint16_t *value) 2175 { 2176 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2177 2178 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2179 if (!mlme_obj) 2180 return QDF_STATUS_E_FAILURE; 2181 2182 *value = mlme_obj->cfg.wmm_params.ac_vo.nom_msdu_size_ac_vo; 2183 return QDF_STATUS_SUCCESS; 2184 } 2185 2186 QDF_STATUS wlan_mlme_get_wmm_mean_data_rate_ac_vo(struct wlan_objmgr_psoc * psoc,uint32_t * value)2187 wlan_mlme_get_wmm_mean_data_rate_ac_vo(struct wlan_objmgr_psoc *psoc, 2188 uint32_t *value) 2189 { 2190 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2191 2192 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2193 if (!mlme_obj) 2194 return QDF_STATUS_E_FAILURE; 2195 2196 *value = mlme_obj->cfg.wmm_params.ac_vo.mean_data_rate_ac_vo; 2197 2198 return QDF_STATUS_SUCCESS; 2199 } 2200 wlan_mlme_get_wmm_min_phy_rate_ac_vo(struct wlan_objmgr_psoc * psoc,uint32_t * value)2201 QDF_STATUS wlan_mlme_get_wmm_min_phy_rate_ac_vo(struct wlan_objmgr_psoc *psoc, 2202 uint32_t *value) 2203 { 2204 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2205 2206 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2207 if (!mlme_obj) 2208 return QDF_STATUS_E_FAILURE; 2209 2210 *value = mlme_obj->cfg.wmm_params.ac_vo.min_phy_rate_ac_vo; 2211 return QDF_STATUS_SUCCESS; 2212 } 2213 2214 QDF_STATUS wlan_mlme_get_wmm_sba_ac_vo(struct wlan_objmgr_psoc * psoc,uint16_t * value)2215 wlan_mlme_get_wmm_sba_ac_vo(struct wlan_objmgr_psoc *psoc, uint16_t *value) 2216 { 2217 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2218 2219 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2220 if (!mlme_obj) { 2221 return QDF_STATUS_E_FAILURE; 2222 } 2223 2224 *value = mlme_obj->cfg.wmm_params.ac_vo.sba_ac_vo; 2225 2226 return QDF_STATUS_SUCCESS; 2227 } 2228 wlan_mlme_get_wmm_uapsd_vo_srv_intv(struct wlan_objmgr_psoc * psoc,uint32_t * value)2229 QDF_STATUS wlan_mlme_get_wmm_uapsd_vo_srv_intv(struct wlan_objmgr_psoc *psoc, 2230 uint32_t *value) 2231 { 2232 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2233 2234 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2235 if (!mlme_obj) 2236 return QDF_STATUS_E_FAILURE; 2237 2238 *value = mlme_obj->cfg.wmm_params.ac_vo.uapsd_vo_srv_intv; 2239 2240 return QDF_STATUS_SUCCESS; 2241 } 2242 wlan_mlme_get_wmm_uapsd_vo_sus_intv(struct wlan_objmgr_psoc * psoc,uint32_t * value)2243 QDF_STATUS wlan_mlme_get_wmm_uapsd_vo_sus_intv(struct wlan_objmgr_psoc *psoc, 2244 uint32_t *value) 2245 { 2246 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2247 2248 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2249 if (!mlme_obj) 2250 return QDF_STATUS_E_FAILURE; 2251 2252 *value = mlme_obj->cfg.wmm_params.ac_vo.uapsd_vo_sus_intv; 2253 2254 return QDF_STATUS_SUCCESS; 2255 } 2256 wlan_mlme_cfg_get_vht_ampdu_len_exp(struct wlan_objmgr_psoc * psoc,uint8_t * value)2257 QDF_STATUS wlan_mlme_cfg_get_vht_ampdu_len_exp(struct wlan_objmgr_psoc *psoc, 2258 uint8_t *value) 2259 { 2260 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2261 2262 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2263 if (!mlme_obj) 2264 return QDF_STATUS_E_FAILURE; 2265 2266 *value = mlme_obj->cfg.vht_caps.vht_cap_info.ampdu_len_exponent; 2267 2268 return QDF_STATUS_SUCCESS; 2269 } 2270 wlan_mlme_cfg_get_vht_max_mpdu_len(struct wlan_objmgr_psoc * psoc,uint8_t * value)2271 QDF_STATUS wlan_mlme_cfg_get_vht_max_mpdu_len(struct wlan_objmgr_psoc *psoc, 2272 uint8_t *value) 2273 { 2274 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2275 2276 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2277 if (!mlme_obj) 2278 return QDF_STATUS_E_FAILURE; 2279 2280 *value = mlme_obj->cfg.vht_caps.vht_cap_info.ampdu_len; 2281 2282 return QDF_STATUS_SUCCESS; 2283 } 2284 wlan_mlme_cfg_get_ht_smps(struct wlan_objmgr_psoc * psoc,uint8_t * value)2285 QDF_STATUS wlan_mlme_cfg_get_ht_smps(struct wlan_objmgr_psoc *psoc, 2286 uint8_t *value) 2287 { 2288 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2289 2290 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2291 if (!mlme_obj) 2292 return QDF_STATUS_E_FAILURE; 2293 2294 *value = mlme_obj->cfg.ht_caps.smps; 2295 2296 return QDF_STATUS_SUCCESS; 2297 } 2298 2299 QDF_STATUS wlan_mlme_get_wmm_dir_ac_vi(struct wlan_objmgr_psoc * psoc,uint8_t * value)2300 wlan_mlme_get_wmm_dir_ac_vi(struct wlan_objmgr_psoc *psoc, uint8_t *value) 2301 { 2302 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2303 2304 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2305 if (!mlme_obj) 2306 return QDF_STATUS_E_FAILURE; 2307 2308 *value = mlme_obj->cfg.wmm_params.ac_vi.dir_ac_vi; 2309 2310 return QDF_STATUS_SUCCESS; 2311 } 2312 wlan_mlme_get_wmm_nom_msdu_size_ac_vi(struct wlan_objmgr_psoc * psoc,uint16_t * value)2313 QDF_STATUS wlan_mlme_get_wmm_nom_msdu_size_ac_vi(struct wlan_objmgr_psoc *psoc, 2314 uint16_t *value) 2315 { 2316 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2317 2318 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2319 if (!mlme_obj) 2320 return QDF_STATUS_E_FAILURE; 2321 2322 *value = 2323 mlme_obj->cfg.wmm_params.ac_vi.nom_msdu_size_ac_vi; 2324 2325 return QDF_STATUS_SUCCESS; 2326 } 2327 2328 QDF_STATUS wlan_mlme_get_wmm_mean_data_rate_ac_vi(struct wlan_objmgr_psoc * psoc,uint32_t * value)2329 wlan_mlme_get_wmm_mean_data_rate_ac_vi(struct wlan_objmgr_psoc *psoc, 2330 uint32_t *value) 2331 { 2332 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2333 2334 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2335 if (!mlme_obj) 2336 return QDF_STATUS_E_FAILURE; 2337 2338 *value = mlme_obj->cfg.wmm_params.ac_vi.mean_data_rate_ac_vi; 2339 2340 return QDF_STATUS_SUCCESS; 2341 } 2342 wlan_mlme_get_wmm_min_phy_rate_ac_vi(struct wlan_objmgr_psoc * psoc,uint32_t * value)2343 QDF_STATUS wlan_mlme_get_wmm_min_phy_rate_ac_vi(struct wlan_objmgr_psoc *psoc, 2344 uint32_t *value) 2345 { 2346 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2347 2348 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2349 if (!mlme_obj) 2350 return QDF_STATUS_E_FAILURE; 2351 2352 *value = mlme_obj->cfg.wmm_params.ac_vi.min_phy_rate_ac_vi; 2353 2354 return QDF_STATUS_SUCCESS; 2355 } 2356 wlan_mlme_get_wmm_sba_ac_vi(struct wlan_objmgr_psoc * psoc,uint16_t * value)2357 QDF_STATUS wlan_mlme_get_wmm_sba_ac_vi(struct wlan_objmgr_psoc *psoc, 2358 uint16_t *value) 2359 { 2360 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2361 2362 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2363 if (!mlme_obj) 2364 return QDF_STATUS_E_FAILURE; 2365 2366 *value = mlme_obj->cfg.wmm_params.ac_vi.sba_ac_vi; 2367 2368 return QDF_STATUS_SUCCESS; 2369 } 2370 2371 QDF_STATUS wlan_mlme_get_wmm_uapsd_vi_srv_intv(struct wlan_objmgr_psoc * psoc,uint32_t * value)2372 wlan_mlme_get_wmm_uapsd_vi_srv_intv(struct wlan_objmgr_psoc *psoc, 2373 uint32_t *value) 2374 { 2375 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2376 2377 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2378 if (!mlme_obj) 2379 return QDF_STATUS_E_FAILURE; 2380 2381 *value = mlme_obj->cfg.wmm_params.ac_vi.uapsd_vi_srv_intv; 2382 2383 return QDF_STATUS_SUCCESS; 2384 } 2385 wlan_mlme_get_wmm_uapsd_vi_sus_intv(struct wlan_objmgr_psoc * psoc,uint32_t * value)2386 QDF_STATUS wlan_mlme_get_wmm_uapsd_vi_sus_intv(struct wlan_objmgr_psoc *psoc, 2387 uint32_t *value) 2388 { 2389 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2390 2391 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2392 if (!mlme_obj) 2393 return QDF_STATUS_E_FAILURE; 2394 2395 *value = mlme_obj->cfg.wmm_params.ac_vi.uapsd_vi_sus_intv; 2396 2397 return QDF_STATUS_SUCCESS; 2398 } 2399 2400 QDF_STATUS wlan_mlme_get_wmm_dir_ac_be(struct wlan_objmgr_psoc * psoc,uint8_t * value)2401 wlan_mlme_get_wmm_dir_ac_be(struct wlan_objmgr_psoc *psoc, uint8_t *value) 2402 { 2403 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2404 2405 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2406 if (!mlme_obj) 2407 return QDF_STATUS_E_FAILURE; 2408 2409 *value = mlme_obj->cfg.wmm_params.ac_be.dir_ac_be; 2410 2411 return QDF_STATUS_SUCCESS; 2412 } 2413 wlan_mlme_get_wmm_nom_msdu_size_ac_be(struct wlan_objmgr_psoc * psoc,uint16_t * value)2414 QDF_STATUS wlan_mlme_get_wmm_nom_msdu_size_ac_be(struct wlan_objmgr_psoc *psoc, 2415 uint16_t *value) 2416 { 2417 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2418 2419 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2420 if (!mlme_obj) 2421 return QDF_STATUS_E_FAILURE; 2422 2423 *value = mlme_obj->cfg.wmm_params.ac_be.nom_msdu_size_ac_be; 2424 2425 return QDF_STATUS_SUCCESS; 2426 } 2427 2428 QDF_STATUS wlan_mlme_get_wmm_mean_data_rate_ac_be(struct wlan_objmgr_psoc * psoc,uint32_t * value)2429 wlan_mlme_get_wmm_mean_data_rate_ac_be(struct wlan_objmgr_psoc *psoc, 2430 uint32_t *value) 2431 { 2432 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2433 2434 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2435 if (!mlme_obj) 2436 return QDF_STATUS_E_FAILURE; 2437 2438 *value = mlme_obj->cfg.wmm_params.ac_be.mean_data_rate_ac_be; 2439 2440 return QDF_STATUS_SUCCESS; 2441 } 2442 wlan_mlme_get_wmm_min_phy_rate_ac_be(struct wlan_objmgr_psoc * psoc,uint32_t * value)2443 QDF_STATUS wlan_mlme_get_wmm_min_phy_rate_ac_be(struct wlan_objmgr_psoc *psoc, 2444 uint32_t *value) 2445 { 2446 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2447 2448 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2449 if (!mlme_obj) 2450 return QDF_STATUS_E_FAILURE; 2451 2452 *value = mlme_obj->cfg.wmm_params.ac_be.min_phy_rate_ac_be; 2453 2454 return QDF_STATUS_SUCCESS; 2455 } 2456 2457 QDF_STATUS wlan_mlme_get_wmm_sba_ac_be(struct wlan_objmgr_psoc * psoc,uint16_t * value)2458 wlan_mlme_get_wmm_sba_ac_be(struct wlan_objmgr_psoc *psoc, uint16_t *value) 2459 { 2460 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2461 2462 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2463 if (!mlme_obj) 2464 return QDF_STATUS_E_FAILURE; 2465 2466 *value = mlme_obj->cfg.wmm_params.ac_be.sba_ac_be; 2467 2468 return QDF_STATUS_SUCCESS; 2469 } 2470 wlan_mlme_get_wmm_uapsd_be_srv_intv(struct wlan_objmgr_psoc * psoc,uint32_t * value)2471 QDF_STATUS wlan_mlme_get_wmm_uapsd_be_srv_intv(struct wlan_objmgr_psoc *psoc, 2472 uint32_t *value) 2473 { 2474 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2475 2476 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2477 if (!mlme_obj) 2478 return QDF_STATUS_E_FAILURE; 2479 2480 *value = mlme_obj->cfg.wmm_params.ac_be.uapsd_be_srv_intv; 2481 2482 return QDF_STATUS_SUCCESS; 2483 } 2484 wlan_mlme_get_wmm_uapsd_be_sus_intv(struct wlan_objmgr_psoc * psoc,uint32_t * value)2485 QDF_STATUS wlan_mlme_get_wmm_uapsd_be_sus_intv(struct wlan_objmgr_psoc *psoc, 2486 uint32_t *value) 2487 { 2488 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2489 2490 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2491 if (!mlme_obj) 2492 return QDF_STATUS_E_FAILURE; 2493 2494 *value = mlme_obj->cfg.wmm_params.ac_be.uapsd_be_sus_intv; 2495 2496 return QDF_STATUS_SUCCESS; 2497 } 2498 2499 QDF_STATUS wlan_mlme_get_wmm_dir_ac_bk(struct wlan_objmgr_psoc * psoc,uint8_t * value)2500 wlan_mlme_get_wmm_dir_ac_bk(struct wlan_objmgr_psoc *psoc, uint8_t *value) 2501 { 2502 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2503 2504 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2505 if (!mlme_obj) 2506 return QDF_STATUS_E_FAILURE; 2507 2508 *value = mlme_obj->cfg.wmm_params.ac_bk.dir_ac_bk; 2509 2510 return QDF_STATUS_SUCCESS; 2511 } 2512 wlan_mlme_get_wmm_nom_msdu_size_ac_bk(struct wlan_objmgr_psoc * psoc,uint16_t * value)2513 QDF_STATUS wlan_mlme_get_wmm_nom_msdu_size_ac_bk(struct wlan_objmgr_psoc *psoc, 2514 uint16_t *value) 2515 { 2516 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2517 2518 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2519 if (!mlme_obj) 2520 return QDF_STATUS_E_FAILURE; 2521 2522 *value = mlme_obj->cfg.wmm_params.ac_bk.nom_msdu_size_ac_bk; 2523 2524 return QDF_STATUS_SUCCESS; 2525 } 2526 2527 QDF_STATUS wlan_mlme_get_wmm_mean_data_rate_ac_bk(struct wlan_objmgr_psoc * psoc,uint32_t * value)2528 wlan_mlme_get_wmm_mean_data_rate_ac_bk(struct wlan_objmgr_psoc *psoc, 2529 uint32_t *value) 2530 { 2531 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2532 2533 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2534 if (!mlme_obj) 2535 return QDF_STATUS_E_FAILURE; 2536 2537 *value = mlme_obj->cfg.wmm_params.ac_bk.mean_data_rate_ac_bk; 2538 2539 return QDF_STATUS_SUCCESS; 2540 } 2541 wlan_mlme_get_wmm_min_phy_rate_ac_bk(struct wlan_objmgr_psoc * psoc,uint32_t * value)2542 QDF_STATUS wlan_mlme_get_wmm_min_phy_rate_ac_bk(struct wlan_objmgr_psoc *psoc, 2543 uint32_t *value) 2544 { 2545 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2546 2547 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2548 if (!mlme_obj) 2549 return QDF_STATUS_E_FAILURE; 2550 2551 *value = mlme_obj->cfg.wmm_params.ac_bk.min_phy_rate_ac_bk; 2552 2553 return QDF_STATUS_SUCCESS; 2554 } 2555 2556 QDF_STATUS wlan_mlme_get_wmm_sba_ac_bk(struct wlan_objmgr_psoc * psoc,uint16_t * value)2557 wlan_mlme_get_wmm_sba_ac_bk(struct wlan_objmgr_psoc *psoc, uint16_t *value) 2558 { 2559 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2560 2561 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2562 if (!mlme_obj) 2563 return QDF_STATUS_E_FAILURE; 2564 2565 *value = mlme_obj->cfg.wmm_params.ac_bk.sba_ac_bk; 2566 2567 return QDF_STATUS_SUCCESS; 2568 } 2569 2570 QDF_STATUS wlan_mlme_get_wmm_uapsd_bk_srv_intv(struct wlan_objmgr_psoc * psoc,uint32_t * value)2571 wlan_mlme_get_wmm_uapsd_bk_srv_intv(struct wlan_objmgr_psoc *psoc, 2572 uint32_t *value) 2573 { 2574 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2575 2576 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2577 if (!mlme_obj) 2578 return QDF_STATUS_E_FAILURE; 2579 2580 *value = mlme_obj->cfg.wmm_params.ac_bk.uapsd_bk_srv_intv; 2581 2582 return QDF_STATUS_SUCCESS; 2583 } 2584 2585 QDF_STATUS wlan_mlme_get_wmm_uapsd_bk_sus_intv(struct wlan_objmgr_psoc * psoc,uint32_t * value)2586 wlan_mlme_get_wmm_uapsd_bk_sus_intv(struct wlan_objmgr_psoc *psoc, 2587 uint32_t *value) 2588 { 2589 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2590 2591 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2592 if (!mlme_obj) 2593 return QDF_STATUS_E_FAILURE; 2594 2595 *value = mlme_obj->cfg.wmm_params.ac_bk.uapsd_bk_sus_intv; 2596 2597 return QDF_STATUS_SUCCESS; 2598 } 2599 2600 QDF_STATUS wlan_mlme_get_wmm_mode(struct wlan_objmgr_psoc * psoc,uint8_t * value)2601 wlan_mlme_get_wmm_mode(struct wlan_objmgr_psoc *psoc, uint8_t *value) 2602 { 2603 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2604 2605 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2606 if (!mlme_obj) 2607 return QDF_STATUS_E_FAILURE; 2608 2609 *value = mlme_obj->cfg.wmm_params.wmm_config.wmm_mode; 2610 2611 return QDF_STATUS_SUCCESS; 2612 } 2613 2614 QDF_STATUS wlan_mlme_get_80211e_is_enabled(struct wlan_objmgr_psoc * psoc,bool * value)2615 wlan_mlme_get_80211e_is_enabled(struct wlan_objmgr_psoc *psoc, bool *value) 2616 { 2617 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2618 2619 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2620 if (!mlme_obj) 2621 return QDF_STATUS_E_FAILURE; 2622 2623 *value = mlme_obj->cfg.wmm_params.wmm_config.b80211e_is_enabled; 2624 2625 return QDF_STATUS_SUCCESS; 2626 } 2627 2628 QDF_STATUS wlan_mlme_get_wmm_uapsd_mask(struct wlan_objmgr_psoc * psoc,uint8_t * value)2629 wlan_mlme_get_wmm_uapsd_mask(struct wlan_objmgr_psoc *psoc, uint8_t *value) 2630 { 2631 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2632 2633 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2634 if (!mlme_obj) 2635 return QDF_STATUS_E_FAILURE; 2636 2637 *value = mlme_obj->cfg.wmm_params.wmm_config.uapsd_mask; 2638 2639 return QDF_STATUS_SUCCESS; 2640 } 2641 2642 #ifdef FEATURE_WLAN_ESE wlan_mlme_get_inactivity_interval(struct wlan_objmgr_psoc * psoc,uint32_t * value)2643 void wlan_mlme_get_inactivity_interval(struct wlan_objmgr_psoc *psoc, 2644 uint32_t *value) 2645 { 2646 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2647 2648 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2649 if (!mlme_obj) { 2650 *value = cfg_default(CFG_QOS_WMM_INACTIVITY_INTERVAL); 2651 return; 2652 } 2653 2654 *value = mlme_obj->cfg.wmm_params.wmm_tspec_element.inactivity_intv; 2655 } 2656 #endif 2657 wlan_mlme_get_is_ts_burst_size_enable(struct wlan_objmgr_psoc * psoc,bool * value)2658 void wlan_mlme_get_is_ts_burst_size_enable(struct wlan_objmgr_psoc *psoc, 2659 bool *value) 2660 { 2661 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2662 2663 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2664 if (!mlme_obj) { 2665 *value = cfg_default(CFG_QOS_WMM_BURST_SIZE_DEFN); 2666 return; 2667 } 2668 2669 *value = mlme_obj->cfg.wmm_params.wmm_tspec_element.burst_size_def; 2670 } 2671 wlan_mlme_get_ts_info_ack_policy(struct wlan_objmgr_psoc * psoc,enum mlme_ts_info_ack_policy * value)2672 void wlan_mlme_get_ts_info_ack_policy(struct wlan_objmgr_psoc *psoc, 2673 enum mlme_ts_info_ack_policy *value) 2674 { 2675 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2676 2677 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2678 if (!mlme_obj) { 2679 *value = cfg_default(CFG_QOS_WMM_TS_INFO_ACK_POLICY); 2680 return; 2681 } 2682 2683 *value = mlme_obj->cfg.wmm_params.wmm_tspec_element.ts_ack_policy; 2684 2685 } 2686 2687 QDF_STATUS wlan_mlme_get_ts_acm_value_for_ac(struct wlan_objmgr_psoc * psoc,bool * value)2688 wlan_mlme_get_ts_acm_value_for_ac(struct wlan_objmgr_psoc *psoc, bool *value) 2689 { 2690 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2691 2692 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2693 if (!mlme_obj) 2694 return QDF_STATUS_E_FAILURE; 2695 2696 *value = mlme_obj->cfg.wmm_params.wmm_tspec_element.ts_acm_is_off; 2697 2698 return QDF_STATUS_SUCCESS; 2699 } 2700 wlan_mlme_get_listen_interval(struct wlan_objmgr_psoc * psoc,int * value)2701 QDF_STATUS wlan_mlme_get_listen_interval(struct wlan_objmgr_psoc *psoc, 2702 int *value) 2703 { 2704 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2705 2706 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2707 if (!mlme_obj) 2708 return QDF_STATUS_E_FAILURE; 2709 2710 *value = mlme_obj->cfg.sap_cfg.listen_interval; 2711 2712 return QDF_STATUS_SUCCESS; 2713 } 2714 wlan_mlme_set_sap_listen_interval(struct wlan_objmgr_psoc * psoc,int value)2715 QDF_STATUS wlan_mlme_set_sap_listen_interval(struct wlan_objmgr_psoc *psoc, 2716 int value) 2717 { 2718 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2719 2720 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2721 if (!mlme_obj) 2722 return QDF_STATUS_E_FAILURE; 2723 2724 if (cfg_in_range(CFG_LISTEN_INTERVAL, value)) 2725 mlme_obj->cfg.sap_cfg.listen_interval = value; 2726 else 2727 return QDF_STATUS_E_FAILURE; 2728 2729 return QDF_STATUS_SUCCESS; 2730 } 2731 wlan_mlme_set_assoc_sta_limit(struct wlan_objmgr_psoc * psoc,int value)2732 QDF_STATUS wlan_mlme_set_assoc_sta_limit(struct wlan_objmgr_psoc *psoc, 2733 int value) 2734 { 2735 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2736 2737 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2738 if (!mlme_obj) 2739 return QDF_STATUS_E_FAILURE; 2740 2741 if (cfg_in_range(CFG_ASSOC_STA_LIMIT, value) && 2742 (value <= mlme_obj->cfg.sap_cfg.sap_max_no_peers)) 2743 mlme_obj->cfg.sap_cfg.assoc_sta_limit = value; 2744 else 2745 return QDF_STATUS_E_FAILURE; 2746 2747 return QDF_STATUS_SUCCESS; 2748 } 2749 wlan_mlme_get_assoc_sta_limit(struct wlan_objmgr_psoc * psoc,int * value)2750 QDF_STATUS wlan_mlme_get_assoc_sta_limit(struct wlan_objmgr_psoc *psoc, 2751 int *value) 2752 { 2753 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2754 2755 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2756 if (!mlme_obj) 2757 return QDF_STATUS_E_FAILURE; 2758 2759 *value = mlme_obj->cfg.sap_cfg.assoc_sta_limit; 2760 2761 return QDF_STATUS_SUCCESS; 2762 } 2763 wlan_mlme_get_sap_get_peer_info(struct wlan_objmgr_psoc * psoc,bool * value)2764 QDF_STATUS wlan_mlme_get_sap_get_peer_info(struct wlan_objmgr_psoc *psoc, 2765 bool *value) 2766 { 2767 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2768 2769 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2770 if (!mlme_obj) 2771 return QDF_STATUS_E_FAILURE; 2772 2773 *value = mlme_obj->cfg.sap_cfg.sap_get_peer_info; 2774 2775 return QDF_STATUS_SUCCESS; 2776 } 2777 wlan_mlme_set_sap_get_peer_info(struct wlan_objmgr_psoc * psoc,bool value)2778 QDF_STATUS wlan_mlme_set_sap_get_peer_info(struct wlan_objmgr_psoc *psoc, 2779 bool value) 2780 { 2781 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2782 2783 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2784 if (!mlme_obj) 2785 return QDF_STATUS_E_FAILURE; 2786 2787 mlme_obj->cfg.sap_cfg.sap_get_peer_info = value; 2788 2789 return QDF_STATUS_SUCCESS; 2790 } 2791 2792 QDF_STATUS wlan_mlme_get_sap_bcast_deauth_enabled(struct wlan_objmgr_psoc * psoc,bool * value)2793 wlan_mlme_get_sap_bcast_deauth_enabled(struct wlan_objmgr_psoc *psoc, 2794 bool *value) 2795 { 2796 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2797 2798 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2799 if (!mlme_obj) 2800 return QDF_STATUS_E_FAILURE; 2801 2802 *value = mlme_obj->cfg.sap_cfg.is_sap_bcast_deauth_enabled; 2803 2804 return QDF_STATUS_SUCCESS; 2805 } 2806 2807 QDF_STATUS wlan_mlme_is_6g_sap_fd_enabled(struct wlan_objmgr_psoc * psoc,bool * value)2808 wlan_mlme_is_6g_sap_fd_enabled(struct wlan_objmgr_psoc *psoc, 2809 bool *value) 2810 { 2811 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2812 2813 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2814 if (!mlme_obj) 2815 return QDF_STATUS_E_FAILURE; 2816 2817 *value = mlme_obj->cfg.sap_cfg.is_6g_sap_fd_enabled; 2818 2819 return QDF_STATUS_SUCCESS; 2820 } 2821 wlan_mlme_get_sap_allow_all_channels(struct wlan_objmgr_psoc * psoc,bool * value)2822 QDF_STATUS wlan_mlme_get_sap_allow_all_channels(struct wlan_objmgr_psoc *psoc, 2823 bool *value) 2824 { 2825 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2826 2827 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2828 if (!mlme_obj) 2829 return QDF_STATUS_E_FAILURE; 2830 2831 *value = mlme_obj->cfg.sap_cfg.sap_allow_all_chan_param_name; 2832 2833 return QDF_STATUS_SUCCESS; 2834 } 2835 wlan_mlme_get_sap_max_peers(struct wlan_objmgr_psoc * psoc,int * value)2836 QDF_STATUS wlan_mlme_get_sap_max_peers(struct wlan_objmgr_psoc *psoc, 2837 int *value) 2838 { 2839 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2840 2841 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2842 if (!mlme_obj) 2843 return QDF_STATUS_E_FAILURE; 2844 2845 *value = mlme_obj->cfg.sap_cfg.sap_max_no_peers; 2846 2847 return QDF_STATUS_SUCCESS; 2848 } 2849 wlan_mlme_set_sap_max_peers(struct wlan_objmgr_psoc * psoc,int value)2850 QDF_STATUS wlan_mlme_set_sap_max_peers(struct wlan_objmgr_psoc *psoc, 2851 int value) 2852 { 2853 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2854 2855 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2856 if (!mlme_obj) 2857 return QDF_STATUS_E_FAILURE; 2858 2859 if (cfg_in_range(CFG_SAP_MAX_NO_PEERS, value)) 2860 mlme_obj->cfg.sap_cfg.sap_max_no_peers = value; 2861 else 2862 return QDF_STATUS_E_FAILURE; 2863 2864 return QDF_STATUS_SUCCESS; 2865 } 2866 wlan_mlme_get_sap_max_offload_peers(struct wlan_objmgr_psoc * psoc,int * value)2867 QDF_STATUS wlan_mlme_get_sap_max_offload_peers(struct wlan_objmgr_psoc *psoc, 2868 int *value) 2869 { 2870 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2871 2872 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2873 if (!mlme_obj) 2874 return QDF_STATUS_E_FAILURE; 2875 2876 *value = mlme_obj->cfg.sap_cfg.sap_max_offload_peers; 2877 2878 return QDF_STATUS_SUCCESS; 2879 } 2880 wlan_mlme_get_sap_max_offload_reorder_buffs(struct wlan_objmgr_psoc * psoc,int * value)2881 QDF_STATUS wlan_mlme_get_sap_max_offload_reorder_buffs(struct wlan_objmgr_psoc 2882 *psoc, int *value) 2883 { 2884 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2885 2886 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2887 if (!mlme_obj) 2888 return QDF_STATUS_E_FAILURE; 2889 2890 *value = mlme_obj->cfg.sap_cfg.sap_max_offload_reorder_buffs; 2891 2892 return QDF_STATUS_SUCCESS; 2893 } 2894 wlan_mlme_get_sap_chn_switch_bcn_count(struct wlan_objmgr_psoc * psoc,int * value)2895 QDF_STATUS wlan_mlme_get_sap_chn_switch_bcn_count(struct wlan_objmgr_psoc *psoc, 2896 int *value) 2897 { 2898 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2899 2900 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2901 if (!mlme_obj) 2902 return QDF_STATUS_E_FAILURE; 2903 2904 *value = mlme_obj->cfg.sap_cfg.sap_ch_switch_beacon_cnt; 2905 2906 return QDF_STATUS_SUCCESS; 2907 } 2908 wlan_mlme_get_sap_chn_switch_mode(struct wlan_objmgr_psoc * psoc,bool * value)2909 QDF_STATUS wlan_mlme_get_sap_chn_switch_mode(struct wlan_objmgr_psoc *psoc, 2910 bool *value) 2911 { 2912 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2913 2914 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2915 if (!mlme_obj) 2916 return QDF_STATUS_E_FAILURE; 2917 2918 *value = mlme_obj->cfg.sap_cfg.sap_ch_switch_mode; 2919 2920 return QDF_STATUS_SUCCESS; 2921 } 2922 wlan_mlme_get_sap_internal_restart(struct wlan_objmgr_psoc * psoc,bool * value)2923 QDF_STATUS wlan_mlme_get_sap_internal_restart(struct wlan_objmgr_psoc *psoc, 2924 bool *value) 2925 { 2926 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2927 2928 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2929 if (!mlme_obj) 2930 return QDF_STATUS_E_FAILURE; 2931 2932 *value = mlme_obj->cfg.sap_cfg.sap_internal_restart; 2933 2934 return QDF_STATUS_SUCCESS; 2935 } 2936 wlan_mlme_get_sap_max_modulated_dtim(struct wlan_objmgr_psoc * psoc,uint8_t * value)2937 QDF_STATUS wlan_mlme_get_sap_max_modulated_dtim(struct wlan_objmgr_psoc *psoc, 2938 uint8_t *value) 2939 { 2940 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2941 2942 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2943 if (!mlme_obj) 2944 return QDF_STATUS_E_FAILURE; 2945 2946 *value = mlme_obj->cfg.sap_cfg.max_li_modulated_dtim_time; 2947 2948 return QDF_STATUS_SUCCESS; 2949 } 2950 wlan_mlme_get_sap_chan_pref_location(struct wlan_objmgr_psoc * psoc,uint8_t * value)2951 QDF_STATUS wlan_mlme_get_sap_chan_pref_location(struct wlan_objmgr_psoc *psoc, 2952 uint8_t *value) 2953 { 2954 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2955 2956 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2957 if (!mlme_obj) 2958 return QDF_STATUS_E_FAILURE; 2959 2960 *value = mlme_obj->cfg.sap_cfg.sap_pref_chan_location; 2961 2962 return QDF_STATUS_SUCCESS; 2963 } 2964 wlan_mlme_get_sap_country_priority(struct wlan_objmgr_psoc * psoc,bool * value)2965 QDF_STATUS wlan_mlme_get_sap_country_priority(struct wlan_objmgr_psoc *psoc, 2966 bool *value) 2967 { 2968 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2969 2970 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2971 if (!mlme_obj) 2972 return QDF_STATUS_E_FAILURE; 2973 2974 *value = mlme_obj->cfg.sap_cfg.country_code_priority; 2975 2976 return QDF_STATUS_SUCCESS; 2977 } 2978 wlan_mlme_get_sap_reduced_beacon_interval(struct wlan_objmgr_psoc * psoc,int * value)2979 QDF_STATUS wlan_mlme_get_sap_reduced_beacon_interval(struct wlan_objmgr_psoc 2980 *psoc, int *value) 2981 { 2982 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2983 2984 mlme_obj = mlme_get_psoc_ext_obj(psoc); 2985 if (!mlme_obj) { 2986 *value = cfg_default(CFG_REDUCED_BEACON_INTERVAL); 2987 return QDF_STATUS_E_FAILURE; 2988 } 2989 2990 *value = mlme_obj->cfg.sap_cfg.reduced_beacon_interval; 2991 2992 return QDF_STATUS_SUCCESS; 2993 } 2994 wlan_mlme_get_sap_chan_switch_rate_enabled(struct wlan_objmgr_psoc * psoc,bool * value)2995 QDF_STATUS wlan_mlme_get_sap_chan_switch_rate_enabled(struct wlan_objmgr_psoc 2996 *psoc, bool *value) 2997 { 2998 struct wlan_mlme_psoc_ext_obj *mlme_obj; 2999 3000 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3001 if (!mlme_obj) 3002 return QDF_STATUS_E_FAILURE; 3003 3004 *value = mlme_obj->cfg.sap_cfg.chan_switch_hostapd_rate_enabled_name; 3005 3006 return QDF_STATUS_SUCCESS; 3007 } 3008 wlan_mlme_get_sap_force_11n_for_11ac(struct wlan_objmgr_psoc * psoc,bool * value)3009 QDF_STATUS wlan_mlme_get_sap_force_11n_for_11ac(struct wlan_objmgr_psoc 3010 *psoc, bool *value) 3011 { 3012 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3013 3014 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3015 if (!mlme_obj) 3016 return QDF_STATUS_E_FAILURE; 3017 3018 *value = mlme_obj->cfg.sap_cfg.sap_force_11n_for_11ac; 3019 3020 return QDF_STATUS_SUCCESS; 3021 } 3022 wlan_mlme_get_go_force_11n_for_11ac(struct wlan_objmgr_psoc * psoc,bool * value)3023 QDF_STATUS wlan_mlme_get_go_force_11n_for_11ac(struct wlan_objmgr_psoc 3024 *psoc, bool *value) 3025 { 3026 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3027 3028 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3029 if (!mlme_obj) 3030 return QDF_STATUS_E_FAILURE; 3031 3032 *value = mlme_obj->cfg.sap_cfg.go_force_11n_for_11ac; 3033 3034 return QDF_STATUS_SUCCESS; 3035 } 3036 wlan_mlme_is_sap_11ac_override(struct wlan_objmgr_psoc * psoc,bool * value)3037 QDF_STATUS wlan_mlme_is_sap_11ac_override(struct wlan_objmgr_psoc *psoc, 3038 bool *value) 3039 { 3040 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3041 3042 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3043 if (!mlme_obj) { 3044 *value = cfg_default(CFG_SAP_11AC_OVERRIDE); 3045 return QDF_STATUS_E_FAILURE; 3046 } 3047 *value = mlme_obj->cfg.sap_cfg.sap_11ac_override; 3048 3049 return QDF_STATUS_SUCCESS; 3050 } 3051 wlan_mlme_is_go_11ac_override(struct wlan_objmgr_psoc * psoc,bool * value)3052 QDF_STATUS wlan_mlme_is_go_11ac_override(struct wlan_objmgr_psoc *psoc, 3053 bool *value) 3054 { 3055 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3056 3057 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3058 if (!mlme_obj) { 3059 *value = cfg_default(CFG_GO_11AC_OVERRIDE); 3060 return QDF_STATUS_E_FAILURE; 3061 } 3062 *value = mlme_obj->cfg.sap_cfg.go_11ac_override; 3063 3064 return QDF_STATUS_SUCCESS; 3065 } 3066 wlan_mlme_set_sap_11ac_override(struct wlan_objmgr_psoc * psoc,bool value)3067 QDF_STATUS wlan_mlme_set_sap_11ac_override(struct wlan_objmgr_psoc *psoc, 3068 bool value) 3069 { 3070 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3071 3072 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3073 if (!mlme_obj) 3074 return QDF_STATUS_E_FAILURE; 3075 mlme_obj->cfg.sap_cfg.sap_11ac_override = value; 3076 3077 return QDF_STATUS_SUCCESS; 3078 } 3079 wlan_mlme_set_go_11ac_override(struct wlan_objmgr_psoc * psoc,bool value)3080 QDF_STATUS wlan_mlme_set_go_11ac_override(struct wlan_objmgr_psoc *psoc, 3081 bool value) 3082 { 3083 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3084 3085 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3086 if (!mlme_obj) 3087 return QDF_STATUS_E_FAILURE; 3088 mlme_obj->cfg.sap_cfg.go_11ac_override = value; 3089 3090 return QDF_STATUS_SUCCESS; 3091 } 3092 wlan_mlme_get_bigtk_support(struct wlan_objmgr_psoc * psoc,bool * value)3093 QDF_STATUS wlan_mlme_get_bigtk_support(struct wlan_objmgr_psoc *psoc, 3094 bool *value) 3095 { 3096 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 3097 3098 if (!mlme_obj) 3099 return QDF_STATUS_E_FAILURE; 3100 3101 *value = mlme_obj->cfg.gen.bigtk_support; 3102 3103 return QDF_STATUS_SUCCESS; 3104 } 3105 wlan_mlme_get_ocv_support(struct wlan_objmgr_psoc * psoc,bool * value)3106 QDF_STATUS wlan_mlme_get_ocv_support(struct wlan_objmgr_psoc *psoc, 3107 bool *value) 3108 { 3109 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 3110 3111 if (!mlme_obj) 3112 return QDF_STATUS_E_FAILURE; 3113 3114 *value = mlme_obj->cfg.gen.ocv_support; 3115 3116 return QDF_STATUS_SUCCESS; 3117 } 3118 wlan_mlme_get_host_scan_abort_support(struct wlan_objmgr_psoc * psoc)3119 bool wlan_mlme_get_host_scan_abort_support(struct wlan_objmgr_psoc *psoc) 3120 { 3121 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 3122 3123 if (!mlme_obj) 3124 return false; 3125 3126 return mlme_obj->cfg.gen.stop_all_host_scan_support; 3127 } 3128 wlan_mlme_get_dual_sta_roam_support(struct wlan_objmgr_psoc * psoc)3129 bool wlan_mlme_get_dual_sta_roam_support(struct wlan_objmgr_psoc *psoc) 3130 { 3131 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 3132 3133 if (!mlme_obj) 3134 return false; 3135 3136 return mlme_obj->cfg.gen.dual_sta_roam_fw_support; 3137 } 3138 wlan_mlme_get_oce_sta_enabled_info(struct wlan_objmgr_psoc * psoc,bool * value)3139 QDF_STATUS wlan_mlme_get_oce_sta_enabled_info(struct wlan_objmgr_psoc *psoc, 3140 bool *value) 3141 { 3142 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 3143 3144 if (!mlme_obj) 3145 return QDF_STATUS_E_FAILURE; 3146 3147 *value = mlme_obj->cfg.oce.oce_sta_enabled; 3148 return QDF_STATUS_SUCCESS; 3149 } 3150 wlan_mlme_get_oce_sap_enabled_info(struct wlan_objmgr_psoc * psoc,bool * value)3151 QDF_STATUS wlan_mlme_get_oce_sap_enabled_info(struct wlan_objmgr_psoc *psoc, 3152 bool *value) 3153 { 3154 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 3155 3156 if (!mlme_obj) 3157 return QDF_STATUS_E_FAILURE; 3158 3159 *value = mlme_obj->cfg.oce.oce_sap_enabled; 3160 return QDF_STATUS_SUCCESS; 3161 } 3162 3163 /** 3164 * wlan_mlme_send_oce_flags_fw() - Send the oce flags to FW 3165 * @pdev: pointer to pdev object 3166 * @object: vdev object 3167 * @arg: Arguments to the handler 3168 * 3169 * Return: void 3170 */ wlan_mlme_send_oce_flags_fw(struct wlan_objmgr_pdev * pdev,void * object,void * arg)3171 static void wlan_mlme_send_oce_flags_fw(struct wlan_objmgr_pdev *pdev, 3172 void *object, void *arg) 3173 { 3174 struct wlan_objmgr_vdev *vdev = object; 3175 uint8_t *updated_fw_value = arg; 3176 uint8_t *dynamic_fw_value = 0; 3177 uint8_t vdev_id; 3178 3179 if (wlan_vdev_mlme_get_opmode(vdev) == QDF_STA_MODE) { 3180 dynamic_fw_value = mlme_get_dynamic_oce_flags(vdev); 3181 if (!dynamic_fw_value) 3182 return; 3183 if (*updated_fw_value == *dynamic_fw_value) { 3184 mlme_legacy_debug("Current FW flags matches with updated value."); 3185 return; 3186 } 3187 *dynamic_fw_value = *updated_fw_value; 3188 vdev_id = wlan_vdev_get_id(vdev); 3189 if (wma_cli_set_command(vdev_id, 3190 wmi_vdev_param_enable_disable_oce_features, 3191 *updated_fw_value, VDEV_CMD)) 3192 mlme_legacy_err("Failed to send OCE update to FW"); 3193 } 3194 } 3195 wlan_mlme_update_oce_flags(struct wlan_objmgr_pdev * pdev)3196 void wlan_mlme_update_oce_flags(struct wlan_objmgr_pdev *pdev) 3197 { 3198 uint16_t sap_connected_peer, go_connected_peer; 3199 struct wlan_objmgr_psoc *psoc = NULL; 3200 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3201 uint8_t updated_fw_value = 0; 3202 3203 psoc = wlan_pdev_get_psoc(pdev); 3204 if (!psoc) 3205 return; 3206 3207 sap_connected_peer = 3208 wlan_util_get_peer_count_for_mode(pdev, QDF_SAP_MODE); 3209 go_connected_peer = 3210 wlan_util_get_peer_count_for_mode(pdev, QDF_P2P_GO_MODE); 3211 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3212 3213 if (!mlme_obj) 3214 return; 3215 3216 if (sap_connected_peer || go_connected_peer) { 3217 updated_fw_value = mlme_obj->cfg.oce.feature_bitmap; 3218 updated_fw_value &= 3219 ~(WMI_VDEV_OCE_PROBE_REQUEST_RATE_FEATURE_BITMAP); 3220 updated_fw_value &= 3221 ~(WMI_VDEV_OCE_PROBE_REQUEST_DEFERRAL_FEATURE_BITMAP); 3222 mlme_legacy_debug("Disable STA OCE probe req rate and defferal updated_fw_value :%d", 3223 updated_fw_value); 3224 } else { 3225 updated_fw_value = mlme_obj->cfg.oce.feature_bitmap; 3226 mlme_legacy_debug("Update the STA OCE flags to default INI updated_fw_value :%d", 3227 updated_fw_value); 3228 } 3229 3230 wlan_objmgr_pdev_iterate_obj_list(pdev, WLAN_VDEV_OP, 3231 wlan_mlme_send_oce_flags_fw, 3232 &updated_fw_value, 0, WLAN_MLME_NB_ID); 3233 } 3234 wlan_mlme_is_ap_prot_enabled(struct wlan_objmgr_psoc * psoc)3235 bool wlan_mlme_is_ap_prot_enabled(struct wlan_objmgr_psoc *psoc) 3236 { 3237 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3238 3239 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3240 if (!mlme_obj) 3241 return false; 3242 3243 return mlme_obj->cfg.sap_protection_cfg.is_ap_prot_enabled; 3244 } 3245 wlan_mlme_get_ap_protection_mode(struct wlan_objmgr_psoc * psoc,uint16_t * value)3246 QDF_STATUS wlan_mlme_get_ap_protection_mode(struct wlan_objmgr_psoc *psoc, 3247 uint16_t *value) 3248 { 3249 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3250 3251 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3252 if (!mlme_obj) 3253 return QDF_STATUS_E_FAILURE; 3254 3255 *value = mlme_obj->cfg.sap_protection_cfg.ap_protection_mode; 3256 3257 return QDF_STATUS_SUCCESS; 3258 } 3259 wlan_mlme_is_ap_obss_prot_enabled(struct wlan_objmgr_psoc * psoc,bool * value)3260 QDF_STATUS wlan_mlme_is_ap_obss_prot_enabled(struct wlan_objmgr_psoc *psoc, 3261 bool *value) 3262 { 3263 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3264 3265 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3266 if (!mlme_obj) 3267 return QDF_STATUS_E_FAILURE; 3268 3269 *value = mlme_obj->cfg.sap_protection_cfg.enable_ap_obss_protection; 3270 3271 return QDF_STATUS_SUCCESS; 3272 } 3273 wlan_mlme_get_rts_threshold(struct wlan_objmgr_psoc * psoc,uint32_t * value)3274 QDF_STATUS wlan_mlme_get_rts_threshold(struct wlan_objmgr_psoc *psoc, 3275 uint32_t *value) 3276 { 3277 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3278 3279 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3280 if (!mlme_obj) 3281 return QDF_STATUS_E_FAILURE; 3282 3283 *value = mlme_obj->cfg.threshold.rts_threshold; 3284 3285 return QDF_STATUS_SUCCESS; 3286 } 3287 wlan_mlme_set_rts_threshold(struct wlan_objmgr_psoc * psoc,uint32_t value)3288 QDF_STATUS wlan_mlme_set_rts_threshold(struct wlan_objmgr_psoc *psoc, 3289 uint32_t value) 3290 { 3291 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3292 tp_wma_handle wma_handle; 3293 3294 wma_handle = cds_get_context(QDF_MODULE_ID_WMA); 3295 3296 if (!wma_handle) 3297 return QDF_STATUS_E_INVAL; 3298 3299 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3300 3301 if (!mlme_obj) 3302 return QDF_STATUS_E_FAILURE; 3303 3304 mlme_obj->cfg.threshold.rts_threshold = value; 3305 wma_update_rts_params(wma_handle, value); 3306 3307 return QDF_STATUS_SUCCESS; 3308 } 3309 wlan_mlme_get_frag_threshold(struct wlan_objmgr_psoc * psoc,uint32_t * value)3310 QDF_STATUS wlan_mlme_get_frag_threshold(struct wlan_objmgr_psoc *psoc, 3311 uint32_t *value) 3312 { 3313 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3314 3315 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3316 if (!mlme_obj) 3317 return QDF_STATUS_E_FAILURE; 3318 3319 *value = mlme_obj->cfg.threshold.frag_threshold; 3320 3321 return QDF_STATUS_SUCCESS; 3322 } 3323 wlan_mlme_set_frag_threshold(struct wlan_objmgr_psoc * psoc,uint32_t value)3324 QDF_STATUS wlan_mlme_set_frag_threshold(struct wlan_objmgr_psoc *psoc, 3325 uint32_t value) 3326 { 3327 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3328 tp_wma_handle wma_handle; 3329 3330 wma_handle = cds_get_context(QDF_MODULE_ID_WMA); 3331 3332 if (!wma_handle) 3333 return QDF_STATUS_E_INVAL; 3334 3335 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3336 3337 if (!mlme_obj) 3338 return QDF_STATUS_E_FAILURE; 3339 3340 mlme_obj->cfg.threshold.frag_threshold = value; 3341 wma_update_frag_params(wma_handle, 3342 value); 3343 3344 return QDF_STATUS_SUCCESS; 3345 } 3346 wlan_mlme_get_fils_enabled_info(struct wlan_objmgr_psoc * psoc,bool * value)3347 QDF_STATUS wlan_mlme_get_fils_enabled_info(struct wlan_objmgr_psoc *psoc, 3348 bool *value) 3349 { 3350 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 3351 3352 if (!mlme_obj) 3353 return QDF_STATUS_E_FAILURE; 3354 3355 *value = mlme_obj->cfg.oce.fils_enabled; 3356 return QDF_STATUS_SUCCESS; 3357 } 3358 wlan_mlme_set_fils_enabled_info(struct wlan_objmgr_psoc * psoc,bool value)3359 QDF_STATUS wlan_mlme_set_fils_enabled_info(struct wlan_objmgr_psoc *psoc, 3360 bool value) 3361 { 3362 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 3363 3364 if (!mlme_obj) 3365 return QDF_STATUS_E_FAILURE; 3366 3367 mlme_obj->cfg.oce.fils_enabled = value; 3368 return QDF_STATUS_SUCCESS; 3369 } 3370 wlan_mlme_set_primary_interface(struct wlan_objmgr_psoc * psoc,uint8_t value)3371 QDF_STATUS wlan_mlme_set_primary_interface(struct wlan_objmgr_psoc *psoc, 3372 uint8_t value) 3373 { 3374 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 3375 3376 if (!mlme_obj) 3377 return QDF_STATUS_E_FAILURE; 3378 3379 mlme_obj->cfg.gen.dual_sta_policy.primary_vdev_id = value; 3380 mlme_debug("Set primary iface to :%d", value); 3381 3382 return QDF_STATUS_SUCCESS; 3383 } 3384 wlan_mlme_is_primary_interface_configured(struct wlan_objmgr_psoc * psoc)3385 bool wlan_mlme_is_primary_interface_configured(struct wlan_objmgr_psoc *psoc) 3386 { 3387 return wlan_cm_same_band_sta_allowed(psoc); 3388 } 3389 wlan_mlme_peer_get_assoc_rsp_ies(struct wlan_objmgr_peer * peer,const uint8_t ** ie_buf,size_t * ie_len)3390 QDF_STATUS wlan_mlme_peer_get_assoc_rsp_ies(struct wlan_objmgr_peer *peer, 3391 const uint8_t **ie_buf, 3392 size_t *ie_len) 3393 { 3394 struct peer_mlme_priv_obj *peer_priv; 3395 3396 if (!peer || !ie_buf || !ie_len) 3397 return QDF_STATUS_E_INVAL; 3398 3399 *ie_buf = NULL; 3400 *ie_len = 0; 3401 3402 peer_priv = wlan_objmgr_peer_get_comp_private_obj(peer, 3403 WLAN_UMAC_COMP_MLME); 3404 3405 if (!peer_priv || peer_priv->assoc_rsp.len == 0) 3406 return QDF_STATUS_SUCCESS; 3407 3408 *ie_buf = peer_priv->assoc_rsp.ptr; 3409 *ie_len = peer_priv->assoc_rsp.len; 3410 3411 return QDF_STATUS_SUCCESS; 3412 } 3413 wlan_mlme_get_mcc_duty_cycle_percentage(struct wlan_objmgr_pdev * pdev)3414 int wlan_mlme_get_mcc_duty_cycle_percentage(struct wlan_objmgr_pdev *pdev) 3415 { 3416 struct wlan_objmgr_psoc *psoc = NULL; 3417 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3418 uint32_t op_ch_freq_list[MAX_NUMBER_OF_CONC_CONNECTIONS]; 3419 uint8_t vdev_id_list[MAX_NUMBER_OF_CONC_CONNECTIONS]; 3420 uint32_t i, operating_channel, quota_value = MCC_DUTY_CYCLE; 3421 struct dual_sta_policy *dual_sta_policy; 3422 uint32_t count, primary_sta_freq = 0, secondary_sta_freq = 0; 3423 3424 psoc = wlan_pdev_get_psoc(pdev); 3425 if (!psoc) 3426 return -EINVAL; 3427 3428 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3429 if (!mlme_obj) 3430 return -EINVAL; 3431 dual_sta_policy = &mlme_obj->cfg.gen.dual_sta_policy; 3432 3433 if (dual_sta_policy->primary_vdev_id == WLAN_INVALID_VDEV_ID || 3434 (dual_sta_policy->concurrent_sta_policy == 3435 QCA_WLAN_CONCURRENT_STA_POLICY_UNBIASED)) { 3436 mlme_debug("Invalid primary vdev id or policy is unbaised :%d", 3437 dual_sta_policy->concurrent_sta_policy); 3438 return -EINVAL; 3439 } 3440 3441 count = policy_mgr_get_mode_specific_conn_info(psoc, op_ch_freq_list, 3442 vdev_id_list, 3443 PM_STA_MODE); 3444 3445 /* Proceed only in case of STA+STA */ 3446 if (count != 2) { 3447 mlme_debug("STA+STA concurrency is not present"); 3448 return -EINVAL; 3449 } 3450 3451 for (i = 0; i < count; i++) { 3452 if (vdev_id_list[i] == dual_sta_policy->primary_vdev_id) { 3453 primary_sta_freq = op_ch_freq_list[i]; 3454 mlme_debug("primary sta vdev:%d at inxex:%d, freq:%d", 3455 i, vdev_id_list[i], op_ch_freq_list[i]); 3456 } else { 3457 secondary_sta_freq = op_ch_freq_list[i]; 3458 mlme_debug("secondary sta vdev:%d at inxex:%d, freq:%d", 3459 i, vdev_id_list[i], op_ch_freq_list[i]); 3460 } 3461 } 3462 3463 if (!primary_sta_freq || !secondary_sta_freq) { 3464 mlme_debug("Invalid primary or secondary sta freq"); 3465 return -EINVAL; 3466 } 3467 3468 operating_channel = wlan_freq_to_chan(primary_sta_freq); 3469 3470 /* 3471 * The channel numbers for both adapters and the time 3472 * quota for the 1st adapter, i.e., one specified in cmd 3473 * are formatted as a bit vector 3474 * ****************************************************** 3475 * |bit 31-24 | bit 23-16 | bits 15-8 |bits 7-0 | 3476 * | Unused | Quota for | chan. # for |chan. # for| 3477 * | | 1st chan | 1st chan. |2nd chan. | 3478 * ****************************************************** 3479 */ 3480 mlme_debug("First connection channel No.:%d and quota:%dms", 3481 operating_channel, quota_value); 3482 /* Move the time quota for first channel to bits 15-8 */ 3483 quota_value = quota_value << 8; 3484 /* 3485 * Store the channel number of 1st channel at bits 7-0 3486 * of the bit vector 3487 */ 3488 quota_value |= operating_channel; 3489 /* Second STA Connection */ 3490 operating_channel = wlan_freq_to_chan(secondary_sta_freq); 3491 if (!operating_channel) 3492 mlme_debug("Secondary adapter op channel is invalid"); 3493 /* 3494 * Now move the time quota and channel number of the 3495 * 1st adapter to bits 23-16 and bits 15-8 of the bit 3496 * vector, respectively. 3497 */ 3498 quota_value = quota_value << 8; 3499 /* 3500 * Set the channel number for 2nd MCC vdev at bits 3501 * 7-0 of set_value 3502 */ 3503 quota_value |= operating_channel; 3504 mlme_debug("quota value:%x", quota_value); 3505 3506 return quota_value; 3507 } 3508 wlan_mlme_set_enable_bcast_probe_rsp(struct wlan_objmgr_psoc * psoc,bool value)3509 QDF_STATUS wlan_mlme_set_enable_bcast_probe_rsp(struct wlan_objmgr_psoc *psoc, 3510 bool value) 3511 { 3512 struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); 3513 3514 if (!mlme_obj) 3515 return QDF_STATUS_E_FAILURE; 3516 3517 mlme_obj->cfg.oce.enable_bcast_probe_rsp = value; 3518 return QDF_STATUS_SUCCESS; 3519 } 3520 3521 QDF_STATUS wlan_mlme_get_sta_miracast_mcc_rest_time(struct wlan_objmgr_psoc * psoc,uint32_t * value)3522 wlan_mlme_get_sta_miracast_mcc_rest_time(struct wlan_objmgr_psoc *psoc, 3523 uint32_t *value) 3524 { 3525 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3526 3527 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3528 if (!mlme_obj) 3529 return QDF_STATUS_E_FAILURE; 3530 3531 *value = mlme_obj->cfg.sta.sta_miracast_mcc_rest_time; 3532 3533 return QDF_STATUS_SUCCESS; 3534 } 3535 3536 QDF_STATUS wlan_mlme_get_max_modulated_dtim_ms(struct wlan_objmgr_psoc * psoc,uint16_t * value)3537 wlan_mlme_get_max_modulated_dtim_ms(struct wlan_objmgr_psoc *psoc, 3538 uint16_t *value) 3539 { 3540 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3541 3542 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3543 if (!mlme_obj) 3544 return QDF_STATUS_E_FAILURE; 3545 3546 *value = mlme_obj->cfg.sta.max_li_modulated_dtim_time_ms; 3547 3548 return QDF_STATUS_SUCCESS; 3549 } 3550 3551 QDF_STATUS wlan_mlme_get_scan_probe_unicast_ra(struct wlan_objmgr_psoc * psoc,bool * value)3552 wlan_mlme_get_scan_probe_unicast_ra(struct wlan_objmgr_psoc *psoc, 3553 bool *value) 3554 { 3555 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3556 3557 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3558 if (!mlme_obj) 3559 return QDF_STATUS_E_FAILURE; 3560 3561 *value = mlme_obj->cfg.sta.usr_scan_probe_unicast_ra; 3562 3563 mlme_legacy_debug("scan_probe_unicast_ra %d", *value); 3564 3565 return QDF_STATUS_SUCCESS; 3566 } 3567 3568 QDF_STATUS wlan_mlme_set_scan_probe_unicast_ra(struct wlan_objmgr_psoc * psoc,bool value)3569 wlan_mlme_set_scan_probe_unicast_ra(struct wlan_objmgr_psoc *psoc, 3570 bool value) 3571 { 3572 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3573 3574 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3575 if (!mlme_obj) 3576 return QDF_STATUS_E_FAILURE; 3577 3578 mlme_legacy_debug("scan_probe_unicast_ra %d", value); 3579 mlme_obj->cfg.sta.usr_scan_probe_unicast_ra = value; 3580 3581 return QDF_STATUS_SUCCESS; 3582 } 3583 3584 QDF_STATUS wlan_mlme_get_sap_mcc_chnl_avoid(struct wlan_objmgr_psoc * psoc,uint8_t * value)3585 wlan_mlme_get_sap_mcc_chnl_avoid(struct wlan_objmgr_psoc *psoc, 3586 uint8_t *value) 3587 { 3588 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3589 3590 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3591 if (!mlme_obj) 3592 return QDF_STATUS_E_FAILURE; 3593 3594 *value = mlme_obj->cfg.sap_cfg.sap_mcc_chnl_avoid; 3595 3596 return QDF_STATUS_SUCCESS; 3597 } 3598 3599 QDF_STATUS wlan_mlme_get_mcc_bcast_prob_resp(struct wlan_objmgr_psoc * psoc,uint8_t * value)3600 wlan_mlme_get_mcc_bcast_prob_resp(struct wlan_objmgr_psoc *psoc, 3601 uint8_t *value) 3602 { 3603 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3604 3605 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3606 if (!mlme_obj) 3607 return QDF_STATUS_E_FAILURE; 3608 3609 *value = mlme_obj->cfg.feature_flags.mcc_bcast_prob_rsp; 3610 3611 return QDF_STATUS_SUCCESS; 3612 } 3613 3614 QDF_STATUS wlan_mlme_get_mcc_rts_cts_prot(struct wlan_objmgr_psoc * psoc,uint8_t * value)3615 wlan_mlme_get_mcc_rts_cts_prot(struct wlan_objmgr_psoc *psoc, 3616 uint8_t *value) 3617 { 3618 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3619 3620 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3621 if (!mlme_obj) 3622 return QDF_STATUS_E_FAILURE; 3623 3624 *value = mlme_obj->cfg.feature_flags.mcc_rts_cts_prot; 3625 3626 return QDF_STATUS_SUCCESS; 3627 } 3628 3629 QDF_STATUS wlan_mlme_get_mcc_feature(struct wlan_objmgr_psoc * psoc,uint8_t * value)3630 wlan_mlme_get_mcc_feature(struct wlan_objmgr_psoc *psoc, 3631 uint8_t *value) 3632 { 3633 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3634 3635 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3636 if (!mlme_obj) 3637 return QDF_STATUS_E_FAILURE; 3638 3639 *value = mlme_obj->cfg.feature_flags.enable_mcc; 3640 3641 return QDF_STATUS_SUCCESS; 3642 } 3643 wlan_mlme_get_edca_params(struct wlan_mlme_edca_params * edca_params,uint8_t * data,enum e_edca_type edca_ac)3644 QDF_STATUS wlan_mlme_get_edca_params(struct wlan_mlme_edca_params *edca_params, 3645 uint8_t *data, enum e_edca_type edca_ac) 3646 { 3647 qdf_size_t len; 3648 3649 switch (edca_ac) { 3650 case edca_ani_acbe_local: 3651 len = edca_params->ani_acbe_l.len; 3652 wlan_mlme_get_cfg_str(data, &edca_params->ani_acbe_l, &len); 3653 break; 3654 3655 case edca_ani_acbk_local: 3656 len = edca_params->ani_acbk_l.len; 3657 wlan_mlme_get_cfg_str(data, &edca_params->ani_acbk_l, &len); 3658 break; 3659 3660 case edca_ani_acvi_local: 3661 len = edca_params->ani_acvi_l.len; 3662 wlan_mlme_get_cfg_str(data, &edca_params->ani_acvi_l, &len); 3663 break; 3664 3665 case edca_ani_acvo_local: 3666 len = edca_params->ani_acvo_l.len; 3667 wlan_mlme_get_cfg_str(data, &edca_params->ani_acvo_l, &len); 3668 break; 3669 3670 case edca_ani_acbk_bcast: 3671 len = edca_params->ani_acbk_b.len; 3672 wlan_mlme_get_cfg_str(data, &edca_params->ani_acbk_b, &len); 3673 break; 3674 3675 case edca_ani_acbe_bcast: 3676 len = edca_params->ani_acbe_b.len; 3677 wlan_mlme_get_cfg_str(data, &edca_params->ani_acbe_b, &len); 3678 break; 3679 3680 case edca_ani_acvi_bcast: 3681 len = edca_params->ani_acvi_b.len; 3682 wlan_mlme_get_cfg_str(data, &edca_params->ani_acvi_b, &len); 3683 break; 3684 3685 case edca_ani_acvo_bcast: 3686 len = edca_params->ani_acvo_b.len; 3687 wlan_mlme_get_cfg_str(data, &edca_params->ani_acvo_b, &len); 3688 break; 3689 3690 case edca_wme_acbe_local: 3691 len = edca_params->wme_acbe_l.len; 3692 wlan_mlme_get_cfg_str(data, &edca_params->wme_acbe_l, &len); 3693 break; 3694 3695 case edca_wme_acbk_local: 3696 len = edca_params->wme_acbk_l.len; 3697 wlan_mlme_get_cfg_str(data, &edca_params->wme_acbk_l, &len); 3698 break; 3699 3700 case edca_wme_acvi_local: 3701 len = edca_params->wme_acvi_l.len; 3702 wlan_mlme_get_cfg_str(data, &edca_params->wme_acvi_l, &len); 3703 break; 3704 3705 case edca_wme_acvo_local: 3706 len = edca_params->wme_acvo_l.len; 3707 wlan_mlme_get_cfg_str(data, &edca_params->wme_acvo_l, &len); 3708 break; 3709 3710 case edca_wme_acbe_bcast: 3711 len = edca_params->wme_acbe_b.len; 3712 wlan_mlme_get_cfg_str(data, &edca_params->wme_acbe_b, &len); 3713 break; 3714 3715 case edca_wme_acbk_bcast: 3716 len = edca_params->wme_acbk_b.len; 3717 wlan_mlme_get_cfg_str(data, &edca_params->wme_acbk_b, &len); 3718 break; 3719 3720 case edca_wme_acvi_bcast: 3721 len = edca_params->wme_acvi_b.len; 3722 wlan_mlme_get_cfg_str(data, &edca_params->wme_acvi_b, &len); 3723 break; 3724 3725 case edca_wme_acvo_bcast: 3726 len = edca_params->wme_acvo_b.len; 3727 wlan_mlme_get_cfg_str(data, &edca_params->wme_acvo_b, &len); 3728 break; 3729 3730 case edca_etsi_acbe_local: 3731 len = edca_params->etsi_acbe_l.len; 3732 wlan_mlme_get_cfg_str(data, &edca_params->etsi_acbe_l, &len); 3733 break; 3734 3735 case edca_etsi_acbk_local: 3736 len = edca_params->etsi_acbk_l.len; 3737 wlan_mlme_get_cfg_str(data, &edca_params->etsi_acbk_l, &len); 3738 break; 3739 3740 case edca_etsi_acvi_local: 3741 len = edca_params->etsi_acvi_l.len; 3742 wlan_mlme_get_cfg_str(data, &edca_params->etsi_acvi_l, &len); 3743 break; 3744 3745 case edca_etsi_acvo_local: 3746 len = edca_params->etsi_acvo_l.len; 3747 wlan_mlme_get_cfg_str(data, &edca_params->etsi_acvo_l, &len); 3748 break; 3749 3750 case edca_etsi_acbe_bcast: 3751 len = edca_params->etsi_acbe_b.len; 3752 wlan_mlme_get_cfg_str(data, &edca_params->etsi_acbe_b, &len); 3753 break; 3754 3755 case edca_etsi_acbk_bcast: 3756 len = edca_params->etsi_acbk_b.len; 3757 wlan_mlme_get_cfg_str(data, &edca_params->etsi_acbk_b, &len); 3758 break; 3759 3760 case edca_etsi_acvi_bcast: 3761 len = edca_params->etsi_acvi_b.len; 3762 wlan_mlme_get_cfg_str(data, &edca_params->etsi_acvi_b, &len); 3763 break; 3764 3765 case edca_etsi_acvo_bcast: 3766 len = edca_params->etsi_acvo_b.len; 3767 wlan_mlme_get_cfg_str(data, &edca_params->etsi_acvo_b, &len); 3768 break; 3769 default: 3770 mlme_legacy_err("Invalid edca access category"); 3771 return QDF_STATUS_E_INVAL; 3772 } 3773 return QDF_STATUS_SUCCESS; 3774 } 3775 mlme_get_wep_key(struct wlan_objmgr_vdev * vdev,struct wlan_mlme_wep_cfg * wep_params,enum wep_key_id wep_keyid,uint8_t * default_key,qdf_size_t * key_len)3776 QDF_STATUS mlme_get_wep_key(struct wlan_objmgr_vdev *vdev, 3777 struct wlan_mlme_wep_cfg *wep_params, 3778 enum wep_key_id wep_keyid, uint8_t *default_key, 3779 qdf_size_t *key_len) 3780 { 3781 struct wlan_crypto_key *crypto_key = NULL; 3782 3783 if (wep_keyid >= WLAN_CRYPTO_MAXKEYIDX) { 3784 mlme_legacy_err("Incorrect wep key index %d", wep_keyid); 3785 return QDF_STATUS_E_INVAL; 3786 } 3787 crypto_key = wlan_crypto_get_key(vdev, wep_keyid); 3788 if (!crypto_key) { 3789 mlme_legacy_err("Crypto KEY not present"); 3790 return QDF_STATUS_E_INVAL; 3791 } 3792 3793 if (crypto_key->keylen > WLAN_CRYPTO_KEY_WEP104_LEN) { 3794 mlme_legacy_err("Key too large to hold"); 3795 return QDF_STATUS_E_INVAL; 3796 } 3797 *key_len = crypto_key->keylen; 3798 qdf_mem_copy(default_key, &crypto_key->keyval, crypto_key->keylen); 3799 3800 return QDF_STATUS_SUCCESS; 3801 } 3802 3803 QDF_STATUS wlan_mlme_is_11h_enabled(struct wlan_objmgr_psoc * psoc,bool * value)3804 wlan_mlme_is_11h_enabled(struct wlan_objmgr_psoc *psoc, bool *value) 3805 { 3806 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3807 3808 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3809 if (!mlme_obj) 3810 return QDF_STATUS_E_FAILURE; 3811 3812 *value = mlme_obj->cfg.gen.enabled_11h; 3813 3814 return QDF_STATUS_SUCCESS; 3815 } 3816 3817 QDF_STATUS wlan_mlme_set_11h_enabled(struct wlan_objmgr_psoc * psoc,bool value)3818 wlan_mlme_set_11h_enabled(struct wlan_objmgr_psoc *psoc, bool value) 3819 { 3820 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3821 3822 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3823 if (!mlme_obj) 3824 return QDF_STATUS_E_FAILURE; 3825 3826 mlme_obj->cfg.gen.enabled_11h = value; 3827 3828 return QDF_STATUS_SUCCESS; 3829 } 3830 3831 QDF_STATUS wlan_mlme_is_11d_enabled(struct wlan_objmgr_psoc * psoc,bool * value)3832 wlan_mlme_is_11d_enabled(struct wlan_objmgr_psoc *psoc, bool *value) 3833 { 3834 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3835 3836 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3837 if (!mlme_obj) 3838 return QDF_STATUS_E_FAILURE; 3839 3840 *value = mlme_obj->cfg.gen.enabled_11d; 3841 3842 return QDF_STATUS_SUCCESS; 3843 } 3844 3845 QDF_STATUS wlan_mlme_set_11d_enabled(struct wlan_objmgr_psoc * psoc,bool value)3846 wlan_mlme_set_11d_enabled(struct wlan_objmgr_psoc *psoc, bool value) 3847 { 3848 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3849 3850 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3851 if (!mlme_obj) 3852 return QDF_STATUS_E_FAILURE; 3853 3854 mlme_obj->cfg.gen.enabled_11d = value; 3855 3856 return QDF_STATUS_SUCCESS; 3857 } 3858 3859 QDF_STATUS wlan_mlme_is_rf_test_mode_enabled(struct wlan_objmgr_psoc * psoc,bool * value)3860 wlan_mlme_is_rf_test_mode_enabled(struct wlan_objmgr_psoc *psoc, bool *value) 3861 { 3862 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3863 3864 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3865 if (!mlme_obj) { 3866 *value = false; 3867 return QDF_STATUS_E_FAILURE; 3868 } 3869 3870 *value = mlme_obj->cfg.gen.enabled_rf_test_mode; 3871 3872 return QDF_STATUS_SUCCESS; 3873 } 3874 3875 QDF_STATUS wlan_mlme_set_rf_test_mode_enabled(struct wlan_objmgr_psoc * psoc,bool value)3876 wlan_mlme_set_rf_test_mode_enabled(struct wlan_objmgr_psoc *psoc, bool value) 3877 { 3878 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3879 3880 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3881 if (!mlme_obj) 3882 return QDF_STATUS_E_FAILURE; 3883 3884 mlme_obj->cfg.gen.enabled_rf_test_mode = value; 3885 3886 return QDF_STATUS_SUCCESS; 3887 } 3888 3889 #ifdef CONFIG_BAND_6GHZ 3890 QDF_STATUS wlan_mlme_is_standard_6ghz_conn_policy_enabled(struct wlan_objmgr_psoc * psoc,bool * value)3891 wlan_mlme_is_standard_6ghz_conn_policy_enabled(struct wlan_objmgr_psoc *psoc, 3892 bool *value) 3893 { 3894 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3895 3896 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3897 if (!mlme_obj) 3898 return QDF_STATUS_E_FAILURE; 3899 3900 *value = mlme_obj->cfg.gen.std_6ghz_conn_policy; 3901 3902 return QDF_STATUS_SUCCESS; 3903 } 3904 3905 QDF_STATUS wlan_mlme_is_disable_vlp_sta_conn_to_sp_ap_enabled(struct wlan_objmgr_psoc * psoc,bool * value)3906 wlan_mlme_is_disable_vlp_sta_conn_to_sp_ap_enabled( 3907 struct wlan_objmgr_psoc *psoc, 3908 bool *value) 3909 { 3910 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3911 3912 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3913 if (!mlme_obj) 3914 return QDF_STATUS_E_FAILURE; 3915 3916 *value = mlme_obj->cfg.gen.disable_vlp_sta_conn_to_sp_ap; 3917 3918 return QDF_STATUS_SUCCESS; 3919 } 3920 #endif 3921 3922 #ifdef WLAN_FEATURE_11BE_MLO 3923 QDF_STATUS wlan_mlme_get_eht_mode(struct wlan_objmgr_psoc * psoc,enum wlan_eht_mode * value)3924 wlan_mlme_get_eht_mode(struct wlan_objmgr_psoc *psoc, enum wlan_eht_mode *value) 3925 { 3926 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3927 3928 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3929 if (!mlme_obj) 3930 return QDF_STATUS_E_FAILURE; 3931 3932 *value = mlme_obj->cfg.gen.eht_mode; 3933 3934 return QDF_STATUS_SUCCESS; 3935 } 3936 3937 QDF_STATUS wlan_mlme_get_emlsr_mode_enabled(struct wlan_objmgr_psoc * psoc,bool * value)3938 wlan_mlme_get_emlsr_mode_enabled(struct wlan_objmgr_psoc *psoc, bool *value) 3939 { 3940 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3941 3942 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3943 if (!mlme_obj) 3944 return QDF_STATUS_E_FAILURE; 3945 3946 *value = mlme_obj->cfg.gen.enable_emlsr_mode; 3947 3948 return QDF_STATUS_SUCCESS; 3949 } 3950 3951 QDF_STATUS wlan_mlme_set_eht_mode(struct wlan_objmgr_psoc * psoc,enum wlan_eht_mode value)3952 wlan_mlme_set_eht_mode(struct wlan_objmgr_psoc *psoc, enum wlan_eht_mode value) 3953 { 3954 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3955 3956 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3957 if (!mlme_obj) 3958 return QDF_STATUS_E_FAILURE; 3959 3960 mlme_obj->cfg.gen.eht_mode = value; 3961 3962 return QDF_STATUS_SUCCESS; 3963 } 3964 3965 QDF_STATUS wlan_mlme_set_emlsr_mode_enabled(struct wlan_objmgr_psoc * psoc,bool value)3966 wlan_mlme_set_emlsr_mode_enabled(struct wlan_objmgr_psoc *psoc, bool value) 3967 { 3968 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3969 3970 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3971 if (!mlme_obj) 3972 return QDF_STATUS_E_FAILURE; 3973 3974 mlme_obj->cfg.gen.enable_emlsr_mode = value; 3975 3976 return QDF_STATUS_SUCCESS; 3977 } 3978 3979 void wlan_mlme_set_eml_params(struct wlan_objmgr_psoc * psoc,struct wlan_psoc_host_mac_phy_caps_ext2 * cap)3980 wlan_mlme_set_eml_params(struct wlan_objmgr_psoc *psoc, 3981 struct wlan_psoc_host_mac_phy_caps_ext2 *cap) 3982 { 3983 struct wlan_mlme_psoc_ext_obj *mlme_obj; 3984 3985 if (!cap->emlcap.emlsr_supp) { 3986 mlme_legacy_debug("EMLSR supp: %d", cap->emlcap.emlsr_supp); 3987 return; 3988 } 3989 3990 mlme_obj = mlme_get_psoc_ext_obj(psoc); 3991 if (!mlme_obj) { 3992 mlme_legacy_err("No psoc object"); 3993 return; 3994 } 3995 mlme_obj->cfg.eml_cap.emlsr_supp = cap->emlcap.emlsr_supp; 3996 mlme_obj->cfg.eml_cap.emlsr_pad_delay = cap->emlcap.emlsr_pad_delay; 3997 mlme_obj->cfg.eml_cap.emlsr_trans_delay = cap->emlcap.emlsr_trans_delay; 3998 mlme_obj->cfg.eml_cap.emlmr_supp = cap->emlcap.emlmr_supp; 3999 } 4000 4001 void wlan_mlme_get_eml_params(struct wlan_objmgr_psoc * psoc,struct wlan_mlo_eml_cap * cap)4002 wlan_mlme_get_eml_params(struct wlan_objmgr_psoc *psoc, 4003 struct wlan_mlo_eml_cap *cap) 4004 { 4005 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4006 4007 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4008 if (!mlme_obj) { 4009 mlme_legacy_err("No psoc object"); 4010 return; 4011 } 4012 cap->emlsr_supp = mlme_obj->cfg.eml_cap.emlsr_supp; 4013 cap->emlsr_pad_delay = mlme_obj->cfg.eml_cap.emlsr_pad_delay; 4014 cap->emlsr_trans_delay = mlme_obj->cfg.eml_cap.emlsr_trans_delay; 4015 cap->emlmr_supp = mlme_obj->cfg.eml_cap.emlmr_supp; 4016 } 4017 4018 void wlan_mlme_cfg_set_emlsr_pad_delay(struct wlan_objmgr_psoc * psoc,uint8_t val)4019 wlan_mlme_cfg_set_emlsr_pad_delay(struct wlan_objmgr_psoc *psoc, uint8_t val) 4020 { 4021 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4022 4023 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4024 if (!mlme_obj) { 4025 mlme_legacy_err("No psoc object"); 4026 return; 4027 } 4028 4029 if (val > mlme_obj->cfg.eml_cap.emlsr_pad_delay && 4030 val <= WLAN_ML_BV_CINFO_EMLCAP_EMLSRDELAY_256US) { 4031 mlme_obj->cfg.eml_cap.emlsr_pad_delay = val; 4032 mlme_debug("EMLSR padding delay configured to %d", val); 4033 } 4034 } 4035 4036 enum t2lm_negotiation_support wlan_mlme_get_t2lm_negotiation_supported(struct wlan_objmgr_psoc * psoc)4037 wlan_mlme_get_t2lm_negotiation_supported(struct wlan_objmgr_psoc *psoc) 4038 { 4039 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4040 4041 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4042 if (!mlme_obj) 4043 return T2LM_NEGOTIATION_DISABLED; 4044 4045 return mlme_obj->cfg.gen.t2lm_negotiation_support; 4046 } 4047 4048 QDF_STATUS wlan_mlme_set_t2lm_negotiation_supported(struct wlan_objmgr_psoc * psoc,uint8_t value)4049 wlan_mlme_set_t2lm_negotiation_supported(struct wlan_objmgr_psoc *psoc, 4050 uint8_t value) 4051 { 4052 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4053 4054 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4055 if (!mlme_obj) 4056 return QDF_STATUS_E_FAILURE; 4057 4058 if (value > T2LM_NEGOTIATION_MAX) { 4059 mlme_err("Invalid value %d", value); 4060 return QDF_STATUS_E_INVAL; 4061 } 4062 4063 mlme_obj->cfg.gen.t2lm_negotiation_support = value; 4064 4065 return QDF_STATUS_SUCCESS; 4066 } 4067 4068 uint8_t wlan_mlme_get_eht_mld_id(struct wlan_objmgr_psoc * psoc)4069 wlan_mlme_get_eht_mld_id(struct wlan_objmgr_psoc *psoc) 4070 { 4071 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4072 4073 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4074 if (!mlme_obj) 4075 return 0; 4076 4077 return mlme_obj->cfg.gen.mld_id; 4078 } 4079 4080 QDF_STATUS wlan_mlme_set_eht_mld_id(struct wlan_objmgr_psoc * psoc,uint8_t value)4081 wlan_mlme_set_eht_mld_id(struct wlan_objmgr_psoc *psoc, 4082 uint8_t value) 4083 { 4084 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4085 4086 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4087 if (!mlme_obj) 4088 return QDF_STATUS_E_FAILURE; 4089 4090 mlme_obj->cfg.gen.mld_id = value; 4091 4092 return QDF_STATUS_SUCCESS; 4093 } 4094 #endif 4095 4096 QDF_STATUS wlan_mlme_set_btm_abridge_flag(struct wlan_objmgr_psoc * psoc,bool value)4097 wlan_mlme_set_btm_abridge_flag(struct wlan_objmgr_psoc *psoc, 4098 bool value) 4099 { 4100 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4101 4102 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4103 if (!mlme_obj) 4104 return QDF_STATUS_E_FAILURE; 4105 4106 mlme_obj->cfg.btm.abridge_flag = value; 4107 4108 return QDF_STATUS_SUCCESS; 4109 } 4110 4111 bool wlan_mlme_get_btm_abridge_flag(struct wlan_objmgr_psoc * psoc)4112 wlan_mlme_get_btm_abridge_flag(struct wlan_objmgr_psoc *psoc) 4113 { 4114 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4115 4116 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4117 if (!mlme_obj) 4118 return false; 4119 4120 return mlme_obj->cfg.btm.abridge_flag; 4121 } 4122 4123 QDF_STATUS wlan_mlme_cfg_set_vht_chan_width(struct wlan_objmgr_psoc * psoc,uint8_t value)4124 wlan_mlme_cfg_set_vht_chan_width(struct wlan_objmgr_psoc *psoc, uint8_t value) 4125 { 4126 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4127 4128 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4129 if (!mlme_obj) 4130 return QDF_STATUS_E_FAILURE; 4131 4132 mlme_obj->cfg.vht_caps.vht_cap_info.supp_chan_width = value; 4133 if (value == VHT_CAP_160_AND_80P80_SUPP || 4134 value == VHT_CAP_160_SUPP) { 4135 mlme_obj->cfg.vht_caps.vht_cap_info.vht_extended_nss_bw_cap = 1; 4136 mlme_obj->cfg.vht_caps.vht_cap_info.extended_nss_bw_supp = 0; 4137 } 4138 4139 return QDF_STATUS_SUCCESS; 4140 } 4141 4142 QDF_STATUS wlan_mlme_cfg_get_vht_chan_width(struct wlan_objmgr_psoc * psoc,uint8_t * value)4143 wlan_mlme_cfg_get_vht_chan_width(struct wlan_objmgr_psoc *psoc, uint8_t *value) 4144 { 4145 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4146 4147 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4148 if (!mlme_obj) 4149 return QDF_STATUS_E_FAILURE; 4150 4151 *value = mlme_obj->cfg.vht_caps.vht_cap_info.supp_chan_width; 4152 4153 return QDF_STATUS_SUCCESS; 4154 } 4155 wlan_mlme_cfg_set_vht_ldpc_coding_cap(struct wlan_objmgr_psoc * psoc,bool value)4156 QDF_STATUS wlan_mlme_cfg_set_vht_ldpc_coding_cap(struct wlan_objmgr_psoc *psoc, 4157 bool value) 4158 { 4159 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4160 4161 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4162 if (!mlme_obj) 4163 return QDF_STATUS_E_FAILURE; 4164 4165 mlme_obj->cfg.vht_caps.vht_cap_info.ldpc_coding_cap = value; 4166 4167 return QDF_STATUS_SUCCESS; 4168 } 4169 4170 QDF_STATUS wlan_mlme_cfg_set_short_gi_160_mhz(struct wlan_objmgr_psoc * psoc,bool value)4171 wlan_mlme_cfg_set_short_gi_160_mhz(struct wlan_objmgr_psoc *psoc, 4172 bool value) 4173 { 4174 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4175 4176 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4177 if (!mlme_obj) 4178 return QDF_STATUS_E_FAILURE; 4179 4180 mlme_obj->cfg.vht_caps.vht_cap_info.short_gi_160mhz = value; 4181 4182 return QDF_STATUS_SUCCESS; 4183 } 4184 4185 QDF_STATUS wlan_mlme_cfg_get_short_gi_160_mhz(struct wlan_objmgr_psoc * psoc,bool * value)4186 wlan_mlme_cfg_get_short_gi_160_mhz(struct wlan_objmgr_psoc *psoc, bool *value) 4187 { 4188 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4189 4190 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4191 if (!mlme_obj) 4192 return QDF_STATUS_E_FAILURE; 4193 4194 *value = mlme_obj->cfg.vht_caps.vht_cap_info.short_gi_160mhz; 4195 4196 return QDF_STATUS_SUCCESS; 4197 } 4198 4199 QDF_STATUS wlan_mlme_cfg_get_vht_tx_stbc(struct wlan_objmgr_psoc * psoc,bool * value)4200 wlan_mlme_cfg_get_vht_tx_stbc(struct wlan_objmgr_psoc *psoc, bool *value) 4201 { 4202 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4203 4204 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4205 if (!mlme_obj) 4206 return QDF_STATUS_E_FAILURE; 4207 4208 *value = mlme_obj->cfg.vht_caps.vht_cap_info.tx_stbc; 4209 4210 return QDF_STATUS_SUCCESS; 4211 } 4212 4213 QDF_STATUS wlan_mlme_cfg_get_vht_rx_stbc(struct wlan_objmgr_psoc * psoc,bool * value)4214 wlan_mlme_cfg_get_vht_rx_stbc(struct wlan_objmgr_psoc *psoc, bool *value) 4215 { 4216 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4217 4218 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4219 if (!mlme_obj) 4220 return QDF_STATUS_E_FAILURE; 4221 4222 *value = mlme_obj->cfg.vht_caps.vht_cap_info.rx_stbc; 4223 4224 return QDF_STATUS_SUCCESS; 4225 } 4226 4227 QDF_STATUS wlan_mlme_cfg_set_vht_tx_bfee_ant_supp(struct wlan_objmgr_psoc * psoc,uint8_t value)4228 wlan_mlme_cfg_set_vht_tx_bfee_ant_supp(struct wlan_objmgr_psoc *psoc, 4229 uint8_t value) 4230 { 4231 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4232 4233 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4234 if (!mlme_obj) 4235 return QDF_STATUS_E_FAILURE; 4236 4237 mlme_obj->cfg.vht_caps.vht_cap_info.tx_bfee_ant_supp = value; 4238 4239 return QDF_STATUS_SUCCESS; 4240 } 4241 4242 QDF_STATUS wlan_mlme_cfg_get_vht_tx_bfee_ant_supp(struct wlan_objmgr_psoc * psoc,uint8_t * value)4243 wlan_mlme_cfg_get_vht_tx_bfee_ant_supp(struct wlan_objmgr_psoc *psoc, 4244 uint8_t *value) 4245 { 4246 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4247 4248 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4249 if (!mlme_obj) 4250 return QDF_STATUS_E_FAILURE; 4251 4252 *value = mlme_obj->cfg.vht_caps.vht_cap_info.tx_bfee_ant_supp; 4253 4254 return QDF_STATUS_SUCCESS; 4255 } 4256 wlan_mlme_cfg_get_vht_rx_mcs_map(struct wlan_objmgr_psoc * psoc,uint32_t * value)4257 QDF_STATUS wlan_mlme_cfg_get_vht_rx_mcs_map(struct wlan_objmgr_psoc *psoc, 4258 uint32_t *value) 4259 { 4260 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4261 4262 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4263 if (!mlme_obj) 4264 return QDF_STATUS_E_FAILURE; 4265 4266 *value = mlme_obj->cfg.vht_caps.vht_cap_info.rx_mcs_map; 4267 4268 return QDF_STATUS_SUCCESS; 4269 } 4270 wlan_mlme_cfg_set_vht_rx_mcs_map(struct wlan_objmgr_psoc * psoc,uint32_t value)4271 QDF_STATUS wlan_mlme_cfg_set_vht_rx_mcs_map(struct wlan_objmgr_psoc *psoc, 4272 uint32_t value) 4273 { 4274 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4275 4276 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4277 if (!mlme_obj) 4278 return QDF_STATUS_E_FAILURE; 4279 4280 mlme_obj->cfg.vht_caps.vht_cap_info.rx_mcs_map = value; 4281 4282 return QDF_STATUS_SUCCESS; 4283 } 4284 wlan_mlme_cfg_get_vht_tx_mcs_map(struct wlan_objmgr_psoc * psoc,uint32_t * value)4285 QDF_STATUS wlan_mlme_cfg_get_vht_tx_mcs_map(struct wlan_objmgr_psoc *psoc, 4286 uint32_t *value) 4287 { 4288 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4289 4290 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4291 if (!mlme_obj) 4292 return QDF_STATUS_E_FAILURE; 4293 4294 *value = mlme_obj->cfg.vht_caps.vht_cap_info.tx_mcs_map; 4295 4296 return QDF_STATUS_SUCCESS; 4297 } 4298 wlan_mlme_cfg_set_vht_tx_mcs_map(struct wlan_objmgr_psoc * psoc,uint32_t value)4299 QDF_STATUS wlan_mlme_cfg_set_vht_tx_mcs_map(struct wlan_objmgr_psoc *psoc, 4300 uint32_t value) 4301 { 4302 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4303 4304 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4305 if (!mlme_obj) 4306 return QDF_STATUS_E_FAILURE; 4307 4308 mlme_obj->cfg.vht_caps.vht_cap_info.tx_mcs_map = value; 4309 4310 return QDF_STATUS_SUCCESS; 4311 } 4312 4313 QDF_STATUS wlan_mlme_cfg_set_vht_rx_supp_data_rate(struct wlan_objmgr_psoc * psoc,uint32_t value)4314 wlan_mlme_cfg_set_vht_rx_supp_data_rate(struct wlan_objmgr_psoc *psoc, 4315 uint32_t value) 4316 { 4317 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4318 4319 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4320 if (!mlme_obj) 4321 return QDF_STATUS_E_FAILURE; 4322 4323 mlme_obj->cfg.vht_caps.vht_cap_info.rx_supp_data_rate = value; 4324 4325 return QDF_STATUS_SUCCESS; 4326 } 4327 4328 QDF_STATUS wlan_mlme_cfg_set_vht_tx_supp_data_rate(struct wlan_objmgr_psoc * psoc,uint32_t value)4329 wlan_mlme_cfg_set_vht_tx_supp_data_rate(struct wlan_objmgr_psoc *psoc, 4330 uint32_t value) 4331 { 4332 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4333 4334 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4335 if (!mlme_obj) 4336 return QDF_STATUS_E_FAILURE; 4337 4338 mlme_obj->cfg.vht_caps.vht_cap_info.tx_supp_data_rate = value; 4339 4340 return QDF_STATUS_SUCCESS; 4341 } 4342 4343 QDF_STATUS wlan_mlme_cfg_get_vht_basic_mcs_set(struct wlan_objmgr_psoc * psoc,uint32_t * value)4344 wlan_mlme_cfg_get_vht_basic_mcs_set(struct wlan_objmgr_psoc *psoc, 4345 uint32_t *value) 4346 { 4347 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4348 4349 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4350 if (!mlme_obj) 4351 return QDF_STATUS_E_FAILURE; 4352 4353 *value = mlme_obj->cfg.vht_caps.vht_cap_info.basic_mcs_set; 4354 4355 return QDF_STATUS_SUCCESS; 4356 } 4357 4358 QDF_STATUS wlan_mlme_cfg_set_vht_basic_mcs_set(struct wlan_objmgr_psoc * psoc,uint32_t value)4359 wlan_mlme_cfg_set_vht_basic_mcs_set(struct wlan_objmgr_psoc *psoc, 4360 uint32_t value) 4361 { 4362 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4363 4364 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4365 if (!mlme_obj) 4366 return QDF_STATUS_E_FAILURE; 4367 4368 mlme_obj->cfg.vht_caps.vht_cap_info.basic_mcs_set = value; 4369 4370 return QDF_STATUS_SUCCESS; 4371 } 4372 4373 QDF_STATUS wlan_mlme_get_vht_enable_tx_bf(struct wlan_objmgr_psoc * psoc,bool * value)4374 wlan_mlme_get_vht_enable_tx_bf(struct wlan_objmgr_psoc *psoc, bool *value) 4375 { 4376 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4377 4378 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4379 if (!mlme_obj) 4380 return QDF_STATUS_E_FAILURE; 4381 4382 *value = mlme_obj->cfg.vht_caps.vht_cap_info.su_bformee; 4383 4384 return QDF_STATUS_SUCCESS; 4385 } 4386 4387 QDF_STATUS wlan_mlme_get_vht_tx_su_beamformer(struct wlan_objmgr_psoc * psoc,bool * value)4388 wlan_mlme_get_vht_tx_su_beamformer(struct wlan_objmgr_psoc *psoc, bool *value) 4389 { 4390 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4391 4392 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4393 if (!mlme_obj) 4394 return QDF_STATUS_E_FAILURE; 4395 4396 *value = mlme_obj->cfg.vht_caps.vht_cap_info.su_bformer; 4397 4398 return QDF_STATUS_SUCCESS; 4399 } 4400 4401 QDF_STATUS wlan_mlme_get_vht_channel_width(struct wlan_objmgr_psoc * psoc,uint8_t * value)4402 wlan_mlme_get_vht_channel_width(struct wlan_objmgr_psoc *psoc, uint8_t *value) 4403 { 4404 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4405 4406 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4407 if (!mlme_obj) 4408 return QDF_STATUS_E_FAILURE; 4409 4410 *value = mlme_obj->cfg.vht_caps.vht_cap_info.channel_width; 4411 4412 return QDF_STATUS_SUCCESS; 4413 } 4414 4415 4416 QDF_STATUS wlan_mlme_get_vht_rx_mcs_8_9(struct wlan_objmgr_psoc * psoc,uint8_t * value)4417 wlan_mlme_get_vht_rx_mcs_8_9(struct wlan_objmgr_psoc *psoc, uint8_t *value) 4418 { 4419 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4420 4421 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4422 if (!mlme_obj) 4423 return QDF_STATUS_E_FAILURE; 4424 4425 *value = mlme_obj->cfg.vht_caps.vht_cap_info.rx_mcs; 4426 4427 return QDF_STATUS_SUCCESS; 4428 } 4429 4430 QDF_STATUS wlan_mlme_get_vht_tx_mcs_8_9(struct wlan_objmgr_psoc * psoc,uint8_t * value)4431 wlan_mlme_get_vht_tx_mcs_8_9(struct wlan_objmgr_psoc *psoc, uint8_t *value) 4432 { 4433 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4434 4435 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4436 if (!mlme_obj) 4437 return QDF_STATUS_E_FAILURE; 4438 4439 *value = mlme_obj->cfg.vht_caps.vht_cap_info.tx_mcs; 4440 4441 return QDF_STATUS_SUCCESS; 4442 } 4443 4444 QDF_STATUS wlan_mlme_get_vht_rx_mcs_2x2(struct wlan_objmgr_psoc * psoc,uint8_t * value)4445 wlan_mlme_get_vht_rx_mcs_2x2(struct wlan_objmgr_psoc *psoc, uint8_t *value) 4446 { 4447 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4448 4449 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4450 if (!mlme_obj) 4451 return QDF_STATUS_E_FAILURE; 4452 4453 *value = mlme_obj->cfg.vht_caps.vht_cap_info.rx_mcs2x2; 4454 4455 return QDF_STATUS_SUCCESS; 4456 } 4457 4458 QDF_STATUS wlan_mlme_get_vht_tx_mcs_2x2(struct wlan_objmgr_psoc * psoc,uint8_t * value)4459 wlan_mlme_get_vht_tx_mcs_2x2(struct wlan_objmgr_psoc *psoc, uint8_t *value) 4460 { 4461 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4462 4463 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4464 if (!mlme_obj) 4465 return QDF_STATUS_E_FAILURE; 4466 4467 *value = mlme_obj->cfg.vht_caps.vht_cap_info.tx_mcs2x2; 4468 4469 return QDF_STATUS_SUCCESS; 4470 } 4471 4472 QDF_STATUS wlan_mlme_get_vht20_mcs9(struct wlan_objmgr_psoc * psoc,bool * value)4473 wlan_mlme_get_vht20_mcs9(struct wlan_objmgr_psoc *psoc, bool *value) 4474 { 4475 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4476 4477 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4478 if (!mlme_obj) 4479 return QDF_STATUS_E_FAILURE; 4480 4481 *value = mlme_obj->cfg.vht_caps.vht_cap_info.enable_vht20_mcs9; 4482 4483 return QDF_STATUS_SUCCESS; 4484 } 4485 4486 QDF_STATUS wlan_mlme_get_indoor_support_for_nan(struct wlan_objmgr_psoc * psoc,bool * value)4487 wlan_mlme_get_indoor_support_for_nan(struct wlan_objmgr_psoc *psoc, 4488 bool *value) 4489 { 4490 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4491 4492 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4493 if (!mlme_obj) { 4494 *value = false; 4495 mlme_legacy_err("Failed to get MLME Obj"); 4496 return QDF_STATUS_E_INVAL; 4497 } 4498 4499 *value = mlme_obj->cfg.reg.enable_nan_on_indoor_channels; 4500 4501 return QDF_STATUS_SUCCESS; 4502 } 4503 4504 QDF_STATUS wlan_mlme_get_srd_master_mode_for_vdev(struct wlan_objmgr_psoc * psoc,enum QDF_OPMODE vdev_opmode,bool * value)4505 wlan_mlme_get_srd_master_mode_for_vdev(struct wlan_objmgr_psoc *psoc, 4506 enum QDF_OPMODE vdev_opmode, 4507 bool *value) 4508 { 4509 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4510 4511 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4512 if (!mlme_obj) { 4513 *value = false; 4514 mlme_legacy_err("Failed to get MLME Obj"); 4515 return QDF_STATUS_E_INVAL; 4516 } 4517 4518 switch (vdev_opmode) { 4519 case QDF_SAP_MODE: 4520 *value = mlme_obj->cfg.reg.etsi_srd_chan_in_master_mode & 4521 MLME_SRD_MASTER_MODE_SAP; 4522 break; 4523 case QDF_P2P_GO_MODE: 4524 *value = mlme_obj->cfg.reg.etsi_srd_chan_in_master_mode & 4525 MLME_SRD_MASTER_MODE_P2P_GO; 4526 break; 4527 case QDF_NAN_DISC_MODE: 4528 *value = mlme_obj->cfg.reg.etsi_srd_chan_in_master_mode & 4529 MLME_SRD_MASTER_MODE_NAN; 4530 break; 4531 default: 4532 mlme_legacy_err("Unexpected opmode %d", vdev_opmode); 4533 *value = false; 4534 } 4535 4536 return QDF_STATUS_SUCCESS; 4537 } 4538 4539 QDF_STATUS wlan_mlme_get_enable_dynamic_nss_chains_cfg(struct wlan_objmgr_psoc * psoc,bool * value)4540 wlan_mlme_get_enable_dynamic_nss_chains_cfg(struct wlan_objmgr_psoc *psoc, 4541 bool *value) 4542 { 4543 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4544 4545 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4546 if (!mlme_obj) 4547 return QDF_STATUS_E_FAILURE; 4548 4549 *value = mlme_obj->cfg.nss_chains_ini_cfg.enable_dynamic_nss_chains_cfg; 4550 4551 return QDF_STATUS_SUCCESS; 4552 } 4553 4554 QDF_STATUS wlan_mlme_get_restart_sap_on_dynamic_nss_chains_cfg(struct wlan_objmgr_psoc * psoc,bool * value)4555 wlan_mlme_get_restart_sap_on_dynamic_nss_chains_cfg( 4556 struct wlan_objmgr_psoc *psoc, 4557 bool *value) 4558 { 4559 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4560 4561 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4562 if (!mlme_obj) 4563 return QDF_STATUS_E_FAILURE; 4564 4565 *value = 4566 mlme_obj->cfg.nss_chains_ini_cfg.restart_sap_on_dyn_nss_chains_cfg; 4567 4568 return QDF_STATUS_SUCCESS; 4569 } 4570 4571 QDF_STATUS wlan_mlme_cfg_get_dynamic_nss_chains_support(struct wlan_objmgr_psoc * psoc,bool * value)4572 wlan_mlme_cfg_get_dynamic_nss_chains_support(struct wlan_objmgr_psoc *psoc, 4573 bool *value) 4574 { 4575 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4576 4577 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4578 if (!mlme_obj) 4579 return QDF_STATUS_E_FAILURE; 4580 4581 *value = mlme_obj->cfg.dynamic_nss_chains_support; 4582 4583 return QDF_STATUS_SUCCESS; 4584 } 4585 4586 QDF_STATUS wlan_mlme_cfg_set_dynamic_nss_chains_support(struct wlan_objmgr_psoc * psoc,bool value)4587 wlan_mlme_cfg_set_dynamic_nss_chains_support(struct wlan_objmgr_psoc *psoc, 4588 bool value) 4589 { 4590 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4591 4592 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4593 if (!mlme_obj) 4594 return QDF_STATUS_E_FAILURE; 4595 4596 mlme_obj->cfg.dynamic_nss_chains_support = value; 4597 4598 return QDF_STATUS_SUCCESS; 4599 } 4600 4601 QDF_STATUS wlan_mlme_get_vht_enable2x2(struct wlan_objmgr_psoc * psoc,bool * value)4602 wlan_mlme_get_vht_enable2x2(struct wlan_objmgr_psoc *psoc, bool *value) 4603 { 4604 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4605 4606 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4607 if (!mlme_obj) 4608 return QDF_STATUS_E_FAILURE; 4609 4610 *value = mlme_obj->cfg.vht_caps.vht_cap_info.enable2x2; 4611 4612 return QDF_STATUS_SUCCESS; 4613 } 4614 4615 QDF_STATUS wlan_mlme_get_force_sap_enabled(struct wlan_objmgr_psoc * psoc,bool * value)4616 wlan_mlme_get_force_sap_enabled(struct wlan_objmgr_psoc *psoc, bool *value) 4617 { 4618 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4619 4620 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4621 if (!mlme_obj) 4622 return QDF_STATUS_E_FAILURE; 4623 4624 *value = mlme_obj->cfg.acs.force_sap_start; 4625 4626 return QDF_STATUS_SUCCESS; 4627 } 4628 4629 QDF_STATUS wlan_mlme_set_vht_enable2x2(struct wlan_objmgr_psoc * psoc,bool value)4630 wlan_mlme_set_vht_enable2x2(struct wlan_objmgr_psoc *psoc, bool value) 4631 { 4632 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4633 4634 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4635 if (!mlme_obj) 4636 return QDF_STATUS_E_FAILURE; 4637 4638 mlme_obj->cfg.vht_caps.vht_cap_info.enable2x2 = value; 4639 4640 return QDF_STATUS_SUCCESS; 4641 } 4642 4643 QDF_STATUS wlan_mlme_get_vht_enable_paid(struct wlan_objmgr_psoc * psoc,bool * value)4644 wlan_mlme_get_vht_enable_paid(struct wlan_objmgr_psoc *psoc, bool *value) 4645 { 4646 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4647 4648 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4649 if (!mlme_obj) 4650 return QDF_STATUS_E_FAILURE; 4651 4652 *value = mlme_obj->cfg.vht_caps.vht_cap_info.enable_paid; 4653 4654 return QDF_STATUS_SUCCESS; 4655 } 4656 4657 QDF_STATUS wlan_mlme_get_vht_enable_gid(struct wlan_objmgr_psoc * psoc,bool * value)4658 wlan_mlme_get_vht_enable_gid(struct wlan_objmgr_psoc *psoc, bool *value) 4659 { 4660 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4661 4662 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4663 if (!mlme_obj) 4664 return QDF_STATUS_E_FAILURE; 4665 4666 *value = mlme_obj->cfg.vht_caps.vht_cap_info.enable_gid; 4667 4668 return QDF_STATUS_SUCCESS; 4669 } 4670 4671 QDF_STATUS wlan_mlme_get_vht_for_24ghz(struct wlan_objmgr_psoc * psoc,bool * value)4672 wlan_mlme_get_vht_for_24ghz(struct wlan_objmgr_psoc *psoc, bool *value) 4673 { 4674 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4675 4676 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4677 if (!mlme_obj) 4678 return QDF_STATUS_E_FAILURE; 4679 4680 *value = mlme_obj->cfg.vht_caps.vht_cap_info.b24ghz_band; 4681 4682 return QDF_STATUS_SUCCESS; 4683 } 4684 4685 QDF_STATUS wlan_mlme_set_vht_for_24ghz(struct wlan_objmgr_psoc * psoc,bool value)4686 wlan_mlme_set_vht_for_24ghz(struct wlan_objmgr_psoc *psoc, bool value) 4687 { 4688 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4689 4690 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4691 if (!mlme_obj) 4692 return QDF_STATUS_E_FAILURE; 4693 4694 mlme_obj->cfg.vht_caps.vht_cap_info.b24ghz_band = value; 4695 4696 return QDF_STATUS_SUCCESS; 4697 } 4698 4699 QDF_STATUS wlan_mlme_get_vendor_vht_for_24ghz(struct wlan_objmgr_psoc * psoc,bool * value)4700 wlan_mlme_get_vendor_vht_for_24ghz(struct wlan_objmgr_psoc *psoc, bool *value) 4701 { 4702 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4703 4704 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4705 if (!mlme_obj) 4706 return QDF_STATUS_E_FAILURE; 4707 4708 *value = mlme_obj->cfg.vht_caps.vht_cap_info.vendor_24ghz_band; 4709 4710 return QDF_STATUS_SUCCESS; 4711 } 4712 4713 QDF_STATUS mlme_update_vht_cap(struct wlan_objmgr_psoc * psoc,struct wma_tgt_vht_cap * cfg)4714 mlme_update_vht_cap(struct wlan_objmgr_psoc *psoc, struct wma_tgt_vht_cap *cfg) 4715 { 4716 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4717 struct mlme_vht_capabilities_info *vht_cap_info; 4718 uint32_t value = 0; 4719 bool hw_rx_ldpc_enabled; 4720 4721 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4722 if (!mlme_obj) 4723 return QDF_STATUS_E_FAILURE; 4724 4725 vht_cap_info = &mlme_obj->cfg.vht_caps.vht_cap_info; 4726 4727 /* 4728 * VHT max MPDU length: 4729 * override if user configured value is too high 4730 * that the target cannot support 4731 */ 4732 if (vht_cap_info->ampdu_len > cfg->vht_max_mpdu) 4733 vht_cap_info->ampdu_len = cfg->vht_max_mpdu; 4734 if (vht_cap_info->ampdu_len >= 1) 4735 mlme_obj->cfg.ht_caps.ht_cap_info.maximal_amsdu_size = 1; 4736 value = (CFG_VHT_BASIC_MCS_SET_STADEF & VHT_MCS_1x1) | 4737 vht_cap_info->basic_mcs_set; 4738 if (vht_cap_info->enable2x2) 4739 value = (value & VHT_MCS_2x2) | (vht_cap_info->rx_mcs2x2 << 2); 4740 vht_cap_info->basic_mcs_set = value; 4741 4742 value = (CFG_VHT_RX_MCS_MAP_STADEF & VHT_MCS_1x1) | 4743 vht_cap_info->rx_mcs; 4744 4745 if (vht_cap_info->enable2x2) 4746 value = (value & VHT_MCS_2x2) | (vht_cap_info->rx_mcs2x2 << 2); 4747 vht_cap_info->rx_mcs_map = value; 4748 4749 value = (CFG_VHT_TX_MCS_MAP_STADEF & VHT_MCS_1x1) | 4750 vht_cap_info->tx_mcs; 4751 if (vht_cap_info->enable2x2) 4752 value = (value & VHT_MCS_2x2) | (vht_cap_info->tx_mcs2x2 << 2); 4753 vht_cap_info->tx_mcs_map = value; 4754 4755 /* Set HW RX LDPC capability */ 4756 hw_rx_ldpc_enabled = !!cfg->vht_rx_ldpc; 4757 if (vht_cap_info->ldpc_coding_cap && !hw_rx_ldpc_enabled) 4758 vht_cap_info->ldpc_coding_cap = hw_rx_ldpc_enabled; 4759 4760 /* set the Guard interval 80MHz */ 4761 if (vht_cap_info->short_gi_80mhz && !cfg->vht_short_gi_80) 4762 vht_cap_info->short_gi_80mhz = cfg->vht_short_gi_80; 4763 4764 /* Set VHT TX/RX STBC cap */ 4765 if (vht_cap_info->enable2x2) { 4766 if (vht_cap_info->tx_stbc && !cfg->vht_tx_stbc) 4767 vht_cap_info->tx_stbc = cfg->vht_tx_stbc; 4768 4769 if (vht_cap_info->rx_stbc && !cfg->vht_rx_stbc) 4770 vht_cap_info->rx_stbc = cfg->vht_rx_stbc; 4771 } else { 4772 vht_cap_info->tx_stbc = 0; 4773 vht_cap_info->rx_stbc = 0; 4774 } 4775 4776 /* Set VHT SU Beamformer cap */ 4777 if (vht_cap_info->su_bformer && !cfg->vht_su_bformer) 4778 vht_cap_info->su_bformer = cfg->vht_su_bformer; 4779 4780 /* check and update SU BEAMFORMEE capabality */ 4781 if (vht_cap_info->su_bformee && !cfg->vht_su_bformee) 4782 vht_cap_info->su_bformee = cfg->vht_su_bformee; 4783 4784 /* Set VHT MU Beamformer cap */ 4785 if (vht_cap_info->mu_bformer && !cfg->vht_mu_bformer) 4786 vht_cap_info->mu_bformer = cfg->vht_mu_bformer; 4787 4788 /* Set VHT MU Beamformee cap */ 4789 if (vht_cap_info->enable_mu_bformee && !cfg->vht_mu_bformee) 4790 vht_cap_info->enable_mu_bformee = cfg->vht_mu_bformee; 4791 4792 /* 4793 * VHT max AMPDU len exp: 4794 * override if user configured value is too high 4795 * that the target cannot support. 4796 * Even though Rome publish ampdu_len=7, it can 4797 * only support 4 because of some h/w bug. 4798 */ 4799 if (vht_cap_info->ampdu_len_exponent > cfg->vht_max_ampdu_len_exp) 4800 vht_cap_info->ampdu_len_exponent = cfg->vht_max_ampdu_len_exp; 4801 4802 /* Set VHT TXOP PS CAP */ 4803 if (vht_cap_info->txop_ps && !cfg->vht_txop_ps) 4804 vht_cap_info->txop_ps = cfg->vht_txop_ps; 4805 4806 /* set the Guard interval 160MHz */ 4807 if (vht_cap_info->short_gi_160mhz && !cfg->vht_short_gi_160) 4808 vht_cap_info->short_gi_160mhz = cfg->vht_short_gi_160; 4809 4810 if (cfg_get(psoc, CFG_ENABLE_VHT_MCS_10_11)) 4811 vht_cap_info->vht_mcs_10_11_supp = cfg->vht_mcs_10_11_supp; 4812 4813 mlme_legacy_debug("vht_mcs_10_11_supp %d", 4814 vht_cap_info->vht_mcs_10_11_supp); 4815 4816 return QDF_STATUS_SUCCESS; 4817 } 4818 mlme_update_nss_vht_cap(struct wlan_objmgr_psoc * psoc)4819 QDF_STATUS mlme_update_nss_vht_cap(struct wlan_objmgr_psoc *psoc) 4820 { 4821 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4822 struct mlme_vht_capabilities_info *vht_cap_info; 4823 uint32_t temp = 0; 4824 4825 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4826 if (!mlme_obj) 4827 return QDF_STATUS_E_FAILURE; 4828 4829 vht_cap_info = &mlme_obj->cfg.vht_caps.vht_cap_info; 4830 4831 temp = vht_cap_info->basic_mcs_set; 4832 temp = (temp & 0xFFFC) | vht_cap_info->rx_mcs; 4833 if (vht_cap_info->enable2x2) 4834 temp = (temp & 0xFFF3) | (vht_cap_info->rx_mcs2x2 << 2); 4835 else 4836 temp |= 0x000C; 4837 4838 vht_cap_info->basic_mcs_set = temp; 4839 4840 temp = vht_cap_info->rx_mcs_map; 4841 temp = (temp & 0xFFFC) | vht_cap_info->rx_mcs; 4842 if (vht_cap_info->enable2x2) 4843 temp = (temp & 0xFFF3) | (vht_cap_info->rx_mcs2x2 << 2); 4844 else 4845 temp |= 0x000C; 4846 4847 vht_cap_info->rx_mcs_map = temp; 4848 4849 temp = vht_cap_info->tx_mcs_map; 4850 temp = (temp & 0xFFFC) | vht_cap_info->tx_mcs; 4851 if (vht_cap_info->enable2x2) 4852 temp = (temp & 0xFFF3) | (vht_cap_info->tx_mcs2x2 << 2); 4853 else 4854 temp |= 0x000C; 4855 4856 vht_cap_info->tx_mcs_map = temp; 4857 4858 return QDF_STATUS_SUCCESS; 4859 } 4860 4861 #ifdef WLAN_FEATURE_11BE mlme_get_bss_11be_allowed(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * bssid,uint8_t * ie_data,uint32_t ie_length)4862 bool mlme_get_bss_11be_allowed(struct wlan_objmgr_psoc *psoc, 4863 struct qdf_mac_addr *bssid, 4864 uint8_t *ie_data, 4865 uint32_t ie_length) 4866 { 4867 struct action_oui_search_attr search_attr; 4868 4869 if (wlan_action_oui_is_empty(psoc, ACTION_OUI_11BE_OUI_ALLOW)) 4870 return true; 4871 4872 qdf_mem_zero(&search_attr, sizeof(search_attr)); 4873 search_attr.ie_data = ie_data; 4874 search_attr.ie_length = ie_length; 4875 if (wlan_action_oui_search(psoc, &search_attr, 4876 ACTION_OUI_11BE_OUI_ALLOW)) 4877 return true; 4878 4879 mlme_legacy_debug("AP not in 11be oui allow list "QDF_MAC_ADDR_FMT, 4880 QDF_MAC_ADDR_REF(bssid->bytes)); 4881 4882 return false; 4883 } 4884 wlan_mlme_get_oem_eht_mlo_config(struct wlan_objmgr_psoc * psoc,uint32_t * oem_eht_cfg)4885 QDF_STATUS wlan_mlme_get_oem_eht_mlo_config(struct wlan_objmgr_psoc *psoc, 4886 uint32_t *oem_eht_cfg) 4887 { 4888 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4889 4890 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4891 if (!mlme_obj) 4892 return QDF_STATUS_E_FAILURE; 4893 4894 *oem_eht_cfg = mlme_obj->cfg.gen.oem_eht_mlo_crypto_bitmap; 4895 4896 return QDF_STATUS_SUCCESS; 4897 } 4898 #endif 4899 wlan_mlme_is_sap_uapsd_enabled(struct wlan_objmgr_psoc * psoc,bool * value)4900 QDF_STATUS wlan_mlme_is_sap_uapsd_enabled(struct wlan_objmgr_psoc *psoc, 4901 bool *value) 4902 { 4903 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4904 4905 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4906 if (!mlme_obj) 4907 return QDF_STATUS_E_FAILURE; 4908 4909 *value = mlme_obj->cfg.qos_mlme_params.sap_uapsd_enabled; 4910 4911 return QDF_STATUS_SUCCESS; 4912 } 4913 wlan_mlme_get_dtim_selection_diversity(struct wlan_objmgr_psoc * psoc,uint32_t * dtim_selection_div)4914 QDF_STATUS wlan_mlme_get_dtim_selection_diversity(struct wlan_objmgr_psoc *psoc, 4915 uint32_t *dtim_selection_div) 4916 { 4917 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4918 4919 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4920 if (!mlme_obj) { 4921 *dtim_selection_div = cfg_default(CFG_DTIM_SELECTION_DIVERSITY); 4922 return QDF_STATUS_E_FAILURE; 4923 } 4924 4925 *dtim_selection_div = mlme_obj->cfg.ps_params.dtim_selection_diversity; 4926 4927 return QDF_STATUS_SUCCESS; 4928 } 4929 wlan_mlme_get_bmps_min_listen_interval(struct wlan_objmgr_psoc * psoc,uint32_t * value)4930 QDF_STATUS wlan_mlme_get_bmps_min_listen_interval(struct wlan_objmgr_psoc *psoc, 4931 uint32_t *value) 4932 { 4933 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4934 4935 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4936 if (!mlme_obj) { 4937 *value = cfg_default(CFG_BMPS_MINIMUM_LI); 4938 return QDF_STATUS_E_FAILURE; 4939 } 4940 4941 *value = mlme_obj->cfg.ps_params.bmps_min_listen_interval; 4942 4943 return QDF_STATUS_SUCCESS; 4944 } 4945 wlan_mlme_get_bmps_max_listen_interval(struct wlan_objmgr_psoc * psoc,uint32_t * value)4946 QDF_STATUS wlan_mlme_get_bmps_max_listen_interval(struct wlan_objmgr_psoc *psoc, 4947 uint32_t *value) 4948 { 4949 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4950 4951 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4952 if (!mlme_obj) { 4953 *value = cfg_default(CFG_BMPS_MAXIMUM_LI); 4954 return QDF_STATUS_E_FAILURE; 4955 } 4956 4957 *value = mlme_obj->cfg.ps_params.bmps_max_listen_interval; 4958 4959 return QDF_STATUS_SUCCESS; 4960 } 4961 wlan_mlme_set_sap_uapsd_flag(struct wlan_objmgr_psoc * psoc,bool value)4962 QDF_STATUS wlan_mlme_set_sap_uapsd_flag(struct wlan_objmgr_psoc *psoc, 4963 bool value) 4964 { 4965 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4966 4967 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4968 if (!mlme_obj) 4969 return QDF_STATUS_E_FAILURE; 4970 4971 mlme_obj->cfg.qos_mlme_params.sap_uapsd_enabled &= value; 4972 4973 return QDF_STATUS_SUCCESS; 4974 } 4975 wlan_mlme_get_rrm_enabled(struct wlan_objmgr_psoc * psoc,bool * value)4976 QDF_STATUS wlan_mlme_get_rrm_enabled(struct wlan_objmgr_psoc *psoc, 4977 bool *value) 4978 { 4979 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4980 4981 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4982 if (!mlme_obj) 4983 return QDF_STATUS_E_FAILURE; 4984 4985 *value = mlme_obj->cfg.rrm_config.rrm_enabled; 4986 return QDF_STATUS_SUCCESS; 4987 } 4988 wlan_mlme_get_auto_bmps_timer_value(struct wlan_objmgr_psoc * psoc,uint32_t * value)4989 QDF_STATUS wlan_mlme_get_auto_bmps_timer_value(struct wlan_objmgr_psoc *psoc, 4990 uint32_t *value) 4991 { 4992 struct wlan_mlme_psoc_ext_obj *mlme_obj; 4993 4994 mlme_obj = mlme_get_psoc_ext_obj(psoc); 4995 if (!mlme_obj) { 4996 *value = cfg_default(CFG_AUTO_BMPS_ENABLE_TIMER); 4997 return QDF_STATUS_E_FAILURE; 4998 } 4999 5000 *value = mlme_obj->cfg.ps_params.auto_bmps_timer_val; 5001 5002 return QDF_STATUS_SUCCESS; 5003 } 5004 wlan_mlme_is_bmps_enabled(struct wlan_objmgr_psoc * psoc,bool * value)5005 QDF_STATUS wlan_mlme_is_bmps_enabled(struct wlan_objmgr_psoc *psoc, 5006 bool *value) 5007 { 5008 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5009 5010 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5011 if (!mlme_obj) { 5012 *value = cfg_default(CFG_ENABLE_PS); 5013 return QDF_STATUS_E_FAILURE; 5014 } 5015 5016 *value = mlme_obj->cfg.ps_params.is_bmps_enabled; 5017 5018 return QDF_STATUS_SUCCESS; 5019 } 5020 wlan_mlme_is_imps_enabled(struct wlan_objmgr_psoc * psoc,bool * value)5021 QDF_STATUS wlan_mlme_is_imps_enabled(struct wlan_objmgr_psoc *psoc, 5022 bool *value) 5023 { 5024 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5025 5026 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5027 if (!mlme_obj) { 5028 *value = cfg_default(CFG_ENABLE_IMPS); 5029 return QDF_STATUS_E_FAILURE; 5030 } 5031 5032 *value = mlme_obj->cfg.ps_params.is_imps_enabled; 5033 5034 return QDF_STATUS_SUCCESS; 5035 } 5036 wlan_mlme_override_bmps_imps(struct wlan_objmgr_psoc * psoc)5037 QDF_STATUS wlan_mlme_override_bmps_imps(struct wlan_objmgr_psoc *psoc) 5038 { 5039 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5040 5041 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5042 if (!mlme_obj) 5043 return QDF_STATUS_E_FAILURE; 5044 5045 mlme_obj->cfg.ps_params.is_imps_enabled = 0; 5046 mlme_obj->cfg.ps_params.is_bmps_enabled = 0; 5047 5048 return QDF_STATUS_SUCCESS; 5049 } 5050 wlan_mlme_get_wps_uuid(struct wlan_mlme_wps_params * wps_params,uint8_t * data)5051 void wlan_mlme_get_wps_uuid(struct wlan_mlme_wps_params *wps_params, 5052 uint8_t *data) 5053 { 5054 qdf_size_t len = wps_params->wps_uuid.len; 5055 5056 wlan_mlme_get_cfg_str(data, &wps_params->wps_uuid, &len); 5057 } 5058 5059 QDF_STATUS wlan_mlme_get_self_gen_frm_pwr(struct wlan_objmgr_psoc * psoc,uint32_t * value)5060 wlan_mlme_get_self_gen_frm_pwr(struct wlan_objmgr_psoc *psoc, 5061 uint32_t *value) 5062 { 5063 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5064 5065 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5066 if (!mlme_obj) { 5067 *value = cfg_default(CFG_SELF_GEN_FRM_PWR); 5068 mlme_legacy_err("Failed to get MLME Obj"); 5069 return QDF_STATUS_E_FAILURE; 5070 } 5071 5072 *value = mlme_obj->cfg.reg.self_gen_frm_pwr; 5073 5074 return QDF_STATUS_SUCCESS; 5075 } 5076 5077 QDF_STATUS wlan_mlme_get_4way_hs_offload(struct wlan_objmgr_psoc * psoc,uint32_t * value)5078 wlan_mlme_get_4way_hs_offload(struct wlan_objmgr_psoc *psoc, uint32_t *value) 5079 { 5080 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5081 5082 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5083 if (!mlme_obj) { 5084 *value = cfg_default(CFG_DISABLE_4WAY_HS_OFFLOAD); 5085 mlme_legacy_err("Failed to get MLME Obj"); 5086 return QDF_STATUS_E_FAILURE; 5087 } 5088 5089 *value = mlme_obj->cfg.gen.disable_4way_hs_offload; 5090 5091 return QDF_STATUS_SUCCESS; 5092 } 5093 5094 QDF_STATUS wlan_mlme_get_bmiss_skip_full_scan_value(struct wlan_objmgr_psoc * psoc,bool * value)5095 wlan_mlme_get_bmiss_skip_full_scan_value(struct wlan_objmgr_psoc *psoc, 5096 bool *value) 5097 { 5098 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5099 5100 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5101 if (!mlme_obj) { 5102 *value = cfg_default(CFG_BMISS_SKIP_FULL_SCAN); 5103 mlme_legacy_err("Failed to get MLME Obj"); 5104 return QDF_STATUS_E_FAILURE; 5105 } 5106 5107 *value = mlme_obj->cfg.gen.bmiss_skip_full_scan; 5108 5109 return QDF_STATUS_SUCCESS; 5110 } 5111 mlme_get_peer_phymode(struct wlan_objmgr_psoc * psoc,uint8_t * mac,enum wlan_phymode * peer_phymode)5112 QDF_STATUS mlme_get_peer_phymode(struct wlan_objmgr_psoc *psoc, uint8_t *mac, 5113 enum wlan_phymode *peer_phymode) 5114 { 5115 struct wlan_objmgr_peer *peer; 5116 5117 peer = wlan_objmgr_get_peer_by_mac(psoc, mac, WLAN_MLME_NB_ID); 5118 if (!peer) { 5119 mlme_legacy_err("peer object is null"); 5120 return QDF_STATUS_E_NULL_VALUE; 5121 } 5122 5123 *peer_phymode = wlan_peer_get_phymode(peer); 5124 wlan_objmgr_peer_release_ref(peer, WLAN_MLME_NB_ID); 5125 5126 return QDF_STATUS_SUCCESS; 5127 } 5128 mlme_set_tgt_wpa3_roam_cap(struct wlan_objmgr_psoc * psoc,uint32_t akm_bitmap)5129 QDF_STATUS mlme_set_tgt_wpa3_roam_cap(struct wlan_objmgr_psoc *psoc, 5130 uint32_t akm_bitmap) 5131 { 5132 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5133 5134 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5135 if (!mlme_obj) 5136 return QDF_STATUS_E_FAILURE; 5137 5138 mlme_obj->cfg.lfr.fw_akm_bitmap |= akm_bitmap; 5139 5140 return QDF_STATUS_SUCCESS; 5141 } 5142 5143 QDF_STATUS wlan_mlme_get_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc * psoc,bool * disabled)5144 wlan_mlme_get_ignore_fw_reg_offload_ind(struct wlan_objmgr_psoc *psoc, 5145 bool *disabled) 5146 { 5147 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5148 5149 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5150 5151 if (!mlme_obj) 5152 return QDF_STATUS_E_FAILURE; 5153 5154 *disabled = mlme_obj->cfg.reg.ignore_fw_reg_offload_ind; 5155 return QDF_STATUS_SUCCESS; 5156 } 5157 mlme_get_roam_status_str(uint32_t roam_status)5158 char *mlme_get_roam_status_str(uint32_t roam_status) 5159 { 5160 switch (roam_status) { 5161 case 0: 5162 return "SUCCESS"; 5163 case 1: 5164 return "FAILED"; 5165 case 2: 5166 return "NO ROAM"; 5167 default: 5168 return "UNKNOWN"; 5169 } 5170 } 5171 mlme_get_roam_trigger_str(uint32_t roam_scan_trigger)5172 char *mlme_get_roam_trigger_str(uint32_t roam_scan_trigger) 5173 { 5174 switch (roam_scan_trigger) { 5175 case WMI_ROAM_TRIGGER_REASON_PER: 5176 return "PER"; 5177 case WMI_ROAM_TRIGGER_REASON_BMISS: 5178 return "BEACON MISS"; 5179 case WMI_ROAM_TRIGGER_REASON_LOW_RSSI: 5180 return "LOW RSSI"; 5181 case WMI_ROAM_TRIGGER_REASON_HIGH_RSSI: 5182 return "HIGH RSSI"; 5183 case WMI_ROAM_TRIGGER_REASON_PERIODIC: 5184 return "PERIODIC SCAN"; 5185 case WMI_ROAM_TRIGGER_REASON_MAWC: 5186 return "MAWC"; 5187 case WMI_ROAM_TRIGGER_REASON_DENSE: 5188 return "DENSE ENVIRONMENT"; 5189 case WMI_ROAM_TRIGGER_REASON_BACKGROUND: 5190 return "BACKGROUND SCAN"; 5191 case WMI_ROAM_TRIGGER_REASON_FORCED: 5192 return "FORCED SCAN"; 5193 case WMI_ROAM_TRIGGER_REASON_BTM: 5194 return "BTM TRIGGER"; 5195 case WMI_ROAM_TRIGGER_REASON_UNIT_TEST: 5196 return "TEST COMMAND"; 5197 case WMI_ROAM_TRIGGER_REASON_BSS_LOAD: 5198 return "HIGH BSS LOAD"; 5199 case WMI_ROAM_TRIGGER_REASON_DEAUTH: 5200 return "DEAUTH RECEIVED"; 5201 case WMI_ROAM_TRIGGER_REASON_IDLE: 5202 return "IDLE STATE SCAN"; 5203 case WMI_ROAM_TRIGGER_REASON_STA_KICKOUT: 5204 return "STA KICKOUT"; 5205 case WMI_ROAM_TRIGGER_REASON_ESS_RSSI: 5206 return "ESS RSSI"; 5207 case WMI_ROAM_TRIGGER_REASON_WTC_BTM: 5208 return "WTC BTM"; 5209 case WMI_ROAM_TRIGGER_REASON_NONE: 5210 return "NONE"; 5211 case WMI_ROAM_TRIGGER_REASON_PMK_TIMEOUT: 5212 return "PMK Expired"; 5213 case WMI_ROAM_TRIGGER_REASON_BTC: 5214 return "BTC TRIGGER"; 5215 default: 5216 return "UNKNOWN"; 5217 } 5218 } 5219 mlme_get_converted_timestamp(uint32_t timestamp,char * time)5220 void mlme_get_converted_timestamp(uint32_t timestamp, char *time) 5221 { 5222 uint32_t hr, mins, secs; 5223 5224 secs = timestamp / 1000; 5225 mins = secs / 60; 5226 hr = mins / 60; 5227 qdf_snprint(time, TIME_STRING_LEN, "[%02d:%02d:%02d.%06u]", 5228 (hr % 24), (mins % 60), (secs % 60), 5229 (timestamp % 1000) * 1000); 5230 } 5231 5232 #if defined(WLAN_SAE_SINGLE_PMK) && defined(WLAN_FEATURE_ROAM_OFFLOAD) wlan_mlme_set_sae_single_pmk_bss_cap(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,bool val)5233 void wlan_mlme_set_sae_single_pmk_bss_cap(struct wlan_objmgr_psoc *psoc, 5234 uint8_t vdev_id, bool val) 5235 { 5236 struct mlme_legacy_priv *mlme_priv; 5237 struct wlan_objmgr_vdev *vdev; 5238 5239 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id, 5240 WLAN_MLME_OBJMGR_ID); 5241 5242 if (!vdev) { 5243 mlme_err("get vdev failed"); 5244 return; 5245 } 5246 5247 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 5248 if (!mlme_priv) { 5249 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID); 5250 mlme_legacy_err("vdev legacy private object is NULL"); 5251 return; 5252 } 5253 5254 mlme_priv->mlme_roam.sae_single_pmk.sae_single_pmk_ap = val; 5255 5256 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID); 5257 } 5258 wlan_mlme_update_sae_single_pmk(struct wlan_objmgr_vdev * vdev,struct mlme_pmk_info * sae_single_pmk)5259 void wlan_mlme_update_sae_single_pmk(struct wlan_objmgr_vdev *vdev, 5260 struct mlme_pmk_info *sae_single_pmk) 5261 { 5262 struct mlme_legacy_priv *mlme_priv; 5263 int32_t keymgmt; 5264 bool is_sae_connection = false; 5265 5266 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 5267 if (!mlme_priv) { 5268 mlme_legacy_err("vdev legacy private object is NULL"); 5269 return; 5270 } 5271 5272 keymgmt = wlan_crypto_get_param(vdev, WLAN_CRYPTO_PARAM_KEY_MGMT); 5273 if (keymgmt < 0) { 5274 mlme_legacy_err("Invalid mgmt cipher"); 5275 return; 5276 } 5277 5278 if (QDF_HAS_PARAM(keymgmt, WLAN_CRYPTO_KEY_MGMT_SAE) || 5279 QDF_HAS_PARAM(keymgmt, WLAN_CRYPTO_KEY_MGMT_SAE_EXT_KEY)) 5280 is_sae_connection = true; 5281 5282 mlme_legacy_debug("SAE_SPMK: single_pmk_ap:%d, is_sae_connection:%d, pmk_len:%d", 5283 mlme_priv->mlme_roam.sae_single_pmk.sae_single_pmk_ap, 5284 is_sae_connection, sae_single_pmk->pmk_len); 5285 5286 if (mlme_priv->mlme_roam.sae_single_pmk.sae_single_pmk_ap && 5287 is_sae_connection) 5288 mlme_priv->mlme_roam.sae_single_pmk.pmk_info = *sae_single_pmk; 5289 } 5290 wlan_mlme_is_sae_single_pmk_enabled(struct wlan_objmgr_psoc * psoc)5291 bool wlan_mlme_is_sae_single_pmk_enabled(struct wlan_objmgr_psoc *psoc) 5292 { 5293 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5294 5295 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5296 if (!mlme_obj) 5297 return cfg_default(CFG_SAE_SINGLE_PMK); 5298 5299 return mlme_obj->cfg.lfr.sae_single_pmk_feature_enabled; 5300 } 5301 wlan_mlme_get_sae_single_pmk_info(struct wlan_objmgr_vdev * vdev,struct wlan_mlme_sae_single_pmk * pmksa)5302 void wlan_mlme_get_sae_single_pmk_info(struct wlan_objmgr_vdev *vdev, 5303 struct wlan_mlme_sae_single_pmk *pmksa) 5304 { 5305 struct mlme_legacy_priv *mlme_priv; 5306 struct mlme_pmk_info *pmk_info; 5307 5308 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 5309 if (!mlme_priv) { 5310 mlme_legacy_err("vdev legacy private object is NULL"); 5311 return; 5312 } 5313 5314 pmk_info = &mlme_priv->mlme_roam.sae_single_pmk.pmk_info; 5315 5316 pmksa->sae_single_pmk_ap = 5317 mlme_priv->mlme_roam.sae_single_pmk.sae_single_pmk_ap; 5318 pmksa->pmk_info.spmk_timeout_period = pmk_info->spmk_timeout_period; 5319 pmksa->pmk_info.spmk_timestamp = pmk_info->spmk_timestamp; 5320 5321 if (pmk_info->pmk_len) { 5322 qdf_mem_copy(pmksa->pmk_info.pmk, pmk_info->pmk, 5323 pmk_info->pmk_len); 5324 pmksa->pmk_info.pmk_len = pmk_info->pmk_len; 5325 return; 5326 } 5327 5328 qdf_mem_zero(pmksa->pmk_info.pmk, sizeof(*pmksa->pmk_info.pmk)); 5329 pmksa->pmk_info.pmk_len = 0; 5330 } 5331 wlan_mlme_clear_sae_single_pmk_info(struct wlan_objmgr_vdev * vdev,struct mlme_pmk_info * pmk_recv)5332 void wlan_mlme_clear_sae_single_pmk_info(struct wlan_objmgr_vdev *vdev, 5333 struct mlme_pmk_info *pmk_recv) 5334 { 5335 struct mlme_legacy_priv *mlme_priv; 5336 struct wlan_mlme_sae_single_pmk *sae_single_pmk; 5337 5338 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 5339 if (!mlme_priv) { 5340 mlme_legacy_err("vdev legacy private object is NULL"); 5341 return; 5342 } 5343 5344 sae_single_pmk = &mlme_priv->mlme_roam.sae_single_pmk; 5345 5346 if (!pmk_recv) { 5347 /* Process flush pmk cmd */ 5348 mlme_legacy_debug("Flush sae_single_pmk info"); 5349 qdf_mem_zero(&sae_single_pmk->pmk_info, 5350 sizeof(sae_single_pmk->pmk_info)); 5351 } else if (pmk_recv->pmk_len != sae_single_pmk->pmk_info.pmk_len) { 5352 mlme_legacy_debug("Invalid pmk len"); 5353 return; 5354 } else if (!qdf_mem_cmp(&sae_single_pmk->pmk_info.pmk, pmk_recv->pmk, 5355 pmk_recv->pmk_len)) { 5356 /* Process delete pmk cmd */ 5357 mlme_legacy_debug("Clear sae_single_pmk info"); 5358 qdf_mem_zero(&sae_single_pmk->pmk_info, 5359 sizeof(sae_single_pmk->pmk_info)); 5360 } 5361 } 5362 #endif 5363 mlme_get_roam_fail_reason_str(enum wlan_roam_failure_reason_code result)5364 char *mlme_get_roam_fail_reason_str(enum wlan_roam_failure_reason_code result) 5365 { 5366 switch (result) { 5367 case ROAM_FAIL_REASON_NO_SCAN_START: 5368 return "SCAN NOT STARTED"; 5369 case ROAM_FAIL_REASON_NO_AP_FOUND: 5370 return "NO AP FOUND"; 5371 case ROAM_FAIL_REASON_NO_CAND_AP_FOUND: 5372 return "NO CANDIDATE FOUND"; 5373 case ROAM_FAIL_REASON_HOST: 5374 return "HOST ABORTED"; 5375 case ROAM_FAIL_REASON_AUTH_SEND: 5376 return "Send AUTH Failed"; 5377 case ROAM_FAIL_REASON_AUTH_RECV: 5378 return "Received AUTH with FAILURE Status"; 5379 case ROAM_FAIL_REASON_NO_AUTH_RESP: 5380 return "No Auth response from AP"; 5381 case ROAM_FAIL_REASON_REASSOC_SEND: 5382 return "Send Re-assoc request failed"; 5383 case ROAM_FAIL_REASON_REASSOC_RECV: 5384 return "Received Re-Assoc resp with Failure status"; 5385 case ROAM_FAIL_REASON_NO_REASSOC_RESP: 5386 return "No Re-assoc response from AP"; 5387 case ROAM_FAIL_REASON_EAPOL_TIMEOUT: 5388 return "EAPOL M1 timed out"; 5389 case ROAM_FAIL_REASON_MLME: 5390 return "MLME error"; 5391 case ROAM_FAIL_REASON_INTERNAL_ABORT: 5392 return "Fw aborted roam"; 5393 case ROAM_FAIL_REASON_SCAN_START: 5394 return "Unable to start roam scan"; 5395 case ROAM_FAIL_REASON_AUTH_NO_ACK: 5396 return "No ACK for Auth req"; 5397 case ROAM_FAIL_REASON_AUTH_INTERNAL_DROP: 5398 return "Auth req dropped internally"; 5399 case ROAM_FAIL_REASON_REASSOC_NO_ACK: 5400 return "No ACK for Re-assoc req"; 5401 case ROAM_FAIL_REASON_REASSOC_INTERNAL_DROP: 5402 return "Re-assoc dropped internally"; 5403 case ROAM_FAIL_REASON_EAPOL_M2_SEND: 5404 return "Unable to send M2 frame"; 5405 case ROAM_FAIL_REASON_EAPOL_M2_INTERNAL_DROP: 5406 return "M2 Frame dropped internally"; 5407 case ROAM_FAIL_REASON_EAPOL_M2_NO_ACK: 5408 return "No ACK for M2 frame"; 5409 case ROAM_FAIL_REASON_EAPOL_M3_TIMEOUT: 5410 return "EAPOL M3 timed out"; 5411 case ROAM_FAIL_REASON_EAPOL_M4_SEND: 5412 return "Unable to send M4 frame"; 5413 case ROAM_FAIL_REASON_EAPOL_M4_INTERNAL_DROP: 5414 return "M4 frame dropped internally"; 5415 case ROAM_FAIL_REASON_EAPOL_M4_NO_ACK: 5416 return "No ACK for M4 frame"; 5417 case ROAM_FAIL_REASON_NO_SCAN_FOR_FINAL_BMISS: 5418 return "No scan on final BMISS"; 5419 case ROAM_FAIL_REASON_DISCONNECT: 5420 return "Disconnect received during handoff"; 5421 case ROAM_FAIL_REASON_SYNC: 5422 return "Previous roam sync pending"; 5423 case ROAM_FAIL_REASON_SAE_INVALID_PMKID: 5424 return "Reason assoc reject - invalid PMKID"; 5425 case ROAM_FAIL_REASON_SAE_PREAUTH_TIMEOUT: 5426 return "SAE preauth timed out"; 5427 case ROAM_FAIL_REASON_SAE_PREAUTH_FAIL: 5428 return "SAE preauth failed"; 5429 case ROAM_FAIL_REASON_UNABLE_TO_START_ROAM_HO: 5430 return "Start handoff failed- internal error"; 5431 case ROAM_FAIL_REASON_NO_AP_FOUND_AND_FINAL_BMISS_SENT: 5432 return "No AP found on final BMISS"; 5433 case ROAM_FAIL_REASON_NO_CAND_AP_FOUND_AND_FINAL_BMISS_SENT: 5434 return "No Candidate AP found on final BMISS"; 5435 case ROAM_FAIL_REASON_CURR_AP_STILL_OK: 5436 return "CURRENT AP STILL OK"; 5437 default: 5438 return "UNKNOWN"; 5439 } 5440 } 5441 mlme_get_sub_reason_str(enum roam_trigger_sub_reason sub_reason)5442 char *mlme_get_sub_reason_str(enum roam_trigger_sub_reason sub_reason) 5443 { 5444 switch (sub_reason) { 5445 case ROAM_TRIGGER_SUB_REASON_PERIODIC_TIMER: 5446 return "PERIODIC TIMER"; 5447 case ROAM_TRIGGER_SUB_REASON_LOW_RSSI_PERIODIC: 5448 return "LOW RSSI PERIODIC TIMER1"; 5449 case ROAM_TRIGGER_SUB_REASON_BTM_DI_TIMER: 5450 return "BTM DISASSOC IMMINENT TIMER"; 5451 case ROAM_TRIGGER_SUB_REASON_FULL_SCAN: 5452 return "FULL SCAN"; 5453 case ROAM_TRIGGER_SUB_REASON_CU_PERIODIC: 5454 return "CU PERIODIC Timer1"; 5455 case ROAM_TRIGGER_SUB_REASON_INACTIVITY_TIMER_LOW_RSSI: 5456 return "LOW RSSI INACTIVE TIMER"; 5457 case ROAM_TRIGGER_SUB_REASON_PERIODIC_TIMER_AFTER_INACTIVITY_CU: 5458 return "CU PERIODIC TIMER2"; 5459 case ROAM_TRIGGER_SUB_REASON_PERIODIC_TIMER_AFTER_INACTIVITY: 5460 return "LOW RSSI PERIODIC TIMER2"; 5461 case ROAM_TRIGGER_SUB_REASON_INACTIVITY_TIMER_CU: 5462 return "CU INACTIVITY TIMER"; 5463 default: 5464 return "NONE"; 5465 } 5466 } 5467 5468 QDF_STATUS wlan_mlme_get_mgmt_max_retry(struct wlan_objmgr_psoc * psoc,uint8_t * max_retry)5469 wlan_mlme_get_mgmt_max_retry(struct wlan_objmgr_psoc *psoc, 5470 uint8_t *max_retry) 5471 { 5472 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5473 5474 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5475 5476 if (!mlme_obj) { 5477 *max_retry = cfg_default(CFG_MGMT_RETRY_MAX); 5478 return QDF_STATUS_E_FAILURE; 5479 } 5480 5481 *max_retry = mlme_obj->cfg.gen.mgmt_retry_max; 5482 return QDF_STATUS_SUCCESS; 5483 } 5484 5485 QDF_STATUS wlan_mlme_get_mgmt_6ghz_rate_support(struct wlan_objmgr_psoc * psoc,bool * enable_he_mcs0_for_6ghz_mgmt)5486 wlan_mlme_get_mgmt_6ghz_rate_support(struct wlan_objmgr_psoc *psoc, 5487 bool *enable_he_mcs0_for_6ghz_mgmt) 5488 { 5489 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5490 5491 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5492 5493 if (!mlme_obj) { 5494 *enable_he_mcs0_for_6ghz_mgmt = 5495 cfg_default(CFG_ENABLE_HE_MCS0_MGMT_6GHZ); 5496 return QDF_STATUS_E_FAILURE; 5497 } 5498 5499 *enable_he_mcs0_for_6ghz_mgmt = 5500 mlme_obj->cfg.gen.enable_he_mcs0_for_6ghz_mgmt; 5501 return QDF_STATUS_SUCCESS; 5502 } 5503 5504 QDF_STATUS wlan_mlme_get_status_ring_buffer(struct wlan_objmgr_psoc * psoc,bool * enable_ring_buffer)5505 wlan_mlme_get_status_ring_buffer(struct wlan_objmgr_psoc *psoc, 5506 bool *enable_ring_buffer) 5507 { 5508 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5509 5510 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5511 5512 if (!mlme_obj) { 5513 *enable_ring_buffer = cfg_default(CFG_ENABLE_RING_BUFFER); 5514 return QDF_STATUS_E_FAILURE; 5515 } 5516 5517 *enable_ring_buffer = mlme_obj->cfg.gen.enable_ring_buffer; 5518 return QDF_STATUS_SUCCESS; 5519 } 5520 wlan_mlme_get_peer_unmap_conf(struct wlan_objmgr_psoc * psoc)5521 bool wlan_mlme_get_peer_unmap_conf(struct wlan_objmgr_psoc *psoc) 5522 { 5523 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5524 5525 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5526 if (!mlme_obj) 5527 return false; 5528 5529 return mlme_obj->cfg.gen.enable_peer_unmap_conf_support; 5530 } 5531 5532 #ifdef WLAN_FEATURE_ROAM_OFFLOAD 5533 QDF_STATUS wlan_mlme_get_roam_reason_vsie_status(struct wlan_objmgr_psoc * psoc,uint8_t * roam_reason_vsie_enable)5534 wlan_mlme_get_roam_reason_vsie_status(struct wlan_objmgr_psoc *psoc, 5535 uint8_t *roam_reason_vsie_enable) 5536 { 5537 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5538 5539 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5540 if (!mlme_obj) { 5541 *roam_reason_vsie_enable = 5542 cfg_default(CFG_ENABLE_ROAM_REASON_VSIE); 5543 return QDF_STATUS_E_FAILURE; 5544 } 5545 5546 *roam_reason_vsie_enable = mlme_obj->cfg.lfr.enable_roam_reason_vsie; 5547 return QDF_STATUS_SUCCESS; 5548 } 5549 5550 QDF_STATUS wlan_mlme_set_roam_reason_vsie_status(struct wlan_objmgr_psoc * psoc,uint8_t roam_reason_vsie_enable)5551 wlan_mlme_set_roam_reason_vsie_status(struct wlan_objmgr_psoc *psoc, 5552 uint8_t roam_reason_vsie_enable) 5553 { 5554 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5555 5556 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5557 if (!mlme_obj) 5558 return QDF_STATUS_E_FAILURE; 5559 5560 mlme_obj->cfg.lfr.enable_roam_reason_vsie = roam_reason_vsie_enable; 5561 return QDF_STATUS_SUCCESS; 5562 } 5563 wlan_mlme_get_roaming_triggers(struct wlan_objmgr_psoc * psoc)5564 uint32_t wlan_mlme_get_roaming_triggers(struct wlan_objmgr_psoc *psoc) 5565 { 5566 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5567 5568 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5569 if (!mlme_obj) 5570 return cfg_default(CFG_ROAM_TRIGGER_BITMAP); 5571 5572 return mlme_obj->cfg.lfr.roam_trigger_bitmap; 5573 } 5574 wlan_mlme_set_roaming_triggers(struct wlan_objmgr_psoc * psoc,uint32_t trigger_bitmap)5575 void wlan_mlme_set_roaming_triggers(struct wlan_objmgr_psoc *psoc, 5576 uint32_t trigger_bitmap) 5577 { 5578 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5579 5580 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5581 if (!mlme_obj) 5582 return; 5583 5584 mlme_obj->cfg.lfr.roam_trigger_bitmap = trigger_bitmap; 5585 } 5586 5587 QDF_STATUS wlan_mlme_get_roaming_offload(struct wlan_objmgr_psoc * psoc,bool * val)5588 wlan_mlme_get_roaming_offload(struct wlan_objmgr_psoc *psoc, 5589 bool *val) 5590 { 5591 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5592 5593 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5594 if (!mlme_obj) { 5595 *val = cfg_default(CFG_LFR3_ROAMING_OFFLOAD); 5596 return QDF_STATUS_E_INVAL; 5597 } 5598 5599 *val = mlme_obj->cfg.lfr.lfr3_roaming_offload; 5600 5601 return QDF_STATUS_SUCCESS; 5602 } 5603 5604 QDF_STATUS wlan_mlme_get_enable_disconnect_roam_offload(struct wlan_objmgr_psoc * psoc,bool * val)5605 wlan_mlme_get_enable_disconnect_roam_offload(struct wlan_objmgr_psoc *psoc, 5606 bool *val) 5607 { 5608 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5609 5610 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5611 if (!mlme_obj) { 5612 *val = cfg_default(CFG_LFR_ENABLE_DISCONNECT_ROAM); 5613 return QDF_STATUS_E_INVAL; 5614 } 5615 5616 *val = mlme_obj->cfg.lfr.enable_disconnect_roam_offload; 5617 5618 return QDF_STATUS_SUCCESS; 5619 } 5620 5621 QDF_STATUS wlan_mlme_get_enable_idle_roam(struct wlan_objmgr_psoc * psoc,bool * val)5622 wlan_mlme_get_enable_idle_roam(struct wlan_objmgr_psoc *psoc, bool *val) 5623 { 5624 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5625 5626 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5627 if (!mlme_obj) { 5628 *val = cfg_default(CFG_LFR_ENABLE_IDLE_ROAM); 5629 return QDF_STATUS_E_INVAL; 5630 } 5631 5632 *val = mlme_obj->cfg.lfr.enable_idle_roam; 5633 5634 return QDF_STATUS_SUCCESS; 5635 } 5636 5637 QDF_STATUS wlan_mlme_get_idle_roam_rssi_delta(struct wlan_objmgr_psoc * psoc,uint32_t * val)5638 wlan_mlme_get_idle_roam_rssi_delta(struct wlan_objmgr_psoc *psoc, uint32_t *val) 5639 { 5640 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5641 5642 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5643 if (!mlme_obj) { 5644 *val = cfg_default(CFG_LFR_IDLE_ROAM_RSSI_DELTA); 5645 return QDF_STATUS_E_INVAL; 5646 } 5647 5648 *val = mlme_obj->cfg.lfr.idle_roam_rssi_delta; 5649 5650 return QDF_STATUS_SUCCESS; 5651 } 5652 5653 QDF_STATUS wlan_mlme_get_roam_info_stats_num(struct wlan_objmgr_psoc * psoc,uint32_t * val)5654 wlan_mlme_get_roam_info_stats_num(struct wlan_objmgr_psoc *psoc, uint32_t *val) 5655 { 5656 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5657 5658 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5659 if (!mlme_obj) { 5660 *val = cfg_default(CFG_LFR3_ROAM_INFO_STATS_NUM); 5661 return QDF_STATUS_E_INVAL; 5662 } 5663 5664 *val = mlme_obj->cfg.lfr.roam_info_stats_num; 5665 5666 return QDF_STATUS_SUCCESS; 5667 } 5668 5669 QDF_STATUS wlan_mlme_get_idle_roam_inactive_time(struct wlan_objmgr_psoc * psoc,uint32_t * val)5670 wlan_mlme_get_idle_roam_inactive_time(struct wlan_objmgr_psoc *psoc, 5671 uint32_t *val) 5672 { 5673 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5674 5675 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5676 if (!mlme_obj) { 5677 *val = cfg_default(CFG_LFR_IDLE_ROAM_INACTIVE_TIME); 5678 return QDF_STATUS_E_INVAL; 5679 } 5680 5681 *val = mlme_obj->cfg.lfr.idle_roam_inactive_time; 5682 5683 return QDF_STATUS_SUCCESS; 5684 } 5685 5686 QDF_STATUS wlan_mlme_get_idle_data_packet_count(struct wlan_objmgr_psoc * psoc,uint32_t * val)5687 wlan_mlme_get_idle_data_packet_count(struct wlan_objmgr_psoc *psoc, 5688 uint32_t *val) 5689 { 5690 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5691 5692 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5693 if (!mlme_obj) { 5694 *val = cfg_default(CFG_LFR_IDLE_ROAM_PACKET_COUNT); 5695 return QDF_STATUS_E_INVAL; 5696 } 5697 5698 *val = mlme_obj->cfg.lfr.idle_data_packet_count; 5699 5700 return QDF_STATUS_SUCCESS; 5701 } 5702 5703 QDF_STATUS wlan_mlme_get_idle_roam_min_rssi(struct wlan_objmgr_psoc * psoc,uint32_t * val)5704 wlan_mlme_get_idle_roam_min_rssi(struct wlan_objmgr_psoc *psoc, uint32_t *val) 5705 { 5706 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5707 5708 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5709 if (!mlme_obj) { 5710 *val = cfg_default(CFG_LFR_IDLE_ROAM_MIN_RSSI); 5711 return QDF_STATUS_E_INVAL; 5712 } 5713 5714 *val = mlme_obj->cfg.lfr.idle_roam_min_rssi; 5715 5716 return QDF_STATUS_SUCCESS; 5717 } 5718 5719 QDF_STATUS wlan_mlme_get_idle_roam_band(struct wlan_objmgr_psoc * psoc,uint32_t * val)5720 wlan_mlme_get_idle_roam_band(struct wlan_objmgr_psoc *psoc, uint32_t *val) 5721 { 5722 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5723 5724 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5725 if (!mlme_obj) { 5726 *val = cfg_default(CFG_LFR_IDLE_ROAM_BAND); 5727 return QDF_STATUS_E_INVAL; 5728 } 5729 5730 *val = mlme_obj->cfg.lfr.idle_roam_band; 5731 5732 return QDF_STATUS_SUCCESS; 5733 } 5734 5735 QDF_STATUS wlan_mlme_get_self_bss_roam(struct wlan_objmgr_psoc * psoc,uint8_t * enable_self_bss_roam)5736 wlan_mlme_get_self_bss_roam(struct wlan_objmgr_psoc *psoc, 5737 uint8_t *enable_self_bss_roam) 5738 { 5739 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5740 5741 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5742 5743 if (!mlme_obj) { 5744 *enable_self_bss_roam = 5745 cfg_get(psoc, CFG_LFR3_ENABLE_SELF_BSS_ROAM); 5746 return QDF_STATUS_E_FAILURE; 5747 } 5748 5749 *enable_self_bss_roam = mlme_obj->cfg.lfr.enable_self_bss_roam; 5750 5751 return QDF_STATUS_SUCCESS; 5752 } 5753 #endif 5754 5755 QDF_STATUS wlan_mlme_get_peer_indicated_ch_width(struct wlan_objmgr_psoc * psoc,struct peer_oper_mode_event * data)5756 wlan_mlme_get_peer_indicated_ch_width(struct wlan_objmgr_psoc *psoc, 5757 struct peer_oper_mode_event *data) 5758 { 5759 struct wlan_objmgr_peer *peer; 5760 struct peer_mlme_priv_obj *peer_priv; 5761 QDF_STATUS status = QDF_STATUS_SUCCESS; 5762 5763 if (!data) { 5764 mlme_err("Data params is NULL"); 5765 return QDF_STATUS_E_INVAL; 5766 } 5767 5768 peer = wlan_objmgr_get_peer_by_mac(psoc, data->peer_mac_address.bytes, 5769 WLAN_MLME_NB_ID); 5770 if (!peer) { 5771 mlme_err("peer not found for mac: " QDF_MAC_ADDR_FMT, 5772 QDF_MAC_ADDR_REF(data->peer_mac_address.bytes)); 5773 return QDF_STATUS_E_NULL_VALUE; 5774 } 5775 5776 peer_priv = wlan_objmgr_peer_get_comp_private_obj(peer, 5777 WLAN_UMAC_COMP_MLME); 5778 if (!peer_priv) { 5779 mlme_err("peer priv not found for mac: " QDF_MAC_ADDR_FMT, 5780 QDF_MAC_ADDR_REF(peer->macaddr)); 5781 status = QDF_STATUS_E_NULL_VALUE; 5782 goto done; 5783 } 5784 5785 if (peer_priv->peer_ind_bw == CH_WIDTH_INVALID) { 5786 status = QDF_STATUS_E_INVAL; 5787 goto done; 5788 } 5789 5790 data->new_bw = peer_priv->peer_ind_bw; 5791 5792 done: 5793 wlan_objmgr_peer_release_ref(peer, WLAN_MLME_NB_ID); 5794 5795 return status; 5796 } 5797 5798 QDF_STATUS wlan_mlme_set_peer_indicated_ch_width(struct wlan_objmgr_psoc * psoc,struct peer_oper_mode_event * data)5799 wlan_mlme_set_peer_indicated_ch_width(struct wlan_objmgr_psoc *psoc, 5800 struct peer_oper_mode_event *data) 5801 { 5802 struct wlan_objmgr_peer *peer; 5803 struct peer_mlme_priv_obj *peer_priv; 5804 QDF_STATUS status = QDF_STATUS_SUCCESS; 5805 5806 if (!data) { 5807 mlme_err("Data params is NULL"); 5808 return QDF_STATUS_E_INVAL; 5809 } 5810 5811 peer = wlan_objmgr_get_peer_by_mac(psoc, data->peer_mac_address.bytes, 5812 WLAN_MLME_NB_ID); 5813 if (!peer) { 5814 mlme_err("peer not found for mac: " QDF_MAC_ADDR_FMT, 5815 QDF_MAC_ADDR_REF(data->peer_mac_address.bytes)); 5816 return QDF_STATUS_E_NULL_VALUE; 5817 } 5818 5819 peer_priv = wlan_objmgr_peer_get_comp_private_obj(peer, 5820 WLAN_UMAC_COMP_MLME); 5821 if (!peer_priv) { 5822 mlme_err("peer priv not found for mac: " QDF_MAC_ADDR_FMT, 5823 QDF_MAC_ADDR_REF(peer->macaddr)); 5824 status = QDF_STATUS_E_NULL_VALUE; 5825 goto done; 5826 } 5827 5828 peer_priv->peer_ind_bw = 5829 target_if_wmi_chan_width_to_phy_ch_width(data->new_bw); 5830 5831 done: 5832 wlan_objmgr_peer_release_ref(peer, WLAN_MLME_NB_ID); 5833 5834 return status; 5835 } 5836 5837 QDF_STATUS wlan_mlme_set_ft_over_ds(struct wlan_objmgr_psoc * psoc,uint8_t ft_over_ds_enable)5838 wlan_mlme_set_ft_over_ds(struct wlan_objmgr_psoc *psoc, 5839 uint8_t ft_over_ds_enable) 5840 { 5841 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5842 5843 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5844 if (!mlme_obj) 5845 return QDF_STATUS_E_FAILURE; 5846 5847 mlme_obj->cfg.lfr.enable_ft_over_ds = ft_over_ds_enable; 5848 return QDF_STATUS_SUCCESS; 5849 } 5850 5851 QDF_STATUS wlan_mlme_get_dfs_chan_ageout_time(struct wlan_objmgr_psoc * psoc,uint8_t * dfs_chan_ageout_time)5852 wlan_mlme_get_dfs_chan_ageout_time(struct wlan_objmgr_psoc *psoc, 5853 uint8_t *dfs_chan_ageout_time) 5854 { 5855 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5856 5857 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5858 5859 if (!mlme_obj) { 5860 *dfs_chan_ageout_time = 5861 cfg_default(CFG_DFS_CHAN_AGEOUT_TIME); 5862 return QDF_STATUS_E_FAILURE; 5863 } 5864 5865 *dfs_chan_ageout_time = mlme_obj->cfg.gen.dfs_chan_ageout_time; 5866 5867 return QDF_STATUS_SUCCESS; 5868 } 5869 5870 #ifdef WLAN_FEATURE_SAE 5871 5872 #define NUM_RETRY_BITS 3 5873 #define ROAM_AUTH_INDEX 2 5874 #define ASSOC_INDEX 1 5875 #define AUTH_INDEX 0 5876 #define MAX_RETRIES 2 5877 #define MAX_ROAM_AUTH_RETRIES 1 5878 #define MAX_AUTH_RETRIES 3 5879 5880 QDF_STATUS wlan_mlme_get_sae_assoc_retry_count(struct wlan_objmgr_psoc * psoc,uint8_t * retry_count)5881 wlan_mlme_get_sae_assoc_retry_count(struct wlan_objmgr_psoc *psoc, 5882 uint8_t *retry_count) 5883 { 5884 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5885 5886 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5887 5888 if (!mlme_obj) { 5889 *retry_count = 0; 5890 return QDF_STATUS_E_FAILURE; 5891 } 5892 5893 *retry_count = 5894 QDF_GET_BITS(mlme_obj->cfg.gen.sae_connect_retries, 5895 ASSOC_INDEX * NUM_RETRY_BITS, NUM_RETRY_BITS); 5896 5897 *retry_count = QDF_MIN(MAX_RETRIES, *retry_count); 5898 5899 return QDF_STATUS_SUCCESS; 5900 } 5901 5902 QDF_STATUS wlan_mlme_get_sae_auth_retry_count(struct wlan_objmgr_psoc * psoc,uint8_t * retry_count)5903 wlan_mlme_get_sae_auth_retry_count(struct wlan_objmgr_psoc *psoc, 5904 uint8_t *retry_count) 5905 { 5906 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5907 5908 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5909 5910 if (!mlme_obj) { 5911 *retry_count = 0; 5912 return QDF_STATUS_E_FAILURE; 5913 } 5914 5915 *retry_count = 5916 QDF_GET_BITS(mlme_obj->cfg.gen.sae_connect_retries, 5917 AUTH_INDEX * NUM_RETRY_BITS, NUM_RETRY_BITS); 5918 5919 *retry_count = QDF_MIN(MAX_AUTH_RETRIES, *retry_count); 5920 5921 return QDF_STATUS_SUCCESS; 5922 } 5923 5924 QDF_STATUS wlan_mlme_get_sae_roam_auth_retry_count(struct wlan_objmgr_psoc * psoc,uint8_t * retry_count)5925 wlan_mlme_get_sae_roam_auth_retry_count(struct wlan_objmgr_psoc *psoc, 5926 uint8_t *retry_count) 5927 { 5928 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5929 5930 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5931 5932 if (!mlme_obj) { 5933 *retry_count = 0; 5934 return QDF_STATUS_E_FAILURE; 5935 } 5936 5937 *retry_count = 5938 QDF_GET_BITS(mlme_obj->cfg.gen.sae_connect_retries, 5939 ROAM_AUTH_INDEX * NUM_RETRY_BITS, NUM_RETRY_BITS); 5940 5941 *retry_count = QDF_MIN(MAX_ROAM_AUTH_RETRIES, *retry_count); 5942 5943 return QDF_STATUS_SUCCESS; 5944 } 5945 5946 #endif 5947 5948 #ifdef WLAN_FEATURE_ROAM_OFFLOAD 5949 bool wlan_mlme_get_dual_sta_roaming_enabled(struct wlan_objmgr_psoc * psoc)5950 wlan_mlme_get_dual_sta_roaming_enabled(struct wlan_objmgr_psoc *psoc) 5951 { 5952 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5953 bool dual_sta_roaming_enabled; 5954 5955 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5956 5957 if (!mlme_obj) 5958 return cfg_default(CFG_ENABLE_DUAL_STA_ROAM_OFFLOAD); 5959 5960 dual_sta_roaming_enabled = 5961 mlme_obj->cfg.lfr.lfr3_roaming_offload && 5962 mlme_obj->cfg.lfr.lfr3_dual_sta_roaming_enabled && 5963 wlan_mlme_get_dual_sta_roam_support(psoc) && 5964 policy_mgr_is_hw_dbs_capable(psoc); 5965 5966 return dual_sta_roaming_enabled; 5967 } 5968 #endif 5969 5970 QDF_STATUS wlan_mlme_get_roam_scan_offload_enabled(struct wlan_objmgr_psoc * psoc,bool * val)5971 wlan_mlme_get_roam_scan_offload_enabled(struct wlan_objmgr_psoc *psoc, 5972 bool *val) 5973 { 5974 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5975 5976 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5977 if (!mlme_obj) { 5978 *val = cfg_default(CFG_LFR_ROAM_SCAN_OFFLOAD_ENABLED); 5979 return QDF_STATUS_E_INVAL; 5980 } 5981 5982 *val = mlme_obj->cfg.lfr.roam_scan_offload_enabled; 5983 5984 return QDF_STATUS_SUCCESS; 5985 } 5986 5987 QDF_STATUS wlan_mlme_get_roam_bmiss_final_bcnt(struct wlan_objmgr_psoc * psoc,uint8_t * val)5988 wlan_mlme_get_roam_bmiss_final_bcnt(struct wlan_objmgr_psoc *psoc, 5989 uint8_t *val) 5990 { 5991 struct wlan_mlme_psoc_ext_obj *mlme_obj; 5992 5993 mlme_obj = mlme_get_psoc_ext_obj(psoc); 5994 if (!mlme_obj) { 5995 *val = cfg_default(CFG_LFR_ROAM_BMISS_FINAL_BCNT); 5996 return QDF_STATUS_E_INVAL; 5997 } 5998 5999 *val = mlme_obj->cfg.lfr.roam_bmiss_final_bcnt; 6000 6001 return QDF_STATUS_SUCCESS; 6002 } 6003 6004 QDF_STATUS wlan_mlme_get_bmiss_timeout_on_wakeup(struct wlan_objmgr_psoc * psoc,uint8_t * val)6005 wlan_mlme_get_bmiss_timeout_on_wakeup(struct wlan_objmgr_psoc *psoc, 6006 uint8_t *val) 6007 { 6008 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6009 6010 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6011 if (!mlme_obj) { 6012 *val = cfg_default(CFG_LFR_BEACONLOSS_TIMEOUT_ON_WAKEUP); 6013 return QDF_STATUS_E_INVAL; 6014 } 6015 6016 *val = mlme_obj->cfg.lfr.beaconloss_timeout_onwakeup; 6017 6018 return QDF_STATUS_SUCCESS; 6019 } 6020 6021 QDF_STATUS wlan_mlme_get_bmiss_timeout_on_sleep(struct wlan_objmgr_psoc * psoc,uint8_t * val)6022 wlan_mlme_get_bmiss_timeout_on_sleep(struct wlan_objmgr_psoc *psoc, 6023 uint8_t *val) 6024 { 6025 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6026 6027 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6028 if (!mlme_obj) { 6029 *val = cfg_default(CFG_LFR_BEACONLOSS_TIMEOUT_ON_SLEEP); 6030 return QDF_STATUS_E_INVAL; 6031 } 6032 6033 *val = mlme_obj->cfg.lfr.beaconloss_timeout_onsleep; 6034 6035 return QDF_STATUS_SUCCESS; 6036 } 6037 6038 QDF_STATUS wlan_mlme_get_roam_bmiss_first_bcnt(struct wlan_objmgr_psoc * psoc,uint8_t * val)6039 wlan_mlme_get_roam_bmiss_first_bcnt(struct wlan_objmgr_psoc *psoc, 6040 uint8_t *val) 6041 { 6042 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6043 6044 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6045 if (!mlme_obj) { 6046 *val = cfg_default(CFG_LFR_ROAM_BMISS_FIRST_BCNT); 6047 return QDF_STATUS_E_INVAL; 6048 } 6049 6050 *val = mlme_obj->cfg.lfr.roam_bmiss_first_bcnt; 6051 6052 return QDF_STATUS_SUCCESS; 6053 } 6054 6055 #ifdef WLAN_ADAPTIVE_11R wlan_mlme_adaptive_11r_enabled(struct wlan_objmgr_psoc * psoc)6056 bool wlan_mlme_adaptive_11r_enabled(struct wlan_objmgr_psoc *psoc) 6057 { 6058 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6059 6060 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6061 if (!mlme_obj) 6062 return cfg_default(CFG_ADAPTIVE_11R); 6063 6064 return mlme_obj->cfg.lfr.enable_adaptive_11r; 6065 } 6066 #endif 6067 6068 QDF_STATUS wlan_mlme_get_mawc_enabled(struct wlan_objmgr_psoc * psoc,bool * val)6069 wlan_mlme_get_mawc_enabled(struct wlan_objmgr_psoc *psoc, bool *val) 6070 { 6071 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6072 6073 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6074 if (!mlme_obj) { 6075 *val = cfg_default(CFG_LFR_MAWC_FEATURE_ENABLED); 6076 return QDF_STATUS_E_INVAL; 6077 } 6078 6079 *val = mlme_obj->cfg.lfr.mawc_enabled; 6080 6081 return QDF_STATUS_SUCCESS; 6082 } 6083 6084 QDF_STATUS wlan_mlme_get_mawc_roam_enabled(struct wlan_objmgr_psoc * psoc,bool * val)6085 wlan_mlme_get_mawc_roam_enabled(struct wlan_objmgr_psoc *psoc, bool *val) 6086 { 6087 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6088 6089 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6090 if (!mlme_obj) { 6091 *val = cfg_default(CFG_LFR_MAWC_ROAM_ENABLED); 6092 return QDF_STATUS_E_INVAL; 6093 } 6094 6095 *val = mlme_obj->cfg.lfr.mawc_roam_enabled; 6096 6097 return QDF_STATUS_SUCCESS; 6098 } 6099 6100 QDF_STATUS wlan_mlme_get_mawc_roam_traffic_threshold(struct wlan_objmgr_psoc * psoc,uint32_t * val)6101 wlan_mlme_get_mawc_roam_traffic_threshold(struct wlan_objmgr_psoc *psoc, 6102 uint32_t *val) 6103 { 6104 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6105 6106 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6107 if (!mlme_obj) { 6108 *val = cfg_default(CFG_LFR_MAWC_ROAM_TRAFFIC_THRESHOLD); 6109 return QDF_STATUS_E_INVAL; 6110 } 6111 6112 *val = mlme_obj->cfg.lfr.mawc_roam_traffic_threshold; 6113 6114 return QDF_STATUS_SUCCESS; 6115 } 6116 6117 QDF_STATUS wlan_mlme_get_mawc_roam_ap_rssi_threshold(struct wlan_objmgr_psoc * psoc,uint32_t * val)6118 wlan_mlme_get_mawc_roam_ap_rssi_threshold(struct wlan_objmgr_psoc *psoc, 6119 uint32_t *val) 6120 { 6121 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6122 6123 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6124 if (!mlme_obj) { 6125 *val = cfg_default(CFG_LFR_MAWC_ROAM_AP_RSSI_THRESHOLD); 6126 return QDF_STATUS_E_INVAL; 6127 } 6128 6129 *val = mlme_obj->cfg.lfr.mawc_roam_ap_rssi_threshold; 6130 6131 return QDF_STATUS_SUCCESS; 6132 } 6133 6134 QDF_STATUS wlan_mlme_get_mawc_roam_rssi_high_adjust(struct wlan_objmgr_psoc * psoc,uint8_t * val)6135 wlan_mlme_get_mawc_roam_rssi_high_adjust(struct wlan_objmgr_psoc *psoc, 6136 uint8_t *val) 6137 { 6138 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6139 6140 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6141 if (!mlme_obj) { 6142 *val = cfg_default(CFG_LFR_MAWC_ROAM_RSSI_HIGH_ADJUST); 6143 return QDF_STATUS_E_INVAL; 6144 } 6145 6146 *val = mlme_obj->cfg.lfr.mawc_roam_rssi_high_adjust; 6147 6148 return QDF_STATUS_SUCCESS; 6149 } 6150 6151 QDF_STATUS wlan_mlme_get_mawc_roam_rssi_low_adjust(struct wlan_objmgr_psoc * psoc,uint8_t * val)6152 wlan_mlme_get_mawc_roam_rssi_low_adjust(struct wlan_objmgr_psoc *psoc, 6153 uint8_t *val) 6154 { 6155 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6156 6157 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6158 if (!mlme_obj) { 6159 *val = cfg_default(CFG_LFR_MAWC_ROAM_RSSI_LOW_ADJUST); 6160 return QDF_STATUS_E_INVAL; 6161 } 6162 6163 *val = mlme_obj->cfg.lfr.mawc_roam_rssi_low_adjust; 6164 6165 return QDF_STATUS_SUCCESS; 6166 } 6167 6168 QDF_STATUS wlan_mlme_get_bss_load_enabled(struct wlan_objmgr_psoc * psoc,bool * val)6169 wlan_mlme_get_bss_load_enabled(struct wlan_objmgr_psoc *psoc, bool *val) 6170 { 6171 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6172 6173 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6174 if (!mlme_obj) { 6175 *val = cfg_default(CFG_ENABLE_BSS_LOAD_TRIGGERED_ROAM); 6176 return QDF_STATUS_E_INVAL; 6177 } 6178 6179 *val = mlme_obj->cfg.lfr.bss_load_trig.enabled; 6180 6181 return QDF_STATUS_SUCCESS; 6182 } 6183 6184 QDF_STATUS wlan_mlme_get_bss_load_threshold(struct wlan_objmgr_psoc * psoc,uint32_t * val)6185 wlan_mlme_get_bss_load_threshold(struct wlan_objmgr_psoc *psoc, uint32_t *val) 6186 { 6187 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6188 6189 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6190 if (!mlme_obj) { 6191 *val = cfg_default(CFG_BSS_LOAD_THRESHOLD); 6192 return QDF_STATUS_E_INVAL; 6193 } 6194 6195 *val = mlme_obj->cfg.lfr.bss_load_trig.threshold; 6196 6197 return QDF_STATUS_SUCCESS; 6198 } 6199 6200 QDF_STATUS wlan_mlme_get_bss_load_sample_time(struct wlan_objmgr_psoc * psoc,uint32_t * val)6201 wlan_mlme_get_bss_load_sample_time(struct wlan_objmgr_psoc *psoc, 6202 uint32_t *val) 6203 { 6204 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6205 6206 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6207 if (!mlme_obj) { 6208 *val = cfg_default(CFG_BSS_LOAD_SAMPLE_TIME); 6209 return QDF_STATUS_E_INVAL; 6210 } 6211 6212 *val = mlme_obj->cfg.lfr.bss_load_trig.sample_time; 6213 6214 return QDF_STATUS_SUCCESS; 6215 } 6216 6217 QDF_STATUS wlan_mlme_get_bss_load_rssi_threshold_6ghz(struct wlan_objmgr_psoc * psoc,int32_t * val)6218 wlan_mlme_get_bss_load_rssi_threshold_6ghz(struct wlan_objmgr_psoc *psoc, 6219 int32_t *val) 6220 { 6221 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6222 6223 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6224 if (!mlme_obj) { 6225 *val = cfg_default(CFG_BSS_LOAD_TRIG_6G_RSSI_THRES); 6226 return QDF_STATUS_E_INVAL; 6227 } 6228 6229 *val = mlme_obj->cfg.lfr.bss_load_trig.rssi_threshold_6ghz; 6230 6231 return QDF_STATUS_SUCCESS; 6232 } 6233 6234 QDF_STATUS wlan_mlme_get_bss_load_rssi_threshold_5ghz(struct wlan_objmgr_psoc * psoc,int32_t * val)6235 wlan_mlme_get_bss_load_rssi_threshold_5ghz(struct wlan_objmgr_psoc *psoc, 6236 int32_t *val) 6237 { 6238 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6239 6240 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6241 if (!mlme_obj) { 6242 *val = cfg_default(CFG_BSS_LOAD_TRIG_5G_RSSI_THRES); 6243 return QDF_STATUS_E_INVAL; 6244 } 6245 6246 *val = mlme_obj->cfg.lfr.bss_load_trig.rssi_threshold_5ghz; 6247 6248 return QDF_STATUS_SUCCESS; 6249 } 6250 6251 QDF_STATUS wlan_mlme_get_bss_load_rssi_threshold_24ghz(struct wlan_objmgr_psoc * psoc,int32_t * val)6252 wlan_mlme_get_bss_load_rssi_threshold_24ghz(struct wlan_objmgr_psoc *psoc, 6253 int32_t *val) 6254 { 6255 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6256 6257 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6258 if (!mlme_obj) { 6259 *val = cfg_default(CFG_BSS_LOAD_TRIG_2G_RSSI_THRES); 6260 return QDF_STATUS_E_INVAL; 6261 } 6262 6263 *val = mlme_obj->cfg.lfr.bss_load_trig.rssi_threshold_24ghz; 6264 6265 return QDF_STATUS_SUCCESS; 6266 } 6267 6268 bool wlan_mlme_check_chan_param_has_dfs(struct wlan_objmgr_pdev * pdev,struct ch_params * ch_params,uint32_t chan_freq)6269 wlan_mlme_check_chan_param_has_dfs(struct wlan_objmgr_pdev *pdev, 6270 struct ch_params *ch_params, 6271 uint32_t chan_freq) 6272 { 6273 bool is_dfs = false; 6274 6275 if (ch_params->ch_width == CH_WIDTH_160MHZ) { 6276 wlan_reg_set_create_punc_bitmap(ch_params, true); 6277 if (wlan_reg_get_5g_bonded_channel_state_for_pwrmode(pdev, 6278 chan_freq, 6279 ch_params, 6280 REG_CURRENT_PWR_MODE) == 6281 CHANNEL_STATE_DFS) 6282 is_dfs = true; 6283 } else if (ch_params->ch_width == CH_WIDTH_80P80MHZ) { 6284 if (wlan_reg_get_channel_state_for_pwrmode( 6285 pdev, 6286 chan_freq, 6287 REG_CURRENT_PWR_MODE) == CHANNEL_STATE_DFS || 6288 wlan_reg_get_channel_state_for_pwrmode( 6289 pdev, 6290 ch_params->mhz_freq_seg1, 6291 REG_CURRENT_PWR_MODE) == CHANNEL_STATE_DFS) 6292 is_dfs = true; 6293 } else if (wlan_reg_is_dfs_for_freq(pdev, chan_freq)) { 6294 /*Indoor channels are also marked DFS, therefore 6295 * check if the channel has REGULATORY_CHAN_RADAR 6296 * channel flag to identify if the channel is DFS 6297 */ 6298 is_dfs = true; 6299 } 6300 6301 if (WLAN_REG_IS_6GHZ_CHAN_FREQ(chan_freq) || 6302 WLAN_REG_IS_24GHZ_CH_FREQ(chan_freq)) 6303 is_dfs = false; 6304 6305 return is_dfs; 6306 } 6307 6308 QDF_STATUS wlan_mlme_set_usr_disabled_roaming(struct wlan_objmgr_psoc * psoc,bool val)6309 wlan_mlme_set_usr_disabled_roaming(struct wlan_objmgr_psoc *psoc, bool val) 6310 { 6311 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6312 6313 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6314 if (!mlme_obj) 6315 return QDF_STATUS_E_FAILURE; 6316 6317 mlme_obj->cfg.sta.usr_disabled_roaming = val; 6318 6319 return QDF_STATUS_SUCCESS; 6320 } 6321 6322 QDF_STATUS wlan_mlme_get_usr_disabled_roaming(struct wlan_objmgr_psoc * psoc,bool * val)6323 wlan_mlme_get_usr_disabled_roaming(struct wlan_objmgr_psoc *psoc, bool *val) 6324 { 6325 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6326 6327 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6328 if (!mlme_obj) 6329 return QDF_STATUS_E_INVAL; 6330 6331 *val = mlme_obj->cfg.sta.usr_disabled_roaming; 6332 6333 return QDF_STATUS_SUCCESS; 6334 } 6335 mlme_get_opr_rate(struct wlan_objmgr_vdev * vdev,uint8_t * dst,qdf_size_t len)6336 qdf_size_t mlme_get_opr_rate(struct wlan_objmgr_vdev *vdev, uint8_t *dst, 6337 qdf_size_t len) 6338 { 6339 struct mlme_legacy_priv *mlme_priv; 6340 6341 if (!vdev || !dst || !len) { 6342 mlme_legacy_err("invalid params"); 6343 return 0; 6344 } 6345 6346 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 6347 if (!mlme_priv) { 6348 mlme_legacy_err("vdev legacy private object is NULL"); 6349 return 0; 6350 } 6351 6352 if (len < mlme_priv->opr_rate_set.len) { 6353 mlme_legacy_err("Invalid length %zd (<%zd)", len, 6354 mlme_priv->opr_rate_set.len); 6355 return 0; 6356 } 6357 6358 qdf_mem_copy(dst, mlme_priv->opr_rate_set.data, 6359 mlme_priv->opr_rate_set.len); 6360 6361 return mlme_priv->opr_rate_set.len; 6362 } 6363 mlme_set_opr_rate(struct wlan_objmgr_vdev * vdev,uint8_t * src,qdf_size_t len)6364 QDF_STATUS mlme_set_opr_rate(struct wlan_objmgr_vdev *vdev, uint8_t *src, 6365 qdf_size_t len) 6366 { 6367 struct mlme_legacy_priv *mlme_priv; 6368 6369 if (!vdev || !src) { 6370 mlme_legacy_err("invalid params"); 6371 return QDF_STATUS_E_INVAL; 6372 } 6373 6374 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 6375 if (!mlme_priv) { 6376 mlme_legacy_err("vdev legacy private object is NULL"); 6377 return QDF_STATUS_E_FAILURE; 6378 } 6379 6380 if (len > mlme_priv->opr_rate_set.max_len) { 6381 mlme_legacy_err("Invalid len %zd (>%zd)", len, 6382 mlme_priv->opr_rate_set.max_len); 6383 return QDF_STATUS_E_INVAL; 6384 } 6385 6386 mlme_priv->opr_rate_set.len = len; 6387 qdf_mem_copy(mlme_priv->opr_rate_set.data, src, len); 6388 6389 return QDF_STATUS_SUCCESS; 6390 } 6391 mlme_get_ext_opr_rate(struct wlan_objmgr_vdev * vdev,uint8_t * dst,qdf_size_t len)6392 qdf_size_t mlme_get_ext_opr_rate(struct wlan_objmgr_vdev *vdev, uint8_t *dst, 6393 qdf_size_t len) 6394 { 6395 struct mlme_legacy_priv *mlme_priv; 6396 6397 if (!vdev || !dst || !len) { 6398 mlme_legacy_err("invalid params"); 6399 return 0; 6400 } 6401 6402 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 6403 if (!mlme_priv) { 6404 mlme_legacy_err("vdev legacy private object is NULL"); 6405 return 0; 6406 } 6407 6408 if (len < mlme_priv->ext_opr_rate_set.len) { 6409 mlme_legacy_err("Invalid length %zd (<%zd)", len, 6410 mlme_priv->ext_opr_rate_set.len); 6411 return 0; 6412 } 6413 6414 qdf_mem_copy(dst, mlme_priv->ext_opr_rate_set.data, 6415 mlme_priv->ext_opr_rate_set.len); 6416 6417 return mlme_priv->ext_opr_rate_set.len; 6418 } 6419 mlme_set_ext_opr_rate(struct wlan_objmgr_vdev * vdev,uint8_t * src,qdf_size_t len)6420 QDF_STATUS mlme_set_ext_opr_rate(struct wlan_objmgr_vdev *vdev, uint8_t *src, 6421 qdf_size_t len) 6422 { 6423 struct mlme_legacy_priv *mlme_priv; 6424 6425 if (!vdev || !src) { 6426 mlme_legacy_err("invalid params"); 6427 return QDF_STATUS_E_INVAL; 6428 } 6429 6430 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 6431 if (!mlme_priv) { 6432 mlme_legacy_err("vdev legacy private object is NULL"); 6433 return QDF_STATUS_E_FAILURE; 6434 } 6435 6436 if (len > mlme_priv->ext_opr_rate_set.max_len) { 6437 mlme_legacy_err("Invalid len %zd (>%zd)", len, 6438 mlme_priv->ext_opr_rate_set.max_len); 6439 return QDF_STATUS_E_INVAL; 6440 } 6441 6442 mlme_priv->ext_opr_rate_set.len = len; 6443 qdf_mem_copy(mlme_priv->ext_opr_rate_set.data, src, len); 6444 6445 return QDF_STATUS_SUCCESS; 6446 } 6447 mlme_clear_ext_opr_rate(struct wlan_objmgr_vdev * vdev)6448 QDF_STATUS mlme_clear_ext_opr_rate(struct wlan_objmgr_vdev *vdev) 6449 { 6450 struct mlme_legacy_priv *mlme_priv; 6451 6452 if (!vdev) { 6453 mlme_legacy_err("invalid params"); 6454 return QDF_STATUS_E_INVAL; 6455 } 6456 6457 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 6458 if (!mlme_priv) { 6459 mlme_legacy_err("vdev legacy private object is NULL"); 6460 return QDF_STATUS_E_FAILURE; 6461 } 6462 6463 mlme_priv->ext_opr_rate_set.len = 0; 6464 qdf_mem_set(mlme_priv->ext_opr_rate_set.data, CFG_STR_DATA_LEN, 0); 6465 6466 return QDF_STATUS_SUCCESS; 6467 } 6468 mlme_get_mcs_rate(struct wlan_objmgr_vdev * vdev,uint8_t * dst,qdf_size_t len)6469 qdf_size_t mlme_get_mcs_rate(struct wlan_objmgr_vdev *vdev, uint8_t *dst, 6470 qdf_size_t len) 6471 { 6472 struct mlme_legacy_priv *mlme_priv; 6473 6474 if (!vdev || !dst || !len) { 6475 mlme_legacy_err("invalid params"); 6476 return 0; 6477 } 6478 6479 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 6480 if (!mlme_priv) { 6481 mlme_legacy_err("vdev legacy private object is NULL"); 6482 return 0; 6483 } 6484 6485 if (len < mlme_priv->mcs_rate_set.len) { 6486 mlme_legacy_err("Invalid length %zd (<%zd)", len, 6487 mlme_priv->mcs_rate_set.len); 6488 return 0; 6489 } 6490 6491 qdf_mem_copy(dst, mlme_priv->mcs_rate_set.data, 6492 mlme_priv->mcs_rate_set.len); 6493 6494 return mlme_priv->mcs_rate_set.len; 6495 } 6496 mlme_set_mcs_rate(struct wlan_objmgr_vdev * vdev,uint8_t * src,qdf_size_t len)6497 QDF_STATUS mlme_set_mcs_rate(struct wlan_objmgr_vdev *vdev, uint8_t *src, 6498 qdf_size_t len) 6499 { 6500 struct mlme_legacy_priv *mlme_priv; 6501 6502 if (!vdev || !src) { 6503 mlme_legacy_err("invalid params"); 6504 return QDF_STATUS_E_INVAL; 6505 } 6506 6507 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 6508 if (!mlme_priv) { 6509 mlme_legacy_err("vdev legacy private object is NULL"); 6510 return QDF_STATUS_E_FAILURE; 6511 } 6512 6513 if (len > mlme_priv->mcs_rate_set.max_len) { 6514 mlme_legacy_err("Invalid len %zd (>%zd)", len, 6515 mlme_priv->mcs_rate_set.max_len); 6516 return QDF_STATUS_E_INVAL; 6517 } 6518 6519 mlme_priv->mcs_rate_set.len = len; 6520 qdf_mem_copy(mlme_priv->mcs_rate_set.data, src, len); 6521 6522 return QDF_STATUS_SUCCESS; 6523 } 6524 mlme_clear_mcs_rate(struct wlan_objmgr_vdev * vdev)6525 QDF_STATUS mlme_clear_mcs_rate(struct wlan_objmgr_vdev *vdev) 6526 { 6527 struct mlme_legacy_priv *mlme_priv; 6528 6529 if (!vdev) { 6530 mlme_legacy_err("invalid params"); 6531 return QDF_STATUS_E_INVAL; 6532 } 6533 6534 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 6535 if (!mlme_priv) { 6536 mlme_legacy_err("vdev legacy private object is NULL"); 6537 return QDF_STATUS_E_FAILURE; 6538 } 6539 6540 mlme_priv->mcs_rate_set.len = 0; 6541 qdf_mem_set(mlme_priv->mcs_rate_set.data, CFG_STR_DATA_LEN, 0); 6542 6543 return QDF_STATUS_SUCCESS; 6544 } 6545 6546 static enum monitor_mode_concurrency wlan_mlme_get_monitor_mode_concurrency(struct wlan_objmgr_psoc * psoc)6547 wlan_mlme_get_monitor_mode_concurrency(struct wlan_objmgr_psoc *psoc) 6548 { 6549 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6550 6551 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6552 if (!mlme_obj) 6553 return cfg_default(CFG_MONITOR_MODE_CONCURRENCY); 6554 6555 return mlme_obj->cfg.gen.monitor_mode_concurrency; 6556 } 6557 6558 #ifdef FEATURE_WDS 6559 enum wlan_wds_mode wlan_mlme_get_wds_mode(struct wlan_objmgr_psoc * psoc)6560 wlan_mlme_get_wds_mode(struct wlan_objmgr_psoc *psoc) 6561 { 6562 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6563 6564 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6565 if (!mlme_obj) 6566 return cfg_default(CFG_WDS_MODE); 6567 6568 return mlme_obj->cfg.gen.wds_mode; 6569 } 6570 wlan_mlme_set_wds_mode(struct wlan_objmgr_psoc * psoc,enum wlan_wds_mode mode)6571 void wlan_mlme_set_wds_mode(struct wlan_objmgr_psoc *psoc, 6572 enum wlan_wds_mode mode) 6573 { 6574 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6575 6576 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6577 if (!mlme_obj) 6578 return; 6579 if (mode <= WLAN_WDS_MODE_MAX) 6580 mlme_obj->cfg.gen.wds_mode = mode; 6581 } 6582 #endif 6583 wlan_mlme_is_sta_mon_conc_supported(struct wlan_objmgr_psoc * psoc)6584 bool wlan_mlme_is_sta_mon_conc_supported(struct wlan_objmgr_psoc *psoc) 6585 { 6586 if (wlan_mlme_get_monitor_mode_concurrency(psoc) == 6587 MONITOR_MODE_CONC_STA_SCAN_MON) 6588 return true; 6589 6590 return false; 6591 } 6592 wlan_mlme_skip_tpe(struct wlan_objmgr_psoc * psoc)6593 bool wlan_mlme_skip_tpe(struct wlan_objmgr_psoc *psoc) 6594 { 6595 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6596 6597 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6598 if (!mlme_obj) 6599 return false; 6600 6601 return mlme_obj->cfg.power.skip_tpe; 6602 } 6603 6604 #ifdef WLAN_FEATURE_11BE mlme_cfg_get_orig_eht_caps(struct wlan_objmgr_psoc * psoc,tDot11fIEeht_cap * eht_cap)6605 QDF_STATUS mlme_cfg_get_orig_eht_caps(struct wlan_objmgr_psoc *psoc, 6606 tDot11fIEeht_cap *eht_cap) 6607 { 6608 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6609 6610 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6611 if (!mlme_obj) 6612 return QDF_STATUS_E_FAILURE; 6613 6614 *eht_cap = mlme_obj->cfg.eht_caps.eht_cap_orig; 6615 6616 return QDF_STATUS_SUCCESS; 6617 } 6618 mlme_cfg_get_eht_caps(struct wlan_objmgr_psoc * psoc,tDot11fIEeht_cap * eht_cap)6619 QDF_STATUS mlme_cfg_get_eht_caps(struct wlan_objmgr_psoc *psoc, 6620 tDot11fIEeht_cap *eht_cap) 6621 { 6622 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6623 6624 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6625 if (!mlme_obj) 6626 return QDF_STATUS_E_FAILURE; 6627 6628 *eht_cap = mlme_obj->cfg.eht_caps.dot11_eht_cap; 6629 6630 return QDF_STATUS_SUCCESS; 6631 } 6632 #endif 6633 6634 QDF_STATUS wlan_mlme_set_ba_2k_jump_iot_ap(struct wlan_objmgr_vdev * vdev,bool found)6635 wlan_mlme_set_ba_2k_jump_iot_ap(struct wlan_objmgr_vdev *vdev, bool found) 6636 { 6637 struct mlme_legacy_priv *mlme_priv; 6638 6639 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 6640 if (!mlme_priv) { 6641 mlme_legacy_err("vdev legacy private object is NULL"); 6642 return QDF_STATUS_E_FAILURE; 6643 } 6644 6645 mlme_priv->ba_2k_jump_iot_ap = found; 6646 6647 return QDF_STATUS_SUCCESS; 6648 } 6649 wlan_mlme_is_ba_2k_jump_iot_ap(struct wlan_objmgr_vdev * vdev)6650 bool wlan_mlme_is_ba_2k_jump_iot_ap(struct wlan_objmgr_vdev *vdev) 6651 { 6652 struct mlme_legacy_priv *mlme_priv; 6653 6654 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 6655 if (!mlme_priv) { 6656 mlme_legacy_err("vdev legacy private object is NULL"); 6657 return false; 6658 } 6659 6660 return mlme_priv->ba_2k_jump_iot_ap; 6661 } 6662 6663 QDF_STATUS wlan_mlme_set_last_delba_sent_time(struct wlan_objmgr_vdev * vdev,qdf_time_t delba_sent_time)6664 wlan_mlme_set_last_delba_sent_time(struct wlan_objmgr_vdev *vdev, 6665 qdf_time_t delba_sent_time) 6666 { 6667 struct mlme_legacy_priv *mlme_priv; 6668 6669 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 6670 if (!mlme_priv) { 6671 mlme_legacy_err("vdev legacy private object is NULL"); 6672 return QDF_STATUS_E_FAILURE; 6673 } 6674 6675 mlme_priv->last_delba_sent_time = delba_sent_time; 6676 6677 return QDF_STATUS_SUCCESS; 6678 } 6679 6680 qdf_time_t wlan_mlme_get_last_delba_sent_time(struct wlan_objmgr_vdev * vdev)6681 wlan_mlme_get_last_delba_sent_time(struct wlan_objmgr_vdev *vdev) 6682 { 6683 struct mlme_legacy_priv *mlme_priv; 6684 6685 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 6686 if (!mlme_priv) { 6687 mlme_legacy_err("vdev legacy private object is NULL"); 6688 return 0; 6689 } 6690 6691 return mlme_priv->last_delba_sent_time; 6692 } 6693 mlme_set_user_ps(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,bool ps_enable)6694 QDF_STATUS mlme_set_user_ps(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, 6695 bool ps_enable) 6696 { 6697 struct wlan_objmgr_vdev *vdev; 6698 struct mlme_legacy_priv *mlme_priv; 6699 QDF_STATUS status = QDF_STATUS_E_FAILURE; 6700 6701 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id, 6702 WLAN_MLME_OBJMGR_ID); 6703 if (!vdev) 6704 return status; 6705 6706 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 6707 if (mlme_priv) { 6708 mlme_priv->is_usr_ps_enabled = ps_enable; 6709 status = QDF_STATUS_SUCCESS; 6710 mlme_legacy_debug("vdev:%d user PS:%d", vdev_id, 6711 mlme_priv->is_usr_ps_enabled); 6712 } 6713 6714 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID); 6715 6716 return status; 6717 } 6718 mlme_get_user_ps(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id)6719 bool mlme_get_user_ps(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id) 6720 { 6721 struct wlan_objmgr_vdev *vdev; 6722 struct mlme_legacy_priv *mlme_priv; 6723 bool usr_ps_enable = false; 6724 6725 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id, 6726 WLAN_MLME_OBJMGR_ID); 6727 if (!vdev) 6728 return false; 6729 6730 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 6731 if (mlme_priv) 6732 usr_ps_enable = mlme_priv->is_usr_ps_enabled; 6733 6734 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID); 6735 6736 return usr_ps_enable; 6737 } 6738 wlan_mlme_is_multipass_sap(struct wlan_objmgr_psoc * psoc)6739 bool wlan_mlme_is_multipass_sap(struct wlan_objmgr_psoc *psoc) 6740 { 6741 struct target_psoc_info *info; 6742 6743 info = wlan_psoc_get_tgt_if_handle(psoc); 6744 if (!info) { 6745 mlme_legacy_err("target_psoc_info is null"); 6746 return QDF_STATUS_E_FAILURE; 6747 } 6748 6749 return target_is_multipass_sap(info); 6750 } 6751 wlan_mlme_get_phy_max_freq_range(struct wlan_objmgr_psoc * psoc,uint32_t * low_2ghz_chan,uint32_t * high_2ghz_chan,uint32_t * low_5ghz_chan,uint32_t * high_5ghz_chan)6752 QDF_STATUS wlan_mlme_get_phy_max_freq_range(struct wlan_objmgr_psoc *psoc, 6753 uint32_t *low_2ghz_chan, 6754 uint32_t *high_2ghz_chan, 6755 uint32_t *low_5ghz_chan, 6756 uint32_t *high_5ghz_chan) 6757 { 6758 uint32_t i; 6759 uint32_t reg_low_2ghz_chan; 6760 uint32_t reg_high_2ghz_chan; 6761 uint32_t reg_low_5ghz_chan; 6762 uint32_t reg_high_5ghz_chan; 6763 struct target_psoc_info *info; 6764 struct wlan_psoc_host_mac_phy_caps *mac_phy_cap; 6765 struct wlan_psoc_host_hal_reg_cap_ext *reg_cap_ext; 6766 6767 info = wlan_psoc_get_tgt_if_handle(psoc); 6768 if (!info) { 6769 mlme_legacy_err("target_psoc_info is null"); 6770 return QDF_STATUS_E_FAILURE; 6771 } 6772 mac_phy_cap = info->info.mac_phy_cap; 6773 reg_cap_ext = &mac_phy_cap->reg_cap_ext; 6774 reg_low_2ghz_chan = reg_cap_ext->low_2ghz_chan; 6775 reg_high_2ghz_chan = reg_cap_ext->high_2ghz_chan; 6776 reg_low_5ghz_chan = reg_cap_ext->low_5ghz_chan; 6777 reg_high_5ghz_chan = reg_cap_ext->high_5ghz_chan; 6778 for (i = 1; i < PSOC_MAX_MAC_PHY_CAP; i++) { 6779 mac_phy_cap = &info->info.mac_phy_cap[i]; 6780 reg_cap_ext = &mac_phy_cap->reg_cap_ext; 6781 6782 if (reg_cap_ext->low_2ghz_chan) { 6783 reg_low_2ghz_chan = reg_low_2ghz_chan ? 6784 QDF_MIN(reg_cap_ext->low_2ghz_chan, 6785 reg_low_2ghz_chan) : 6786 reg_cap_ext->low_2ghz_chan; 6787 } 6788 if (reg_cap_ext->high_2ghz_chan) { 6789 reg_high_2ghz_chan = reg_high_2ghz_chan ? 6790 QDF_MAX(reg_cap_ext->high_2ghz_chan, 6791 reg_high_2ghz_chan) : 6792 reg_cap_ext->high_2ghz_chan; 6793 } 6794 if (reg_cap_ext->low_5ghz_chan) { 6795 reg_low_5ghz_chan = reg_low_5ghz_chan ? 6796 QDF_MIN(reg_cap_ext->low_5ghz_chan, 6797 reg_low_5ghz_chan) : 6798 reg_cap_ext->low_5ghz_chan; 6799 } 6800 if (reg_cap_ext->high_5ghz_chan) { 6801 reg_high_5ghz_chan = reg_high_5ghz_chan ? 6802 QDF_MAX(reg_cap_ext->high_5ghz_chan, 6803 reg_high_5ghz_chan) : 6804 reg_cap_ext->high_5ghz_chan; 6805 } 6806 } 6807 /* For old hw, no reg_cap_ext reported from service ready ext, 6808 * fill the low/high with default of regulatory. 6809 */ 6810 if (!reg_low_2ghz_chan && !reg_high_2ghz_chan && 6811 !reg_low_5ghz_chan && !reg_high_5ghz_chan) { 6812 mlme_legacy_debug("no reg_cap_ext in mac_phy_cap"); 6813 reg_low_2ghz_chan = TWOG_STARTING_FREQ - 10; 6814 reg_high_2ghz_chan = TWOG_CHAN_14_IN_MHZ + 10; 6815 reg_low_5ghz_chan = FIVEG_STARTING_FREQ - 10; 6816 reg_high_5ghz_chan = SIXG_CHAN_233_IN_MHZ + 10; 6817 } 6818 if (!wlan_reg_is_6ghz_supported(psoc)) { 6819 mlme_legacy_debug("disabling 6ghz channels"); 6820 reg_high_5ghz_chan = FIVEG_CHAN_177_IN_MHZ + 10; 6821 } 6822 mlme_legacy_debug("%d %d %d %d", reg_low_2ghz_chan, reg_high_2ghz_chan, 6823 reg_low_5ghz_chan, reg_high_5ghz_chan); 6824 *low_2ghz_chan = reg_low_2ghz_chan; 6825 *high_2ghz_chan = reg_high_2ghz_chan; 6826 *low_5ghz_chan = reg_low_5ghz_chan; 6827 *high_5ghz_chan = reg_high_5ghz_chan; 6828 6829 return QDF_STATUS_SUCCESS; 6830 } 6831 6832 #ifdef WLAN_FEATURE_P2P_P2P_STA 6833 bool wlan_mlme_get_p2p_p2p_conc_support(struct wlan_objmgr_psoc * psoc)6834 wlan_mlme_get_p2p_p2p_conc_support(struct wlan_objmgr_psoc *psoc) 6835 { 6836 return wlan_psoc_nif_fw_ext_cap_get(psoc, 6837 WLAN_SOC_EXT_P2P_P2P_CONC_SUPPORT); 6838 } 6839 #endif 6840 mlme_get_vht_ch_width(void)6841 enum phy_ch_width mlme_get_vht_ch_width(void) 6842 { 6843 enum phy_ch_width bandwidth = CH_WIDTH_INVALID; 6844 uint32_t fw_ch_wd = wma_get_vht_ch_width(); 6845 6846 if (fw_ch_wd == WNI_CFG_VHT_CHANNEL_WIDTH_80_PLUS_80MHZ) 6847 bandwidth = CH_WIDTH_80P80MHZ; 6848 else if (fw_ch_wd == WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ) 6849 bandwidth = CH_WIDTH_160MHZ; 6850 else 6851 bandwidth = CH_WIDTH_80MHZ; 6852 6853 return bandwidth; 6854 } 6855 6856 uint8_t wlan_mlme_get_mgmt_hw_tx_retry_count(struct wlan_objmgr_psoc * psoc,enum mlme_cfg_frame_type frm_type)6857 wlan_mlme_get_mgmt_hw_tx_retry_count(struct wlan_objmgr_psoc *psoc, 6858 enum mlme_cfg_frame_type frm_type) 6859 { 6860 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6861 6862 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6863 6864 if (!mlme_obj) 6865 return 0; 6866 6867 if (frm_type >= CFG_FRAME_TYPE_MAX) 6868 return 0; 6869 6870 return mlme_obj->cfg.gen.mgmt_hw_tx_retry_count[frm_type]; 6871 } 6872 6873 QDF_STATUS wlan_mlme_get_tx_retry_multiplier(struct wlan_objmgr_psoc * psoc,uint32_t * tx_retry_multiplier)6874 wlan_mlme_get_tx_retry_multiplier(struct wlan_objmgr_psoc *psoc, 6875 uint32_t *tx_retry_multiplier) 6876 { 6877 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6878 6879 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6880 6881 if (!mlme_obj) { 6882 *tx_retry_multiplier = 6883 cfg_default(CFG_TX_RETRY_MULTIPLIER); 6884 return QDF_STATUS_E_FAILURE; 6885 } 6886 6887 *tx_retry_multiplier = mlme_obj->cfg.gen.tx_retry_multiplier; 6888 return QDF_STATUS_SUCCESS; 6889 } 6890 6891 QDF_STATUS wlan_mlme_get_update_chan_width_allowed(struct wlan_objmgr_psoc * psoc,bool * value)6892 wlan_mlme_get_update_chan_width_allowed(struct wlan_objmgr_psoc *psoc, 6893 bool *value) 6894 { 6895 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6896 6897 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6898 if (!mlme_obj) { 6899 *value = cfg_default(CFG_ALLOW_UPDATE_CHANNEL_WIDTH); 6900 return QDF_STATUS_E_INVAL; 6901 } 6902 6903 *value = mlme_obj->cfg.feature_flags.update_cw_allowed; 6904 6905 return QDF_STATUS_SUCCESS; 6906 } 6907 6908 QDF_STATUS wlan_mlme_get_channel_bonding_5ghz(struct wlan_objmgr_psoc * psoc,uint32_t * value)6909 wlan_mlme_get_channel_bonding_5ghz(struct wlan_objmgr_psoc *psoc, 6910 uint32_t *value) 6911 { 6912 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6913 6914 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6915 if (!mlme_obj) { 6916 *value = cfg_default(CFG_CHANNEL_BONDING_MODE_5GHZ); 6917 return QDF_STATUS_E_INVAL; 6918 } 6919 6920 *value = mlme_obj->cfg.feature_flags.channel_bonding_mode_5ghz; 6921 6922 return QDF_STATUS_SUCCESS; 6923 } 6924 6925 QDF_STATUS wlan_mlme_update_ratemask_params(struct wlan_objmgr_vdev * vdev,uint8_t num_ratemask,struct config_ratemask_params * rate_params)6926 wlan_mlme_update_ratemask_params(struct wlan_objmgr_vdev *vdev, 6927 uint8_t num_ratemask, 6928 struct config_ratemask_params *rate_params) 6929 { 6930 struct vdev_mlme_obj *vdev_mlme; 6931 struct vdev_mlme_rate_info *rate_info; 6932 QDF_STATUS ret; 6933 uint8_t i = 0; 6934 uint8_t index; 6935 6936 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 6937 if (!vdev_mlme) 6938 return QDF_STATUS_E_FAILURE; 6939 6940 rate_info = &vdev_mlme->mgmt.rate_info; 6941 while (i < num_ratemask) { 6942 index = rate_params[i].type; 6943 if (index >= WLAN_VDEV_RATEMASK_TYPE_MAX) { 6944 mlme_legacy_err("Invalid ratemask type"); 6945 ++i; 6946 continue; 6947 } 6948 6949 if (rate_info->ratemask_params[index].lower32 != 6950 rate_params[i].lower32 || 6951 rate_info->ratemask_params[index].lower32_2 != 6952 rate_params[i].lower32_2 || 6953 rate_info->ratemask_params[index].higher32 != 6954 rate_params[i].higher32 || 6955 rate_info->ratemask_params[index].higher32_2 != 6956 rate_params[i].higher32_2) { 6957 rate_info->ratemask_params[index].lower32 = 6958 rate_params[i].lower32; 6959 rate_info->ratemask_params[index].higher32 = 6960 rate_params[i].higher32; 6961 rate_info->ratemask_params[index].lower32_2 = 6962 rate_params[i].lower32_2; 6963 rate_info->ratemask_params[index].higher32_2 = 6964 rate_params[i].higher32_2; 6965 ret = wlan_util_vdev_mlme_set_ratemask_config(vdev_mlme, 6966 index); 6967 if (ret != QDF_STATUS_SUCCESS) 6968 mlme_legacy_err("ratemask config failed"); 6969 } else { 6970 mlme_legacy_debug("Ratemask same as configured mask"); 6971 } 6972 ++i; 6973 } 6974 return QDF_STATUS_SUCCESS; 6975 } 6976 wlan_mlme_is_channel_valid(struct wlan_objmgr_psoc * psoc,uint32_t chan_freq)6977 bool wlan_mlme_is_channel_valid(struct wlan_objmgr_psoc *psoc, 6978 uint32_t chan_freq) 6979 { 6980 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6981 6982 mlme_obj = mlme_get_psoc_ext_obj(psoc); 6983 if (!mlme_obj) 6984 return false; 6985 6986 return wlan_roam_is_channel_valid(&mlme_obj->cfg.reg, 6987 chan_freq); 6988 } 6989 6990 #ifdef WLAN_FEATURE_MCC_QUOTA 6991 #define WLAN_MCC_MIN_QUOTA 10 /* in %age */ 6992 #define WLAN_MCC_MAX_QUOTA 90 /* in %age */ wlan_mlme_set_user_mcc_quota(struct wlan_objmgr_psoc * psoc,struct wlan_user_mcc_quota * quota)6993 QDF_STATUS wlan_mlme_set_user_mcc_quota(struct wlan_objmgr_psoc *psoc, 6994 struct wlan_user_mcc_quota *quota) 6995 6996 { 6997 struct wlan_mlme_psoc_ext_obj *mlme_obj; 6998 6999 if (!quota) 7000 return QDF_STATUS_E_NULL_VALUE; 7001 7002 mlme_obj = mlme_get_psoc_ext_obj(psoc); 7003 if (!mlme_obj) 7004 return QDF_STATUS_E_FAILURE; 7005 7006 if (quota->quota < WLAN_MCC_MIN_QUOTA) 7007 quota->quota = WLAN_MCC_MIN_QUOTA; 7008 else if (quota->quota > WLAN_MCC_MAX_QUOTA) 7009 quota->quota = WLAN_MCC_MAX_QUOTA; 7010 7011 mlme_obj->cfg.gen.user_mcc_quota.quota = quota->quota; 7012 mlme_obj->cfg.gen.user_mcc_quota.op_mode = quota->op_mode; 7013 mlme_obj->cfg.gen.user_mcc_quota.vdev_id = quota->vdev_id; 7014 7015 mlme_debug("quota : %u, op_mode : %d, vdev_id : %u", 7016 quota->quota, quota->op_mode, quota->vdev_id); 7017 7018 return QDF_STATUS_SUCCESS; 7019 } 7020 wlan_mlme_get_user_mcc_quota(struct wlan_objmgr_psoc * psoc,struct wlan_user_mcc_quota * quota)7021 QDF_STATUS wlan_mlme_get_user_mcc_quota(struct wlan_objmgr_psoc *psoc, 7022 struct wlan_user_mcc_quota *quota) 7023 { 7024 struct wlan_mlme_psoc_ext_obj *mlme_obj; 7025 7026 if (!quota) 7027 return QDF_STATUS_E_NULL_VALUE; 7028 7029 mlme_obj = mlme_get_psoc_ext_obj(psoc); 7030 if (!mlme_obj) 7031 return QDF_STATUS_E_FAILURE; 7032 7033 quota->quota = mlme_obj->cfg.gen.user_mcc_quota.quota; 7034 quota->op_mode = mlme_obj->cfg.gen.user_mcc_quota.op_mode; 7035 quota->vdev_id = mlme_obj->cfg.gen.user_mcc_quota.vdev_id; 7036 7037 return QDF_STATUS_SUCCESS; 7038 } 7039 7040 uint32_t wlan_mlme_get_user_mcc_duty_cycle_percentage(struct wlan_objmgr_psoc * psoc)7041 wlan_mlme_get_user_mcc_duty_cycle_percentage(struct wlan_objmgr_psoc *psoc) 7042 { 7043 uint32_t mcc_freq, ch_freq, quota_value; 7044 struct wlan_user_mcc_quota quota; 7045 uint8_t operating_channel; 7046 int status; 7047 7048 quota.vdev_id = WLAN_UMAC_VDEV_ID_MAX; 7049 quota.quota = 0; 7050 if (QDF_IS_STATUS_ERROR(wlan_mlme_get_user_mcc_quota(psoc, "a))) { 7051 mlme_debug("Error getting user quota set"); 7052 return 0; 7053 } 7054 7055 if (quota.vdev_id == WLAN_UMAC_VDEV_ID_MAX || quota.quota == 0) { 7056 mlme_debug("Invalid quota : vdev %u, quota %u", 7057 quota.vdev_id, quota.quota); 7058 return 0; 7059 } 7060 status = policy_mgr_get_chan_by_session_id(psoc, quota.vdev_id, 7061 &ch_freq); 7062 if (QDF_IS_STATUS_ERROR(status)) { 7063 mlme_debug("Could not get vdev %u chan", quota.vdev_id); 7064 return 0; 7065 } 7066 mcc_freq = policy_mgr_get_mcc_operating_channel(psoc, quota.vdev_id); 7067 if (mcc_freq == INVALID_CHANNEL_ID) 7068 return 0; 7069 7070 operating_channel = wlan_freq_to_chan(ch_freq); 7071 if (!operating_channel) { 7072 mlme_debug("Primary op channel is invalid"); 7073 return 0; 7074 } 7075 /* 7076 * The channel numbers for both adapters and the time 7077 * quota for the 1st adapter, i.e., one specified in cmd 7078 * are formatted as a bit vector 7079 * ****************************************************** 7080 * |bit 31-24 | bit 23-16 | bits 15-8 |bits 7-0 | 7081 * | Unused | Quota for | chan. # for |chan. # for| 7082 * | | 1st chan | 1st chan. |2nd chan. | 7083 * ****************************************************** 7084 */ 7085 mlme_debug("Opmode (%d) vdev (%u) channel %u and quota %u", 7086 quota.op_mode, quota.vdev_id, 7087 operating_channel, quota.quota); 7088 quota_value = quota.quota; 7089 /* Move the time quota for first channel to bits 15-8 */ 7090 quota_value = quota_value << 8; 7091 /* 7092 * Store the channel number of 1st channel at bits 7-0 7093 * of the bit vector 7094 */ 7095 quota_value |= operating_channel; 7096 7097 operating_channel = wlan_freq_to_chan(mcc_freq); 7098 if (!operating_channel) { 7099 mlme_debug("Secondary op channel is invalid"); 7100 return 0; 7101 } 7102 7103 /* 7104 * Now move the time quota and channel number of the 7105 * 1st adapter to bits 23-16 and bits 15-8 of the bit 7106 * vector, respectively. 7107 */ 7108 quota_value = quota_value << 8; 7109 /* 7110 * Set the channel number for 2nd MCC vdev at bits 7111 * 7-0 of set_value 7112 */ 7113 quota_value |= operating_channel; 7114 mlme_debug("quota value:%x", quota_value); 7115 7116 return quota_value; 7117 } 7118 #endif /* WLAN_FEATURE_MCC_QUOTA */ 7119 mlme_get_max_he_mcs_idx(enum phy_ch_width mcs_ch_width,u_int16_t * hecap_rxmcsnssmap,u_int16_t * hecap_txmcsnssmap)7120 uint8_t mlme_get_max_he_mcs_idx(enum phy_ch_width mcs_ch_width, 7121 u_int16_t *hecap_rxmcsnssmap, 7122 u_int16_t *hecap_txmcsnssmap) 7123 { 7124 uint8_t rx_max_mcs, tx_max_mcs, max_mcs = INVALID_MCS_NSS_INDEX; 7125 7126 switch (mcs_ch_width) { 7127 case CH_WIDTH_80P80MHZ: 7128 if (hecap_rxmcsnssmap[HECAP_TXRX_MCS_NSS_IDX_80_80] && 7129 hecap_txmcsnssmap[HECAP_TXRX_MCS_NSS_IDX_80_80]) { 7130 rx_max_mcs = hecap_rxmcsnssmap[HECAP_TXRX_MCS_NSS_IDX_80_80] & 0x03; 7131 tx_max_mcs = hecap_txmcsnssmap[HECAP_TXRX_MCS_NSS_IDX_80_80] & 0x03; 7132 max_mcs = rx_max_mcs < tx_max_mcs ? rx_max_mcs : tx_max_mcs; 7133 if (max_mcs < 0x03) 7134 max_mcs = 7 + 2 * max_mcs; 7135 } 7136 fallthrough; 7137 case CH_WIDTH_160MHZ: 7138 if (hecap_rxmcsnssmap[HECAP_TXRX_MCS_NSS_IDX_160] && 7139 hecap_txmcsnssmap[HECAP_TXRX_MCS_NSS_IDX_160]) { 7140 rx_max_mcs = hecap_rxmcsnssmap[HECAP_TXRX_MCS_NSS_IDX_160] & 0x03; 7141 tx_max_mcs = hecap_txmcsnssmap[HECAP_TXRX_MCS_NSS_IDX_160] & 0x03; 7142 max_mcs = rx_max_mcs < tx_max_mcs ? rx_max_mcs : tx_max_mcs; 7143 if (max_mcs < 0x03) 7144 max_mcs = 7 + 2 * max_mcs; 7145 } 7146 fallthrough; 7147 default: 7148 if (hecap_rxmcsnssmap[HECAP_TXRX_MCS_NSS_IDX_80] && 7149 hecap_txmcsnssmap[HECAP_TXRX_MCS_NSS_IDX_80]) { 7150 rx_max_mcs = hecap_rxmcsnssmap[HECAP_TXRX_MCS_NSS_IDX_80] & 0x03; 7151 tx_max_mcs = hecap_txmcsnssmap[HECAP_TXRX_MCS_NSS_IDX_80] & 0x03; 7152 max_mcs = rx_max_mcs < tx_max_mcs ? rx_max_mcs : tx_max_mcs; 7153 if (max_mcs < 0x03) 7154 max_mcs = 7 + 2 * max_mcs; 7155 } 7156 } 7157 7158 return max_mcs; 7159 } 7160 mlme_get_max_vht_mcs_idx(u_int16_t rx_vht_mcs_map,u_int16_t tx_vht_mcs_map)7161 uint8_t mlme_get_max_vht_mcs_idx(u_int16_t rx_vht_mcs_map, 7162 u_int16_t tx_vht_mcs_map) 7163 { 7164 uint8_t rx_max_mcs, tx_max_mcs, max_mcs = INVALID_MCS_NSS_INDEX; 7165 7166 if (rx_vht_mcs_map && tx_vht_mcs_map) { 7167 rx_max_mcs = rx_vht_mcs_map & 0x03; 7168 tx_max_mcs = tx_vht_mcs_map & 0x03; 7169 max_mcs = rx_max_mcs < tx_max_mcs ? rx_max_mcs : tx_max_mcs; 7170 if (max_mcs < 0x03) 7171 return 7 + max_mcs; 7172 } 7173 7174 return max_mcs; 7175 } 7176 7177 #ifdef WLAN_FEATURE_SON mlme_save_vdev_max_mcs_idx(struct wlan_objmgr_vdev * vdev,uint8_t max_mcs_idx)7178 QDF_STATUS mlme_save_vdev_max_mcs_idx(struct wlan_objmgr_vdev *vdev, 7179 uint8_t max_mcs_idx) 7180 { 7181 struct mlme_legacy_priv *mlme_priv; 7182 7183 if (!vdev) { 7184 mlme_legacy_err("invalid vdev"); 7185 return QDF_STATUS_E_INVAL; 7186 } 7187 7188 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 7189 if (!mlme_priv) { 7190 mlme_legacy_err("vdev legacy private object is NULL"); 7191 return QDF_STATUS_E_FAILURE; 7192 } 7193 7194 mlme_priv->max_mcs_index = max_mcs_idx; 7195 7196 return QDF_STATUS_SUCCESS; 7197 } 7198 mlme_get_vdev_max_mcs_idx(struct wlan_objmgr_vdev * vdev)7199 uint8_t mlme_get_vdev_max_mcs_idx(struct wlan_objmgr_vdev *vdev) 7200 { 7201 struct mlme_legacy_priv *mlme_priv; 7202 7203 if (!vdev) { 7204 mlme_legacy_err("invalid vdev"); 7205 return INVALID_MCS_NSS_INDEX; 7206 } 7207 7208 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 7209 if (!mlme_priv) { 7210 mlme_legacy_err("vdev legacy private object is NULL"); 7211 return INVALID_MCS_NSS_INDEX; 7212 } 7213 7214 return mlme_priv->max_mcs_index; 7215 } 7216 #endif /* WLAN_FEATURE_SON */ 7217 wlan_mlme_get_safe_mode_enable(struct wlan_objmgr_psoc * psoc,bool * safe_mode_enable)7218 void wlan_mlme_get_safe_mode_enable(struct wlan_objmgr_psoc *psoc, 7219 bool *safe_mode_enable) 7220 { 7221 struct wlan_mlme_psoc_ext_obj *mlme_obj; 7222 7223 mlme_obj = mlme_get_psoc_ext_obj(psoc); 7224 if (!mlme_obj) { 7225 mlme_legacy_err("invalid mlme obj"); 7226 *safe_mode_enable = false; 7227 return; 7228 } 7229 7230 *safe_mode_enable = mlme_obj->cfg.gen.safe_mode_enable; 7231 } 7232 wlan_mlme_set_safe_mode_enable(struct wlan_objmgr_psoc * psoc,bool safe_mode_enable)7233 void wlan_mlme_set_safe_mode_enable(struct wlan_objmgr_psoc *psoc, 7234 bool safe_mode_enable) 7235 { 7236 struct wlan_mlme_psoc_ext_obj *mlme_obj; 7237 7238 mlme_obj = mlme_get_psoc_ext_obj(psoc); 7239 if (!mlme_obj) { 7240 mlme_legacy_err("invalid mlme obj"); 7241 return; 7242 } 7243 7244 mlme_obj->cfg.gen.safe_mode_enable = safe_mode_enable; 7245 } 7246 wlan_mlme_get_6g_ap_power_type(struct wlan_objmgr_vdev * vdev)7247 uint32_t wlan_mlme_get_6g_ap_power_type(struct wlan_objmgr_vdev *vdev) 7248 { 7249 struct vdev_mlme_obj *mlme_obj; 7250 7251 mlme_obj = wlan_vdev_mlme_get_cmpt_obj(vdev); 7252 7253 if (!mlme_obj) { 7254 mlme_legacy_err("vdev component object is NULL"); 7255 return REG_MAX_AP_TYPE; 7256 } 7257 7258 return mlme_obj->reg_tpc_obj.power_type_6g; 7259 } 7260 wlan_connect_hw_mode_change_resp(struct wlan_objmgr_pdev * pdev,uint8_t vdev_id,wlan_cm_id cm_id,QDF_STATUS status)7261 QDF_STATUS wlan_connect_hw_mode_change_resp(struct wlan_objmgr_pdev *pdev, 7262 uint8_t vdev_id, 7263 wlan_cm_id cm_id, QDF_STATUS status) 7264 { 7265 return wlan_cm_handle_hw_mode_change_resp(pdev, vdev_id, cm_id, 7266 status); 7267 } 7268 7269 enum phy_ch_width wlan_mlme_get_ch_width_from_phymode(enum wlan_phymode phy_mode)7270 wlan_mlme_get_ch_width_from_phymode(enum wlan_phymode phy_mode) 7271 { 7272 enum phy_ch_width ch_width; 7273 7274 if (IS_WLAN_PHYMODE_320MHZ(phy_mode)) 7275 ch_width = CH_WIDTH_320MHZ; 7276 else if (IS_WLAN_PHYMODE_160MHZ(phy_mode)) 7277 ch_width = CH_WIDTH_160MHZ; 7278 else if (IS_WLAN_PHYMODE_80MHZ(phy_mode)) 7279 ch_width = CH_WIDTH_80MHZ; 7280 else if (IS_WLAN_PHYMODE_40MHZ(phy_mode)) 7281 ch_width = CH_WIDTH_40MHZ; 7282 else 7283 ch_width = CH_WIDTH_20MHZ; 7284 7285 mlme_legacy_debug("phymode: %d, ch_width: %d ", phy_mode, ch_width); 7286 7287 return ch_width; 7288 } 7289 7290 enum phy_ch_width wlan_mlme_get_peer_ch_width(struct wlan_objmgr_psoc * psoc,uint8_t * mac)7291 wlan_mlme_get_peer_ch_width(struct wlan_objmgr_psoc *psoc, uint8_t *mac) 7292 { 7293 enum wlan_phymode phy_mode; 7294 QDF_STATUS status; 7295 7296 status = mlme_get_peer_phymode(psoc, mac, &phy_mode); 7297 if (QDF_IS_STATUS_ERROR(status)) { 7298 mlme_legacy_err("failed to fetch phy_mode status: %d for mac: " QDF_MAC_ADDR_FMT, 7299 status, QDF_MAC_ADDR_REF(mac)); 7300 return CH_WIDTH_20MHZ; 7301 } 7302 7303 return wlan_mlme_get_ch_width_from_phymode(phy_mode); 7304 } 7305 7306 #ifdef FEATURE_SET 7307 7308 /** 7309 * wlan_mlme_get_latency_enable() - get wlm latency cfg value 7310 * @psoc: psoc context 7311 * @value: Pointer in which wlam latency cfg value needs to be filled 7312 * 7313 * Return: QDF_STATUS_SUCCESS on success or QDF_STATUS_E_INVAL on failure 7314 */ 7315 static QDF_STATUS wlan_mlme_get_latency_enable(struct wlan_objmgr_psoc * psoc,bool * value)7316 wlan_mlme_get_latency_enable(struct wlan_objmgr_psoc *psoc, bool *value) 7317 { 7318 struct wlan_mlme_psoc_ext_obj *mlme_obj; 7319 7320 mlme_obj = mlme_get_psoc_ext_obj(psoc); 7321 if (!mlme_obj) { 7322 mlme_legacy_err("mlme obj null"); 7323 return QDF_STATUS_E_INVAL; 7324 } 7325 7326 *value = mlme_obj->cfg.wlm_config.latency_enable; 7327 return QDF_STATUS_SUCCESS; 7328 } 7329 7330 #ifdef WLAN_ADAPTIVE_11R 7331 /** 7332 * wlan_mlme_get_adaptive11r_enabled() - get adaptive 11r cfg value 7333 * @psoc: psoc context 7334 * @val: Pointer in which adaptive 11r cfg value needs to be filled 7335 * 7336 * Return: QDF_STATUS_SUCCESS on success or QDF_STATUS_E_INVAL on failure 7337 */ 7338 static QDF_STATUS wlan_mlme_get_adaptive11r_enabled(struct wlan_objmgr_psoc * psoc,bool * val)7339 wlan_mlme_get_adaptive11r_enabled(struct wlan_objmgr_psoc *psoc, bool *val) 7340 { 7341 struct wlan_mlme_psoc_ext_obj *mlme_obj; 7342 7343 mlme_obj = mlme_get_psoc_ext_obj(psoc); 7344 if (!mlme_obj) { 7345 *val = cfg_default(CFG_ADAPTIVE_11R); 7346 return QDF_STATUS_E_INVAL; 7347 } 7348 7349 *val = mlme_obj->cfg.lfr.enable_adaptive_11r; 7350 7351 return QDF_STATUS_SUCCESS; 7352 } 7353 #else 7354 static inline QDF_STATUS wlan_mlme_get_adaptive11r_enabled(struct wlan_objmgr_psoc * psoc,bool * val)7355 wlan_mlme_get_adaptive11r_enabled(struct wlan_objmgr_psoc *psoc, bool *val) 7356 { 7357 *val = false; 7358 return QDF_STATUS_SUCCESS; 7359 } 7360 #endif 7361 7362 #if defined(WLAN_FEATURE_P2P_P2P_STA) && \ 7363 !defined(WLAN_FEATURE_NO_P2P_CONCURRENCY) 7364 static bool wlan_mlme_get_p2p_p2p_host_conc_support(void)7365 wlan_mlme_get_p2p_p2p_host_conc_support(void) 7366 { 7367 return true; 7368 } 7369 #else 7370 static bool wlan_mlme_get_p2p_p2p_host_conc_support(void)7371 wlan_mlme_get_p2p_p2p_host_conc_support(void) 7372 { 7373 return false; 7374 } 7375 #endif 7376 7377 #ifndef WLAN_FEATURE_NO_STA_SAP_CONCURRENCY 7378 static bool wlan_mlme_get_sta_sap_host_conc_support(void)7379 wlan_mlme_get_sta_sap_host_conc_support(void) 7380 { 7381 return true; 7382 } 7383 #else 7384 static bool wlan_mlme_get_sta_sap_host_conc_support(void)7385 wlan_mlme_get_sta_sap_host_conc_support(void) 7386 { 7387 return false; 7388 } 7389 #endif 7390 7391 #ifndef WLAN_FEATURE_NO_STA_NAN_CONCURRENCY 7392 static bool wlan_mlme_get_sta_nan_host_conc_support(void)7393 wlan_mlme_get_sta_nan_host_conc_support(void) 7394 { 7395 return true; 7396 } 7397 #else 7398 static bool wlan_mlme_get_sta_nan_host_conc_support(void)7399 wlan_mlme_get_sta_nan_host_conc_support(void) 7400 { 7401 return false; 7402 } 7403 #endif 7404 7405 #ifdef FEATURE_WLAN_TDLS 7406 static bool wlan_mlme_get_sta_tdls_host_conc_support(void)7407 wlan_mlme_get_sta_tdls_host_conc_support(void) 7408 { 7409 return true; 7410 } 7411 #else 7412 static bool wlan_mlme_get_sta_tdls_host_conc_support(void)7413 wlan_mlme_get_sta_tdls_host_conc_support(void) 7414 { 7415 return false; 7416 } 7417 #endif 7418 7419 #if !defined(WLAN_FEATURE_NO_STA_SAP_CONCURRENCY) && \ 7420 (!defined(WLAN_FEATURE_NO_P2P_CONCURRENCY) || \ 7421 defined(WLAN_FEATURE_STA_SAP_P2P_CONCURRENCY)) 7422 static bool wlan_mlme_get_sta_sap_p2p_host_conc_support(void)7423 wlan_mlme_get_sta_sap_p2p_host_conc_support(void) 7424 { 7425 return true; 7426 } 7427 #else 7428 static bool wlan_mlme_get_sta_sap_p2p_host_conc_support(void)7429 wlan_mlme_get_sta_sap_p2p_host_conc_support(void) 7430 { 7431 return false; 7432 } 7433 #endif 7434 7435 #if defined(FEATURE_WLAN_TDLS) 7436 static bool wlan_mlme_get_sta_p2p_tdls_host_conc_support(void)7437 wlan_mlme_get_sta_p2p_tdls_host_conc_support(void) 7438 { 7439 return true; 7440 } 7441 #else 7442 static bool wlan_mlme_get_sta_p2p_tdls_host_conc_support(void)7443 wlan_mlme_get_sta_p2p_tdls_host_conc_support(void) 7444 { 7445 return false; 7446 } 7447 #endif 7448 7449 #if defined(FEATURE_WLAN_TDLS) && !defined(WLAN_FEATURE_NO_STA_SAP_CONCURRENCY) 7450 static bool wlan_mlme_get_sta_sap_tdls_host_conc_support(void)7451 wlan_mlme_get_sta_sap_tdls_host_conc_support(void) 7452 { 7453 return true; 7454 } 7455 #else 7456 static bool wlan_mlme_get_sta_sap_tdls_host_conc_support(void)7457 wlan_mlme_get_sta_sap_tdls_host_conc_support(void) 7458 { 7459 return false; 7460 } 7461 #endif 7462 7463 #if defined(FEATURE_WLAN_TDLS) && \ 7464 !defined(WLAN_FEATURE_NO_STA_SAP_CONCURRENCY) && \ 7465 (!defined(WLAN_FEATURE_NO_P2P_CONCURRENCY) || \ 7466 defined(WLAN_FEATURE_STA_SAP_P2P_CONCURRENCY)) 7467 7468 static bool wlan_mlme_get_sta_sap_p2p_tdls_host_conc_support(void)7469 wlan_mlme_get_sta_sap_p2p_tdls_host_conc_support(void) 7470 { 7471 return true; 7472 } 7473 #else 7474 static bool wlan_mlme_get_sta_sap_p2p_tdls_host_conc_support(void)7475 wlan_mlme_get_sta_sap_p2p_tdls_host_conc_support(void) 7476 { 7477 return false; 7478 } 7479 #endif 7480 7481 #if defined(FEATURE_WLAN_TDLS) && defined(WLAN_FEATURE_P2P_P2P_STA) && \ 7482 !defined(WLAN_FEATURE_NO_P2P_CONCURRENCY) 7483 static bool wlan_mlme_get_sta_p2p_p2p_tdls_host_conc_support(void)7484 wlan_mlme_get_sta_p2p_p2p_tdls_host_conc_support(void) 7485 { 7486 return true; 7487 } 7488 #else 7489 static bool wlan_mlme_get_sta_p2p_p2p_tdls_host_conc_support(void)7490 wlan_mlme_get_sta_p2p_p2p_tdls_host_conc_support(void) 7491 { 7492 return false; 7493 } 7494 #endif 7495 7496 /** 7497 * wlan_mlme_set_iface_combinations() - Set interface combinations 7498 * @mlme_feature_set: Pointer to wlan_mlme_features 7499 * 7500 * Return: None 7501 */ 7502 static void wlan_mlme_set_iface_combinations(struct wlan_mlme_features * mlme_feature_set)7503 wlan_mlme_set_iface_combinations(struct wlan_mlme_features *mlme_feature_set) 7504 { 7505 mlme_feature_set->iface_combinations = 0; 7506 mlme_feature_set->iface_combinations |= MLME_IFACE_STA_P2P_SUPPORT; 7507 if (wlan_mlme_get_sta_sap_host_conc_support()) 7508 mlme_feature_set->iface_combinations |= 7509 MLME_IFACE_STA_SAP_SUPPORT; 7510 if (wlan_mlme_get_sta_nan_host_conc_support()) 7511 mlme_feature_set->iface_combinations |= 7512 MLME_IFACE_STA_NAN_SUPPORT; 7513 if (wlan_mlme_get_sta_tdls_host_conc_support()) 7514 mlme_feature_set->iface_combinations |= 7515 MLME_IFACE_STA_TDLS_SUPPORT; 7516 if (wlan_mlme_get_p2p_p2p_host_conc_support()) 7517 mlme_feature_set->iface_combinations |= 7518 MLME_IFACE_STA_DUAL_P2P_SUPPORT; 7519 if (wlan_mlme_get_sta_sap_p2p_host_conc_support()) 7520 mlme_feature_set->iface_combinations |= 7521 MLME_IFACE_STA_SAP_P2P_SUPPORT; 7522 if (wlan_mlme_get_sta_p2p_tdls_host_conc_support()) 7523 mlme_feature_set->iface_combinations |= 7524 MLME_IFACE_STA_P2P_TDLS_SUPPORT; 7525 if (wlan_mlme_get_sta_sap_tdls_host_conc_support()) 7526 mlme_feature_set->iface_combinations |= 7527 MLME_IFACE_STA_SAP_TDLS_SUPPORT; 7528 if (wlan_mlme_get_sta_sap_p2p_tdls_host_conc_support()) 7529 mlme_feature_set->iface_combinations |= 7530 MLME_IFACE_STA_SAP_P2P_TDLS_SUPPORT; 7531 if (wlan_mlme_get_sta_p2p_p2p_tdls_host_conc_support()) 7532 mlme_feature_set->iface_combinations |= 7533 MLME_IFACE_STA_P2P_P2P_TDLS_SUPPORT; 7534 mlme_debug("iface combinations = %x", 7535 mlme_feature_set->iface_combinations); 7536 } 7537 wlan_mlme_get_feature_info(struct wlan_objmgr_psoc * psoc,struct wlan_mlme_features * mlme_feature_set)7538 void wlan_mlme_get_feature_info(struct wlan_objmgr_psoc *psoc, 7539 struct wlan_mlme_features *mlme_feature_set) 7540 { 7541 uint32_t roam_triggers; 7542 int sap_max_num_clients = 0; 7543 bool is_enable_idle_roam = false, is_bss_load_enabled = false; 7544 7545 wlan_mlme_get_latency_enable(psoc, 7546 &mlme_feature_set->enable_wifi_optimizer); 7547 wlan_mlme_get_sap_max_peers(psoc, &sap_max_num_clients); 7548 mlme_feature_set->sap_max_num_clients = sap_max_num_clients; 7549 mlme_feature_set->vendor_req_1_version = 7550 WMI_HOST_VENDOR1_REQ1_VERSION_4_00; 7551 roam_triggers = wlan_mlme_get_roaming_triggers(psoc); 7552 7553 wlan_mlme_get_bss_load_enabled(psoc, &is_bss_load_enabled); 7554 mlme_feature_set->roaming_high_cu_roam_trigger = 7555 (roam_triggers & BIT(ROAM_TRIGGER_REASON_BSS_LOAD)) && 7556 is_bss_load_enabled; 7557 7558 mlme_feature_set->roaming_emergency_trigger = 7559 roam_triggers & BIT(ROAM_TRIGGER_REASON_FORCED); 7560 mlme_feature_set->roaming_btm_trihgger = 7561 roam_triggers & BIT(ROAM_TRIGGER_REASON_BTM); 7562 7563 wlan_mlme_get_enable_idle_roam(psoc, &is_enable_idle_roam); 7564 mlme_feature_set->roaming_idle_trigger = 7565 (roam_triggers & BIT(ROAM_TRIGGER_REASON_IDLE)) && 7566 is_enable_idle_roam; 7567 7568 mlme_feature_set->roaming_wtc_trigger = 7569 roam_triggers & BIT(ROAM_TRIGGER_REASON_WTC_BTM); 7570 mlme_feature_set->roaming_btcoex_trigger = 7571 roam_triggers & BIT(ROAM_TRIGGER_REASON_BTC); 7572 mlme_feature_set->roaming_btw_wpa_wpa2 = true; 7573 mlme_feature_set->roaming_manage_chan_list_api = true; 7574 7575 wlan_mlme_get_adaptive11r_enabled( 7576 psoc, 7577 &mlme_feature_set->roaming_adaptive_11r); 7578 mlme_feature_set->roaming_ctrl_api_get_set = true; 7579 mlme_feature_set->roaming_ctrl_api_reassoc = true; 7580 mlme_feature_set->roaming_ctrl_get_cu = true; 7581 7582 mlme_feature_set->vendor_req_2_version = 7583 WMI_HOST_VENDOR1_REQ2_VERSION_3_50; 7584 wlan_mlme_set_iface_combinations(mlme_feature_set); 7585 wlan_mlme_get_vht_enable2x2(psoc, &mlme_feature_set->enable2x2); 7586 } 7587 #endif 7588 wlan_mlme_chan_stats_scan_event_cb(struct wlan_objmgr_vdev * vdev,struct scan_event * event,void * arg)7589 void wlan_mlme_chan_stats_scan_event_cb(struct wlan_objmgr_vdev *vdev, 7590 struct scan_event *event, void *arg) 7591 { 7592 bool success = false; 7593 7594 if (!util_is_scan_completed(event, &success)) 7595 return; 7596 7597 mlme_send_scan_done_complete_cb(event->vdev_id); 7598 } 7599 7600 static QDF_STATUS wlan_mlme_update_vdev_chwidth_with_notify(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_vdev * vdev,uint8_t vdev_id,wmi_host_channel_width ch_width)7601 wlan_mlme_update_vdev_chwidth_with_notify(struct wlan_objmgr_psoc *psoc, 7602 struct wlan_objmgr_vdev *vdev, 7603 uint8_t vdev_id, 7604 wmi_host_channel_width ch_width) 7605 { 7606 struct vdev_mlme_obj *vdev_mlme; 7607 struct vdev_set_params param = {0}; 7608 QDF_STATUS status; 7609 7610 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 7611 if (!vdev_mlme) 7612 return QDF_STATUS_E_FAILURE; 7613 7614 param.param_id = wmi_vdev_param_chwidth_with_notify; 7615 param.vdev_id = vdev_id; 7616 param.param_value = ch_width; 7617 status = tgt_vdev_mgr_set_param_send(vdev_mlme, ¶m); 7618 policy_mgr_handle_ml_sta_link_on_traffic_type_change(psoc, vdev); 7619 7620 return status; 7621 } 7622 7623 #ifdef WLAN_FEATURE_11BE 7624 static wlan_mlme_set_puncture(struct wlan_channel * des_chan,uint16_t puncture_bitmap)7625 void wlan_mlme_set_puncture(struct wlan_channel *des_chan, 7626 uint16_t puncture_bitmap) 7627 { 7628 des_chan->puncture_bitmap = puncture_bitmap; 7629 } 7630 #else 7631 static wlan_mlme_set_puncture(struct wlan_channel * des_chan,uint16_t puncture_bitmap)7632 void wlan_mlme_set_puncture(struct wlan_channel *des_chan, 7633 uint16_t puncture_bitmap) 7634 { 7635 } 7636 #endif 7637 wlan_mlme_update_ch_width(struct wlan_objmgr_vdev * vdev,uint8_t vdev_id,enum phy_ch_width ch_width,uint16_t puncture_bitmap,qdf_freq_t sec_2g_freq)7638 static QDF_STATUS wlan_mlme_update_ch_width(struct wlan_objmgr_vdev *vdev, 7639 uint8_t vdev_id, 7640 enum phy_ch_width ch_width, 7641 uint16_t puncture_bitmap, 7642 qdf_freq_t sec_2g_freq) 7643 { 7644 struct wlan_channel *des_chan; 7645 struct wlan_channel *bss_chan; 7646 uint16_t curr_op_freq; 7647 struct ch_params ch_params = {0}; 7648 struct wlan_objmgr_pdev *pdev; 7649 QDF_STATUS status; 7650 7651 des_chan = wlan_vdev_mlme_get_des_chan(vdev); 7652 if (!des_chan) 7653 return QDF_STATUS_E_FAILURE; 7654 7655 bss_chan = wlan_vdev_mlme_get_bss_chan(vdev); 7656 if (!bss_chan) 7657 return QDF_STATUS_E_FAILURE; 7658 7659 pdev = wlan_vdev_get_pdev(vdev); 7660 if (!pdev) { 7661 mlme_err("vdev %d: Pdev is NULL", vdev_id); 7662 return QDF_STATUS_E_INVAL; 7663 } 7664 7665 ch_params.ch_width = ch_width; 7666 curr_op_freq = des_chan->ch_freq; 7667 7668 wlan_reg_set_channel_params_for_pwrmode(pdev, curr_op_freq, 7669 sec_2g_freq, &ch_params, 7670 REG_CURRENT_PWR_MODE); 7671 7672 des_chan->ch_width = ch_width; 7673 des_chan->ch_freq_seg1 = ch_params.center_freq_seg0; 7674 des_chan->ch_freq_seg2 = ch_params.center_freq_seg1; 7675 des_chan->ch_cfreq1 = ch_params.mhz_freq_seg0; 7676 des_chan->ch_cfreq2 = ch_params.mhz_freq_seg1; 7677 wlan_mlme_set_puncture(des_chan, puncture_bitmap); 7678 7679 status = wlan_update_peer_phy_mode(des_chan, vdev); 7680 if (QDF_IS_STATUS_ERROR(status)) { 7681 mlme_err("Failed to update phymode"); 7682 return QDF_STATUS_E_INVAL; 7683 } 7684 7685 qdf_mem_copy(bss_chan, des_chan, sizeof(struct wlan_channel)); 7686 7687 mlme_legacy_debug("vdev id %d freq %d seg0 %d seg1 %d ch_width %d mhz seg0 %d mhz seg1 %d", 7688 vdev_id, curr_op_freq, ch_params.center_freq_seg0, 7689 ch_params.center_freq_seg1, ch_params.ch_width, 7690 ch_params.mhz_freq_seg0, ch_params.mhz_freq_seg1); 7691 7692 return QDF_STATUS_SUCCESS; 7693 } 7694 7695 static uint32_t wlan_mlme_get_vht_rate_flags(enum phy_ch_width ch_width)7696 wlan_mlme_get_vht_rate_flags(enum phy_ch_width ch_width) 7697 { 7698 uint32_t rate_flags = 0; 7699 7700 if (ch_width == CH_WIDTH_80P80MHZ || ch_width == CH_WIDTH_160MHZ) 7701 rate_flags |= TX_RATE_VHT160 | TX_RATE_VHT80 | TX_RATE_VHT40 | 7702 TX_RATE_VHT20; 7703 if (ch_width == CH_WIDTH_80MHZ) 7704 rate_flags |= TX_RATE_VHT80 | TX_RATE_VHT40 | TX_RATE_VHT20; 7705 else if (ch_width) 7706 rate_flags |= TX_RATE_VHT40 | TX_RATE_VHT20; 7707 else 7708 rate_flags |= TX_RATE_VHT20; 7709 return rate_flags; 7710 } 7711 wlan_mlme_get_ht_rate_flags(enum phy_ch_width ch_width)7712 static uint32_t wlan_mlme_get_ht_rate_flags(enum phy_ch_width ch_width) 7713 { 7714 uint32_t rate_flags = 0; 7715 7716 if (ch_width) 7717 rate_flags |= TX_RATE_HT40 | TX_RATE_HT20; 7718 else 7719 rate_flags |= TX_RATE_HT20; 7720 7721 return rate_flags; 7722 } 7723 7724 #ifdef WLAN_FEATURE_11BE 7725 static uint32_t wlan_mlme_get_eht_rate_flags(enum phy_ch_width ch_width)7726 wlan_mlme_get_eht_rate_flags(enum phy_ch_width ch_width) 7727 { 7728 uint32_t rate_flags = 0; 7729 7730 if (ch_width == CH_WIDTH_320MHZ) 7731 rate_flags |= TX_RATE_EHT320 | TX_RATE_EHT160 | 7732 TX_RATE_EHT80 | TX_RATE_EHT40 | TX_RATE_EHT20; 7733 else if (ch_width == CH_WIDTH_160MHZ || ch_width == CH_WIDTH_80P80MHZ) 7734 rate_flags |= TX_RATE_EHT160 | TX_RATE_EHT80 | TX_RATE_EHT40 | 7735 TX_RATE_EHT20; 7736 else if (ch_width == CH_WIDTH_80MHZ) 7737 rate_flags |= TX_RATE_EHT80 | TX_RATE_EHT40 | TX_RATE_EHT20; 7738 else if (ch_width) 7739 rate_flags |= TX_RATE_EHT40 | TX_RATE_EHT20; 7740 else 7741 rate_flags |= TX_RATE_EHT20; 7742 7743 return rate_flags; 7744 } 7745 7746 static QDF_STATUS wlan_mlme_set_bss_rate_flags_eht(uint32_t * rate_flags,uint8_t eht_present,enum phy_ch_width ch_width)7747 wlan_mlme_set_bss_rate_flags_eht(uint32_t *rate_flags, uint8_t eht_present, 7748 enum phy_ch_width ch_width) 7749 { 7750 if (!eht_present) 7751 return QDF_STATUS_E_NOSUPPORT; 7752 7753 *rate_flags |= wlan_mlme_get_eht_rate_flags(ch_width); 7754 7755 return QDF_STATUS_SUCCESS; 7756 } 7757 #else 7758 static inline QDF_STATUS wlan_mlme_set_bss_rate_flags_eht(uint32_t * rate_flags,uint8_t eht_present,enum phy_ch_width ch_width)7759 wlan_mlme_set_bss_rate_flags_eht(uint32_t *rate_flags, uint8_t eht_present, 7760 enum phy_ch_width ch_width) 7761 { 7762 return QDF_STATUS_E_NOSUPPORT; 7763 } 7764 #endif 7765 7766 #ifdef WLAN_FEATURE_11AX wlan_mlme_get_he_rate_flags(enum phy_ch_width ch_width)7767 static uint32_t wlan_mlme_get_he_rate_flags(enum phy_ch_width ch_width) 7768 { 7769 uint32_t rate_flags = 0; 7770 7771 if (ch_width == CH_WIDTH_160MHZ || 7772 ch_width == CH_WIDTH_80P80MHZ) 7773 rate_flags |= TX_RATE_HE160 | TX_RATE_HE80 | TX_RATE_HE40 | 7774 TX_RATE_HE20; 7775 else if (ch_width == CH_WIDTH_80MHZ) 7776 rate_flags |= TX_RATE_HE80 | TX_RATE_HE40 | TX_RATE_HE20; 7777 else if (ch_width) 7778 rate_flags |= TX_RATE_HE40 | TX_RATE_HE20; 7779 else 7780 rate_flags |= TX_RATE_HE20; 7781 7782 return rate_flags; 7783 } 7784 wlan_mlme_set_bss_rate_flags_he(uint32_t * rate_flags,uint8_t he_present,enum phy_ch_width ch_width)7785 static QDF_STATUS wlan_mlme_set_bss_rate_flags_he(uint32_t *rate_flags, 7786 uint8_t he_present, 7787 enum phy_ch_width ch_width) 7788 { 7789 if (!he_present) 7790 return QDF_STATUS_E_NOSUPPORT; 7791 7792 *rate_flags |= wlan_mlme_get_he_rate_flags(ch_width); 7793 7794 return QDF_STATUS_SUCCESS; 7795 } 7796 7797 #else 7798 static inline QDF_STATUS wlan_mlme_set_bss_rate_flags_he(uint32_t * rate_flags,uint8_t he_present,enum phy_ch_width ch_width)7799 wlan_mlme_set_bss_rate_flags_he(uint32_t *rate_flags, 7800 uint8_t he_present, 7801 enum phy_ch_width ch_width) 7802 { 7803 return QDF_STATUS_E_NOSUPPORT; 7804 } 7805 #endif 7806 7807 static QDF_STATUS wlan_mlme_cp_stats_set_rate_flags(struct wlan_objmgr_vdev * vdev,uint32_t flags)7808 wlan_mlme_cp_stats_set_rate_flags(struct wlan_objmgr_vdev *vdev, 7809 uint32_t flags) 7810 { 7811 struct vdev_mc_cp_stats *vdev_mc_stats; 7812 struct vdev_cp_stats *vdev_cp_stats_priv; 7813 7814 vdev_cp_stats_priv = wlan_cp_stats_get_vdev_stats_obj(vdev); 7815 if (!vdev_cp_stats_priv) { 7816 cp_stats_err("vdev cp stats object is null"); 7817 return QDF_STATUS_E_NULL_VALUE; 7818 } 7819 7820 wlan_cp_stats_vdev_obj_lock(vdev_cp_stats_priv); 7821 vdev_mc_stats = vdev_cp_stats_priv->vdev_stats; 7822 vdev_mc_stats->tx_rate_flags = flags; 7823 wlan_cp_stats_vdev_obj_unlock(vdev_cp_stats_priv); 7824 7825 return QDF_STATUS_SUCCESS; 7826 } 7827 7828 QDF_STATUS wlan_mlme_update_bss_rate_flags(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,enum phy_ch_width cw,uint8_t eht_present,uint8_t he_present,uint8_t vht_present,uint8_t ht_present)7829 wlan_mlme_update_bss_rate_flags(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, 7830 enum phy_ch_width cw, uint8_t eht_present, 7831 uint8_t he_present, uint8_t vht_present, 7832 uint8_t ht_present) 7833 { 7834 uint32_t *rate_flags; 7835 struct vdev_mlme_obj *vdev_mlme; 7836 struct wlan_objmgr_vdev *vdev; 7837 QDF_STATUS status; 7838 7839 if (!eht_present && !he_present && !vht_present && !ht_present) 7840 return QDF_STATUS_E_INVAL; 7841 7842 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id, 7843 WLAN_HDD_ID_OBJ_MGR); 7844 if (!vdev) { 7845 mlme_debug("vdev: %d vdev not found", vdev_id); 7846 return QDF_STATUS_E_INVAL; 7847 } 7848 7849 vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); 7850 if (!vdev_mlme) { 7851 mlme_debug("vdev: %d mlme obj not found", vdev_id); 7852 wlan_objmgr_vdev_release_ref(vdev, WLAN_HDD_ID_OBJ_MGR); 7853 return QDF_STATUS_E_INVAL; 7854 } 7855 7856 rate_flags = &vdev_mlme->mgmt.rate_info.rate_flags; 7857 *rate_flags = 0; 7858 7859 status = wlan_mlme_set_bss_rate_flags_eht(rate_flags, eht_present, cw); 7860 if (QDF_IS_STATUS_ERROR(status)) { 7861 status = wlan_mlme_set_bss_rate_flags_he(rate_flags, 7862 he_present, cw); 7863 if (QDF_IS_STATUS_ERROR(status)) { 7864 if (vht_present) 7865 *rate_flags = wlan_mlme_get_vht_rate_flags(cw); 7866 else if (ht_present) 7867 *rate_flags |= wlan_mlme_get_ht_rate_flags(cw); 7868 } 7869 } 7870 7871 mlme_debug("vdev:%d, eht:%u, he:%u, vht:%u, ht:%u, flag:%x, cw:%d", 7872 vdev_id, eht_present, he_present, vht_present, ht_present, 7873 *rate_flags, cw); 7874 7875 status = wlan_mlme_cp_stats_set_rate_flags(vdev, *rate_flags); 7876 7877 wlan_objmgr_vdev_release_ref(vdev, WLAN_HDD_ID_OBJ_MGR); 7878 return status; 7879 } 7880 7881 QDF_STATUS wlan_mlme_send_ch_width_update_with_notify(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_vdev * vdev,uint8_t vdev_id,enum phy_ch_width ch_width)7882 wlan_mlme_send_ch_width_update_with_notify(struct wlan_objmgr_psoc *psoc, 7883 struct wlan_objmgr_vdev *vdev, 7884 uint8_t vdev_id, 7885 enum phy_ch_width ch_width) 7886 { 7887 QDF_STATUS status; 7888 wmi_host_channel_width wmi_chan_width; 7889 enum phy_ch_width associated_ch_width, omn_ie_ch_width; 7890 struct wlan_channel *des_chan; 7891 struct mlme_legacy_priv *mlme_priv; 7892 qdf_freq_t sec_2g_freq = 0; 7893 7894 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 7895 if (!mlme_priv) 7896 return QDF_STATUS_E_INVAL; 7897 7898 des_chan = wlan_vdev_mlme_get_des_chan(vdev); 7899 if (!des_chan) 7900 return QDF_STATUS_E_INVAL; 7901 7902 omn_ie_ch_width = 7903 mlme_priv->connect_info.assoc_chan_info.omn_ie_ch_width; 7904 if (omn_ie_ch_width != CH_WIDTH_INVALID && ch_width > omn_ie_ch_width) { 7905 mlme_debug("vdev %d: Invalid new chwidth:%d, omn_ie_cw:%d", 7906 vdev_id, ch_width, omn_ie_ch_width); 7907 return QDF_STATUS_E_INVAL; 7908 } 7909 7910 associated_ch_width = 7911 mlme_priv->connect_info.assoc_chan_info.assoc_ch_width; 7912 if (associated_ch_width == CH_WIDTH_INVALID || 7913 ch_width > associated_ch_width) { 7914 mlme_debug("vdev %d: Invalid new chwidth:%d, assoc ch_width:%d", 7915 vdev_id, ch_width, associated_ch_width); 7916 return QDF_STATUS_E_INVAL; 7917 } 7918 7919 if (wlan_reg_is_24ghz_ch_freq(des_chan->ch_freq)) { 7920 if (ch_width == CH_WIDTH_40MHZ && 7921 mlme_priv->connect_info.assoc_chan_info.sec_2g_freq) { 7922 sec_2g_freq = 7923 mlme_priv->connect_info.assoc_chan_info.sec_2g_freq; 7924 } else if (ch_width != CH_WIDTH_20MHZ) { 7925 mlme_debug("vdev %d: CW:%d update not supported for freq:%d sec_2g_freq %d", 7926 vdev_id, ch_width, des_chan->ch_freq, 7927 mlme_priv->connect_info.assoc_chan_info.sec_2g_freq); 7928 return QDF_STATUS_E_NOSUPPORT; 7929 } 7930 } 7931 7932 /* update ch width to internal host structure */ 7933 status = wlan_mlme_update_ch_width(vdev, vdev_id, ch_width, 0, 7934 sec_2g_freq); 7935 if (QDF_IS_STATUS_ERROR(status)) { 7936 mlme_err("vdev %d: Failed to update CW:%d to host, status:%d", 7937 vdev_id, ch_width, status); 7938 return status; 7939 } 7940 7941 wmi_chan_width = target_if_phy_ch_width_to_wmi_chan_width(ch_width); 7942 7943 /* update ch width to fw */ 7944 status = wlan_mlme_update_vdev_chwidth_with_notify(psoc, vdev, vdev_id, 7945 wmi_chan_width); 7946 if (QDF_IS_STATUS_ERROR(status)) 7947 mlme_err("vdev %d: Failed to update CW:%d to fw, status:%d", 7948 vdev_id, ch_width, status); 7949 7950 return status; 7951 } 7952 7953 enum phy_ch_width wlan_mlme_convert_vht_op_bw_to_phy_ch_width(uint8_t channel_width,uint8_t chan_id,uint8_t ccfs0,uint8_t ccfs1)7954 wlan_mlme_convert_vht_op_bw_to_phy_ch_width(uint8_t channel_width, 7955 uint8_t chan_id, 7956 uint8_t ccfs0, 7957 uint8_t ccfs1) 7958 { 7959 /** channel_width in vht op from 802.11-2020 7960 * Set to 0 for 20 MHz or 40 MHz BSS bandwidth. 7961 * Set to 1 for 80 MHz, 160 MHz or 80+80 MHz BSS 7962 * bandwidth. 7963 * Set to 2 for 160 MHz BSS bandwidth (deprecated). 7964 * Set to 3 for noncontiguous 80+80 MHz BSS 7965 * bandwidth (deprecated). 7966 * Values in the range 4 to 255 are reserved 7967 * 7968 * 80+80 not supported by MCC platform, so downgrade to 80 7969 */ 7970 enum phy_ch_width phy_bw = CH_WIDTH_20MHZ; 7971 7972 if (channel_width == WLAN_VHTOP_CHWIDTH_2040) { 7973 phy_bw = CH_WIDTH_20MHZ; 7974 if (abs(ccfs0 - chan_id) == 2) 7975 phy_bw = CH_WIDTH_40MHZ; 7976 } else if (channel_width == WLAN_VHTOP_CHWIDTH_80) { 7977 if (ccfs1 && (abs(ccfs1 - ccfs0) == 8)) 7978 phy_bw = CH_WIDTH_160MHZ; 7979 else 7980 phy_bw = CH_WIDTH_80MHZ; 7981 } else if (channel_width == WLAN_VHTOP_CHWIDTH_160) { 7982 phy_bw = CH_WIDTH_160MHZ; 7983 } else if (channel_width == WLAN_VHTOP_CHWIDTH_80_80) { 7984 phy_bw = WLAN_VHTOP_CHWIDTH_80; 7985 } 7986 7987 return phy_bw; 7988 } 7989 7990 enum phy_ch_width wlan_mlme_convert_he_6ghz_op_bw_to_phy_ch_width(uint8_t channel_width,uint8_t chan_id,uint8_t ccfs0,uint8_t ccfs1)7991 wlan_mlme_convert_he_6ghz_op_bw_to_phy_ch_width(uint8_t channel_width, 7992 uint8_t chan_id, 7993 uint8_t ccfs0, 7994 uint8_t ccfs1) 7995 { 7996 enum phy_ch_width phy_bw = CH_WIDTH_20MHZ; 7997 7998 if (channel_width == WLAN_HE_6GHZ_CHWIDTH_20) { 7999 phy_bw = CH_WIDTH_20MHZ; 8000 } else if (channel_width == WLAN_HE_6GHZ_CHWIDTH_40) { 8001 phy_bw = CH_WIDTH_40MHZ; 8002 } else if (channel_width == WLAN_HE_6GHZ_CHWIDTH_80) { 8003 phy_bw = CH_WIDTH_80MHZ; 8004 } else if (channel_width == WLAN_HE_6GHZ_CHWIDTH_160_80_80) { 8005 phy_bw = CH_WIDTH_160MHZ; 8006 /* 80+80 not supported */ 8007 if (ccfs1 && abs(ccfs0 - ccfs1) > 8) 8008 phy_bw = CH_WIDTH_80MHZ; 8009 } 8010 8011 return phy_bw; 8012 } 8013 8014 void wlan_mlme_set_edca_pifs_param(struct wlan_edca_pifs_param_ie * ep,enum host_edca_param_type type)8015 wlan_mlme_set_edca_pifs_param(struct wlan_edca_pifs_param_ie *ep, 8016 enum host_edca_param_type type) 8017 { 8018 ep->edca_param_type = type; 8019 8020 if (type == HOST_EDCA_PARAM_TYPE_AGGRESSIVE) { 8021 ep->edca_pifs_param.eparam.acvo_aifsn = CFG_EDCA_PARAM_AIFSN; 8022 ep->edca_pifs_param.eparam.acvo_acm = CFG_EDCA_PARAM_ACM; 8023 ep->edca_pifs_param.eparam.acvo_aci = CFG_EDCA_PARAM_ACI; 8024 ep->edca_pifs_param.eparam.acvo_cwmin = CFG_EDCA_PARAM_CWMIN; 8025 ep->edca_pifs_param.eparam.acvo_cwmax = CFG_EDCA_PARAM_CWMAX; 8026 ep->edca_pifs_param.eparam.acvo_txoplimit = CFG_EDCA_PARAM_TXOP; 8027 } else if (type == HOST_EDCA_PARAM_TYPE_PIFS) { 8028 ep->edca_pifs_param.pparam.sap_pifs_offset = 8029 CFG_PIFS_PARAM_SAP_OFFSET; 8030 ep->edca_pifs_param.pparam.leb_pifs_offset = 8031 CFG_PIFS_PARAM_LEB_OFFSET; 8032 ep->edca_pifs_param.pparam.reb_pifs_offset = 8033 CFG_PIFS_PARAM_REB_OFFSET; 8034 } 8035 } 8036 8037 QDF_STATUS wlan_mlme_stats_get_periodic_display_time(struct wlan_objmgr_psoc * psoc,uint32_t * periodic_display_time)8038 wlan_mlme_stats_get_periodic_display_time(struct wlan_objmgr_psoc *psoc, 8039 uint32_t *periodic_display_time) 8040 { 8041 struct wlan_mlme_psoc_ext_obj *mlme_obj; 8042 8043 mlme_obj = mlme_get_psoc_ext_obj(psoc); 8044 if (!mlme_obj) { 8045 *periodic_display_time = 8046 cfg_default(CFG_PERIODIC_STATS_DISPLAY_TIME); 8047 return QDF_STATUS_E_INVAL; 8048 } 8049 8050 *periodic_display_time = 8051 mlme_obj->cfg.stats.stats_periodic_display_time; 8052 8053 return QDF_STATUS_SUCCESS; 8054 } 8055 8056 bool wlan_mlme_is_bcn_prot_disabled_for_sap(struct wlan_objmgr_psoc * psoc)8057 wlan_mlme_is_bcn_prot_disabled_for_sap(struct wlan_objmgr_psoc *psoc) 8058 { 8059 struct wlan_mlme_psoc_ext_obj *mlme_obj; 8060 8061 mlme_obj = mlme_get_psoc_ext_obj(psoc); 8062 if (!mlme_obj) 8063 return cfg_default(CFG_DISABLE_SAP_BCN_PROT); 8064 8065 return mlme_obj->cfg.sap_cfg.disable_bcn_prot; 8066 } 8067 wlan_mlme_get_src_addr_from_frame(struct element_info * frame)8068 uint8_t *wlan_mlme_get_src_addr_from_frame(struct element_info *frame) 8069 { 8070 struct wlan_frame_hdr *hdr; 8071 8072 if (!frame || !frame->len || frame->len < WLAN_MAC_HDR_LEN_3A) 8073 return NULL; 8074 8075 hdr = (struct wlan_frame_hdr *)frame->ptr; 8076 8077 return hdr->i_addr2; 8078 } 8079 8080 bool wlan_mlme_get_sap_ps_with_twt(struct wlan_objmgr_psoc * psoc)8081 wlan_mlme_get_sap_ps_with_twt(struct wlan_objmgr_psoc *psoc) 8082 { 8083 struct wlan_mlme_psoc_ext_obj *mlme_obj; 8084 8085 mlme_obj = mlme_get_psoc_ext_obj(psoc); 8086 if (!mlme_obj) 8087 return cfg_default(CFG_SAP_PS_WITH_TWT); 8088 8089 return mlme_obj->cfg.sap_cfg.sap_ps_with_twt_enable; 8090 } 8091 8092 /** 8093 * set_omi_ch_width() - set OMI ch_bw/eht_ch_bw_ext bit value from channel width 8094 * @ch_width: channel width 8095 * @omi_data: Pointer to omi_data object 8096 * 8097 * If the channel width is 20Mhz, 40Mhz, 80Mhz, 160Mhz and 80+80Mhz ch_bw set 8098 * to 0, 1, 2, 3 accordingly, if channel width is 320Mhz then eht_ch_bw_ext 8099 * set to 1 8100 * 8101 * Return: QDF_STATUS_SUCCESS on success or QDF_STATUS_E_INVAL on failure 8102 */ 8103 static QDF_STATUS set_omi_ch_width(enum phy_ch_width ch_width,struct omi_ctrl_tx * omi_data)8104 set_omi_ch_width(enum phy_ch_width ch_width, struct omi_ctrl_tx *omi_data) 8105 { 8106 switch (ch_width) { 8107 case CH_WIDTH_20MHZ: 8108 omi_data->ch_bw = 0; 8109 break; 8110 case CH_WIDTH_40MHZ: 8111 omi_data->ch_bw = 1; 8112 break; 8113 case CH_WIDTH_80MHZ: 8114 omi_data->ch_bw = 2; 8115 break; 8116 case CH_WIDTH_160MHZ: 8117 case CH_WIDTH_80P80MHZ: 8118 omi_data->ch_bw = 3; 8119 break; 8120 case CH_WIDTH_320MHZ: 8121 omi_data->eht_ch_bw_ext = 1; 8122 break; 8123 default: 8124 return QDF_STATUS_E_INVAL; 8125 } 8126 8127 return QDF_STATUS_SUCCESS; 8128 } 8129 8130 QDF_STATUS wlan_mlme_set_ul_mu_config(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id,uint8_t ulmu_disable)8131 wlan_mlme_set_ul_mu_config(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id, 8132 uint8_t ulmu_disable) 8133 { 8134 struct omi_ctrl_tx omi_data = {0}; 8135 uint32_t param_val = 0; 8136 struct wlan_objmgr_pdev *pdev; 8137 struct wlan_objmgr_vdev *vdev; 8138 enum phy_ch_width ch_width; 8139 uint8_t rx_nss, tx_nsts; 8140 struct qdf_mac_addr macaddr = {0}; 8141 enum wlan_phymode peer_phymode; 8142 qdf_freq_t op_chan_freq; 8143 qdf_freq_t freq_seg_0; 8144 QDF_STATUS status = QDF_STATUS_SUCCESS; 8145 8146 vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id, 8147 WLAN_MLME_OBJMGR_ID); 8148 if (!vdev) { 8149 mlme_err("vdev %d: vdev is NULL", vdev_id); 8150 return QDF_STATUS_E_INVAL; 8151 } 8152 8153 pdev = wlan_vdev_get_pdev(vdev); 8154 if (!pdev) { 8155 mlme_err("pdev is NULL"); 8156 status = QDF_STATUS_E_INVAL; 8157 goto err; 8158 } 8159 8160 if (!cm_is_vdevid_connected(pdev, vdev_id)) { 8161 mlme_err("STA is not connected, Session_id: %d", vdev_id); 8162 status = QDF_STATUS_E_INVAL; 8163 goto err; 8164 } 8165 8166 status = wlan_vdev_get_bss_peer_mac(vdev, &macaddr); 8167 if (QDF_STATUS_SUCCESS != status) { 8168 mlme_err("Failed to get bss peer mac, Err : %d", status); 8169 goto err; 8170 } 8171 8172 status = mlme_get_peer_phymode(psoc, macaddr.bytes, &peer_phymode); 8173 if (QDF_STATUS_SUCCESS != status) { 8174 mlme_err("Failed to get peer phymode, Err : %d", status); 8175 goto err; 8176 } 8177 8178 if (!(IS_WLAN_PHYMODE_HE(peer_phymode) || 8179 IS_WLAN_PHYMODE_EHT(peer_phymode))) { 8180 mlme_err("Invalid mode"); 8181 status = QDF_STATUS_E_INVAL; 8182 goto err; 8183 } 8184 8185 status = wlan_mlme_get_sta_rx_nss(psoc, vdev, &rx_nss); 8186 if (QDF_STATUS_SUCCESS != status) { 8187 mlme_err("Failed to get sta_rx_nss, Err : %d", status); 8188 goto err; 8189 } 8190 8191 status = wlan_mlme_get_sta_tx_nss(psoc, vdev, &tx_nsts); 8192 if (QDF_STATUS_SUCCESS != status) { 8193 mlme_err("Failed to get sta_tx_nss, Err : %d", status); 8194 goto err; 8195 } 8196 8197 status = wlan_get_op_chan_freq_info_vdev_id(pdev, vdev_id, 8198 &op_chan_freq, 8199 &freq_seg_0, &ch_width); 8200 if (QDF_STATUS_SUCCESS != status) { 8201 mlme_err("Failed to get bw, Err : %d", status); 8202 goto err; 8203 } 8204 8205 omi_data.omi_in_vht = 0x1; 8206 omi_data.omi_in_he = 0x1; 8207 omi_data.a_ctrl_id = 0x1; 8208 8209 status = set_omi_ch_width(ch_width, &omi_data); 8210 if (QDF_STATUS_SUCCESS != status) { 8211 mlme_err("Failed to set bw, Err : %d", status); 8212 goto err; 8213 } 8214 8215 omi_data.rx_nss = rx_nss - 1; 8216 omi_data.tx_nsts = tx_nsts - 1; 8217 omi_data.ul_mu_dis = ulmu_disable; 8218 omi_data.ul_mu_data_dis = 0; 8219 8220 qdf_mem_copy(¶m_val, &omi_data, sizeof(omi_data)); 8221 8222 mlme_debug("OMI: BW %d TxNSTS %d RxNSS %d ULMU %d OMI_VHT %d OMI_HE %d, EHT OMI: BW %d RxNSS %d TxNSS %d, param val: %08X, bssid:" QDF_MAC_ADDR_FMT, 8223 omi_data.ch_bw, omi_data.tx_nsts, omi_data.rx_nss, 8224 omi_data.ul_mu_dis, omi_data.omi_in_vht, omi_data.omi_in_he, 8225 omi_data.eht_ch_bw_ext, omi_data.eht_rx_nss_ext, 8226 omi_data.eht_tx_nss_ext, param_val, 8227 QDF_MAC_ADDR_REF(macaddr.bytes)); 8228 8229 status = wlan_util_vdev_peer_set_param_send(vdev, macaddr.bytes, 8230 WMI_PEER_PARAM_XMIT_OMI, 8231 param_val); 8232 if (QDF_STATUS_SUCCESS != status) 8233 mlme_err("set_peer_param_cmd returned %d", status); 8234 8235 err: 8236 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID); 8237 return status; 8238 } 8239 8240 uint32_t wlan_mlme_assemble_rate_code(uint8_t preamble,uint8_t nss,uint8_t rate)8241 wlan_mlme_assemble_rate_code(uint8_t preamble, uint8_t nss, uint8_t rate) 8242 { 8243 uint32_t set_value; 8244 8245 if (wma_get_fw_wlan_feat_caps(DOT11AX)) 8246 set_value = ASSEMBLE_RATECODE_V1(preamble, nss, rate); 8247 else 8248 set_value = (preamble << 6) | (nss << 4) | rate; 8249 8250 return set_value; 8251 } 8252 8253 QDF_STATUS wlan_mlme_set_ap_oper_ch_width(struct wlan_objmgr_vdev * vdev,enum phy_ch_width ch_width)8254 wlan_mlme_set_ap_oper_ch_width(struct wlan_objmgr_vdev *vdev, 8255 enum phy_ch_width ch_width) 8256 8257 { 8258 struct mlme_legacy_priv *mlme_priv; 8259 8260 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 8261 if (!mlme_priv) { 8262 mlme_legacy_err("vdev %d legacy private object is NULL", 8263 wlan_vdev_get_id(vdev)); 8264 return QDF_STATUS_E_FAILURE; 8265 } 8266 8267 mlme_priv->mlme_ap.oper_ch_width = ch_width; 8268 mlme_debug("SAP oper ch_width: %d, vdev %d", 8269 mlme_priv->mlme_ap.oper_ch_width, wlan_vdev_get_id(vdev)); 8270 8271 return QDF_STATUS_SUCCESS; 8272 } 8273 8274 enum phy_ch_width wlan_mlme_get_ap_oper_ch_width(struct wlan_objmgr_vdev * vdev)8275 wlan_mlme_get_ap_oper_ch_width(struct wlan_objmgr_vdev *vdev) 8276 { 8277 struct mlme_legacy_priv *mlme_priv; 8278 8279 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 8280 if (!mlme_priv) { 8281 mlme_legacy_err("vdev %d legacy private object is NULL", 8282 wlan_vdev_get_id(vdev)); 8283 return CH_WIDTH_INVALID; 8284 } 8285 8286 return mlme_priv->mlme_ap.oper_ch_width; 8287 } 8288 8289 QDF_STATUS wlan_mlme_send_csa_event_status_ind(struct wlan_objmgr_vdev * vdev,uint8_t csa_status)8290 wlan_mlme_send_csa_event_status_ind(struct wlan_objmgr_vdev *vdev, 8291 uint8_t csa_status) 8292 { 8293 return wlan_mlme_send_csa_event_status_ind_cmd(vdev, csa_status); 8294 } 8295 8296 #ifdef WLAN_FEATURE_11BE 8297 QDF_STATUS wlan_mlme_get_bw_no_punct(struct wlan_objmgr_psoc * psoc,struct wlan_objmgr_vdev * vdev,struct wlan_channel * bss_chan,enum phy_ch_width * new_ch_width)8298 wlan_mlme_get_bw_no_punct(struct wlan_objmgr_psoc *psoc, 8299 struct wlan_objmgr_vdev *vdev, 8300 struct wlan_channel *bss_chan, 8301 enum phy_ch_width *new_ch_width) 8302 { 8303 uint16_t new_punct_bitmap = 0; 8304 enum phy_ch_width ch_width; 8305 QDF_STATUS status = QDF_STATUS_E_FAILURE; 8306 uint8_t country[REG_ALPHA2_LEN + 1]; 8307 8308 if (!wlan_mlme_get_eht_disable_punct_in_us_lpi(psoc)) 8309 return status; 8310 8311 wlan_reg_read_current_country(psoc, country); 8312 8313 if (!wlan_reg_is_6ghz_chan_freq(bss_chan->ch_freq) || 8314 !bss_chan->puncture_bitmap || 8315 qdf_mem_cmp(country, "US", REG_ALPHA2_LEN) || 8316 mlme_get_best_6g_power_type(vdev) != REG_INDOOR_AP || 8317 !IS_WLAN_PHYMODE_EHT(bss_chan->ch_phymode)) 8318 goto err; 8319 8320 ch_width = bss_chan->ch_width; 8321 8322 while (ch_width != CH_WIDTH_INVALID) { 8323 status = wlan_reg_extract_puncture_by_bw(bss_chan->ch_width, 8324 bss_chan->puncture_bitmap, 8325 bss_chan->ch_freq, 8326 bss_chan->ch_cfreq2, 8327 ch_width, 8328 &new_punct_bitmap); 8329 if (QDF_IS_STATUS_SUCCESS(status) && new_punct_bitmap) 8330 ch_width = wlan_get_next_lower_bandwidth(ch_width); 8331 else 8332 break; 8333 } 8334 8335 if (ch_width == bss_chan->ch_width) 8336 return QDF_STATUS_E_FAILURE; 8337 8338 mlme_debug("freq %d ccfs2 %d punct 0x%x BW old %d, new %d", 8339 bss_chan->ch_freq, bss_chan->ch_cfreq2, bss_chan->puncture_bitmap, 8340 bss_chan->ch_width, ch_width); 8341 8342 *new_ch_width = ch_width; 8343 bss_chan->puncture_bitmap = 0; 8344 err: 8345 return status; 8346 } 8347 8348 QDF_STATUS wlan_mlme_update_bw_no_punct(struct wlan_objmgr_psoc * psoc,uint8_t vdev_id)8349 wlan_mlme_update_bw_no_punct(struct wlan_objmgr_psoc *psoc, 8350 uint8_t vdev_id) 8351 { 8352 struct wlan_objmgr_vdev *vdev; 8353 QDF_STATUS status = QDF_STATUS_E_FAILURE; 8354 enum phy_ch_width new_ch_width; 8355 struct wlan_objmgr_pdev *pdev; 8356 8357 if (!wlan_mlme_get_eht_disable_punct_in_us_lpi(psoc)) 8358 return status; 8359 8360 pdev = wlan_objmgr_get_pdev_by_id(psoc, 0, 8361 WLAN_MLME_NB_ID); 8362 if (!pdev) { 8363 sme_err("pdev is NULL"); 8364 return QDF_STATUS_E_FAILURE; 8365 } 8366 vdev = wlan_objmgr_get_vdev_by_id_from_pdev(pdev, vdev_id, 8367 WLAN_MLME_NB_ID); 8368 if (!vdev) { 8369 mlme_err("VDEV not found for vdev id : %d", vdev_id); 8370 goto rel_pdev; 8371 } 8372 8373 status = wlan_mlme_get_bw_no_punct(psoc, vdev, 8374 wlan_vdev_mlme_get_des_chan(vdev), 8375 &new_ch_width); 8376 if (QDF_IS_STATUS_ERROR(status)) 8377 goto rel_vdev; 8378 8379 status = wlan_mlme_send_ch_width_update_with_notify(psoc, 8380 vdev, 8381 vdev_id, 8382 new_ch_width); 8383 rel_vdev: 8384 wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_NB_ID); 8385 rel_pdev: 8386 wlan_objmgr_pdev_release_ref(pdev, WLAN_MLME_NB_ID); 8387 8388 return status; 8389 } 8390 #endif 8391 8392 QDF_STATUS wlan_mlme_is_hs_20_btm_offload_disabled(struct wlan_objmgr_psoc * psoc,bool * val)8393 wlan_mlme_is_hs_20_btm_offload_disabled(struct wlan_objmgr_psoc *psoc, 8394 bool *val) 8395 { 8396 struct wlan_mlme_psoc_ext_obj *mlme_obj; 8397 8398 mlme_obj = mlme_get_psoc_ext_obj(psoc); 8399 if (!mlme_obj) { 8400 *val = cfg_default(CFG_HS_20_BTM_OFFLOAD_DISABLE); 8401 return QDF_STATUS_E_INVAL; 8402 } 8403 8404 *val = mlme_obj->cfg.lfr.hs20_btm_offload_disable; 8405 8406 return QDF_STATUS_SUCCESS; 8407 } 8408 wlan_mlme_set_keepalive_period(struct wlan_objmgr_vdev * vdev,uint16_t keep_alive_period)8409 void wlan_mlme_set_keepalive_period(struct wlan_objmgr_vdev *vdev, 8410 uint16_t keep_alive_period) 8411 { 8412 struct mlme_legacy_priv *mlme_priv; 8413 8414 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 8415 if (!mlme_priv) { 8416 mlme_err("vdev legacy private object is NULL"); 8417 return; 8418 } 8419 8420 mlme_priv->keep_alive_period = keep_alive_period; 8421 } 8422 wlan_mlme_get_keepalive_period(struct wlan_objmgr_vdev * vdev)8423 uint16_t wlan_mlme_get_keepalive_period(struct wlan_objmgr_vdev *vdev) 8424 { 8425 struct mlme_legacy_priv *mlme_priv; 8426 8427 mlme_priv = wlan_vdev_mlme_get_ext_hdl(vdev); 8428 if (!mlme_priv) { 8429 mlme_err("vdev legacy private object is NULL"); 8430 return 0; 8431 } 8432 8433 return mlme_priv->keep_alive_period; 8434 } 8435