diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 652e0518a98d..636bbda4777f 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -3503,27 +3503,43 @@ int hdd_set_ldpc(struct hdd_adapter *adapter, int value) { tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); int ret; + QDF_STATUS status; + uint32_t cfg_value; + struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + struct hdd_config *config = hdd_ctx->config; + union { + uint16_t cfg_value16; + tSirMacHTCapabilityInfo ht_cap_info; + } u; hdd_debug("%d", value); if (value) { /* make sure HT capabilities allow this */ - QDF_STATUS status; - uint32_t cfg_value; - union { - uint16_t cfg_value16; - tSirMacHTCapabilityInfo ht_cap_info; - } u; - - status = sme_cfg_get_int(hal, WNI_CFG_HT_CAP_INFO, &cfg_value); - if (QDF_STATUS_SUCCESS != status) { - hdd_err("Failed to get HT capability info"); - return -EIO; - } - u.cfg_value16 = cfg_value & 0xFFFF; - if (!u.ht_cap_info.advCodingCap) { + if (!config->enable_rx_ldpc) { hdd_err("LDCP not supported"); return -EINVAL; } + } else if (!config->enable_rx_ldpc) { + hdd_err("LDCP is already disabled"); + return 0; + } + status = sme_cfg_get_int(hal, WNI_CFG_HT_CAP_INFO, &cfg_value); + if (QDF_STATUS_SUCCESS != status) { + hdd_err("Failed to get HT capability info"); + return -EIO; + } + u.cfg_value16 = cfg_value & 0xFFFF; + + u.ht_cap_info.advCodingCap = value; + status = sme_cfg_set_int(hal, WNI_CFG_HT_CAP_INFO, u.cfg_value16); + if (QDF_STATUS_SUCCESS != status) { + hdd_err("Failed to set HT capability info"); + return -EIO; + } + status = sme_cfg_set_int(hal, WNI_CFG_VHT_LDPC_CODING_CAP, value); + if (QDF_STATUS_SUCCESS != status) { + hdd_err("Failed to set VHT LDPC capability info"); + return -EIO; } ret = sme_update_ht_config(hal, adapter->session_id, @@ -3531,6 +3547,9 @@ int hdd_set_ldpc(struct hdd_adapter *adapter, int value) value); if (ret) hdd_err("Failed to set LDPC value"); + ret = sme_update_he_ldpc_supp(hal, adapter->session_id, value); + if (ret) + hdd_err("Failed to set HE LDPC value"); return ret; } diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 1444a45535c9..72b4f13fa64f 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -2155,6 +2155,17 @@ int sme_update_he_rx_stbc_cap(tHalHandle hal, uint8_t session_id, int value); */ int sme_update_he_frag_supp(tHalHandle hal, uint8_t session_id, uint16_t he_frag); + +/** + * sme_update_he_ldpc_supp() - sets the HE LDPC support + * @hal: Pointer to HAL + * @session_id: SME session id + * @he_ldpc: HE LDPC support value + * + * Return: 0 on success else err code + */ +int sme_update_he_ldpc_supp(tHalHandle hal, uint8_t session_id, + uint16_t he_ldpc); #else static inline void sme_update_he_cap_nss(tHalHandle hal, uint8_t session_id, uint8_t nss) @@ -2181,6 +2192,11 @@ static inline int sme_update_he_frag_supp(tHalHandle hal, uint8_t session_id, { return 0; } +static inline int sme_update_he_ldpc_supp(tHalHandle hal, uint8_t session_id, + uint16_t he_ldpc) +{ + return 0; +} #endif /** diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index f99751b5b010..fee0f7ceb214 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -9698,6 +9698,7 @@ int sme_update_ht_config(tHalHandle hHal, uint8_t sessionId, uint16_t htCapab, switch (htCapab) { case WNI_CFG_HT_CAP_INFO_ADVANCE_CODING: pSession->htConfig.ht_rx_ldpc = value; + pMac->roam.configParam.rx_ldpc_enable = value; break; case WNI_CFG_HT_CAP_INFO_TX_STBC: pSession->htConfig.ht_tx_stbc = value; @@ -13078,6 +13079,12 @@ int sme_update_he_frag_supp(tHalHandle hal, uint8_t session_id, return sme_update_he_cap(hal, session_id, WNI_CFG_HE_FRAGMENTATION, he_frag); } + +int sme_update_he_ldpc_supp(tHalHandle hal, uint8_t session_id, + uint16_t he_ldpc) +{ + return sme_update_he_cap(hal, session_id, WNI_CFG_HE_LDPC, he_ldpc); +} #endif /**