From 2f9e7536a6e53639d03d5c848d4092628f468fed Mon Sep 17 00:00:00 2001 From: Jianmin Zhu Date: Mon, 21 Jan 2019 15:39:50 +0800 Subject: [PATCH] qcacld-3.0: Update 2g vht20 cfg by target capability Only when F/W indicates 2g vht20 supported and ini config gEnableVhtFor24GHzBand=1, 2g vht20 can be enabled. Steps: For chips wmi_service_ext_msg supported: 1. hdd_component_psoc_open->mlme_cfg_on_psoc_enable-> mlme_init_vht_cap_cfg, read and save ini cfg: gEnableVhtFor24GHzBand. 2. WMI_SERVICE_READY_EXT_EVENT indicates 2g vht20 capability by mac_phy_caps->vht_cap_info_2G. 3. init_deinit_populate_mac_phy_capability calls extract_mac_phy_cap_service_ready_ext_tlv to extract vht_cap_info_2G, and set to psoc->tgt_if_handle->info.mac_phy_cap. 4. hdd_update_tgt_cfg->hdd_update_vhtcap_2g-> wma_get_caps_for_phyidx_hwmode, get target capability, and combine ini cfg, update 2g vht20 cfg in mlme. For chips wmi_service_ext_msg unsupported: 1. hdd_component_psoc_open->mlme_cfg_on_psoc_enable-> mlme_init_vht_cap_cfg, read and save ini cfg: gEnableVhtFor24GHzBand. 2. WMI_SERVICE_READY_EVENT indicates 2g vht20 capability by hal_reg_capabilities-> wireless_modes REGDMN_MODE_11AC_VHT20_2G bit. 3. init_deinit_populate_phy_reg_cap calls wmi_extract_hal_reg_cap to extract hal_reg_capabilities, and set to regulatory component by ucfg_reg_set_hal_reg_cap, saved in wlan_regulatory_psoc_priv_obj->reg_cap. 4. hdd_update_tgt_cfg->hdd_update_vhtcap_2g, get and target capability and combine ini cfg, update 2g vht20 cfg in mlme. Change-Id: Id4f2edd129bb1eefec3e39b4246c5f52b2b4124a CRs-Fixed: 2384842 --- .../mlme/dispatcher/inc/wlan_mlme_ucfg_api.h | 15 ++---- core/hdd/src/wlan_hdd_main.c | 46 +++++++++++++------ 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h index 0dd47fbe5388..95283bad3ecb 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h @@ -2314,12 +2314,9 @@ ucfg_mlme_get_vht_enable_gid(struct wlan_objmgr_psoc *psoc, bool *value) } /** - * ucfg_mlme_get_vht_for_24ghz() - Enables/disables vht for 24ghz + * ucfg_mlme_get_vht_for_24ghz() - Get mlme cfg of vht for 24ghz * @psoc: psoc context - * @value: data to be set - * - * Inline UCFG API to be used by HDD/OSIF callers to get the - * ignore_peer_ht_opmode flag value + * @value: data to get * * Return: QDF_STATUS_SUCCESS or QDF_STATUS_FAILURE */ @@ -2334,9 +2331,6 @@ ucfg_mlme_get_vht_for_24ghz(struct wlan_objmgr_psoc *psoc, bool *value) * @psoc: psoc context * @value: data to be set * - * Inline UCFG API to be used by HDD/OSIF callers to set the - * ignore_peer_ht_opmode flag value - * * Return: QDF_STATUS_SUCCESS or QDF_STATUS_FAILURE */ static inline QDF_STATUS @@ -2346,13 +2340,10 @@ ucfg_mlme_set_vht_for_24ghz(struct wlan_objmgr_psoc *psoc, bool value) } /** - * ucfg_mlme_get_vendor_vht_for_24ghz() - Enables/disables vendor vht for 24ghz + * ucfg_mlme_get_vendor_vht_for_24ghz() - Get mlme cfg of vendor vht for 24ghz * @psoc: psoc context * @value: data to be set * - * Inline UCFG API to be used by HDD/OSIF callers to get the - * ignore_peer_ht_opmode flag value - * * Return: QDF_STATUS_SUCCESS or QDF_STATUS_FAILURE */ static inline QDF_STATUS diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 3dbb5807563b..dfb17bf16646 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -1775,29 +1775,52 @@ static void hdd_sar_target_config(struct hdd_context *hdd_ctx, static void hdd_update_vhtcap_2g(struct hdd_context *hdd_ctx) { - uint32_t chip_mode; + uint32_t chip_mode = 0; QDF_STATUS status; - bool b24ghz_band; + bool b2g_vht_cfg = false; + bool b2g_vht_target = false; + struct wma_caps_per_phy caps_per_phy; + struct wmi_unified *wmi_handle; - status = wlan_reg_get_chip_mode(hdd_ctx->pdev, &chip_mode); - if (QDF_IS_STATUS_ERROR(status)) { - hdd_err("Failed to get chip mode"); + wmi_handle = get_wmi_unified_hdl_from_psoc(hdd_ctx->psoc); + if (!wmi_handle) { + hdd_err("wmi handle is NULL"); return; } - status = ucfg_mlme_get_vht_for_24ghz(hdd_ctx->psoc, &b24ghz_band); + + status = ucfg_mlme_get_vht_for_24ghz(hdd_ctx->psoc, &b2g_vht_cfg); if (QDF_IS_STATUS_ERROR(status)) { hdd_err("Failed to get 2g vht mode"); return; } + if (wmi_service_enabled(wmi_handle, wmi_service_ext_msg)) { + status = wma_get_caps_for_phyidx_hwmode(&caps_per_phy, + HW_MODE_DBS_NONE, + CDS_BAND_ALL); + if (QDF_IS_STATUS_ERROR(status)) { + hdd_err("Failed to get phy caps"); + return; + } + if (caps_per_phy.vht_2g) + b2g_vht_target = true; + } else { + status = wlan_reg_get_chip_mode(hdd_ctx->pdev, &chip_mode); + if (QDF_IS_STATUS_ERROR(status)) { + hdd_err("Failed to get chip mode"); + return; + } + b2g_vht_target = + (chip_mode & WMI_HOST_REGDMN_MODE_11AC_VHT20_2G) ? + true : false; + } - b24ghz_band = b24ghz_band && - (chip_mode & WMI_HOST_REGDMN_MODE_11AC_VHT20); - status = ucfg_mlme_set_vht_for_24ghz(hdd_ctx->psoc, b24ghz_band); + b2g_vht_cfg = b2g_vht_cfg && b2g_vht_target; + hdd_debug("vht 2g target: %d, cfg: %d", b2g_vht_target, b2g_vht_cfg); + status = ucfg_mlme_set_vht_for_24ghz(hdd_ctx->psoc, b2g_vht_cfg); if (QDF_IS_STATUS_ERROR(status)) { hdd_err("Failed to update 2g vht mode"); return; } - hdd_debug("2g vht20: %d", b24ghz_band); } void hdd_update_tgt_cfg(hdd_handle_t hdd_handle, struct wma_tgt_cfg *cfg) @@ -2017,9 +2040,6 @@ void hdd_update_tgt_cfg(hdd_handle_t hdd_handle, struct wma_tgt_cfg *cfg) */ hdd_update_wiphy_vhtcap(hdd_ctx); - /* - * Update 2g vht capability - */ hdd_update_vhtcap_2g(hdd_ctx); hdd_ctx->wmi_max_len = cfg->wmi_max_len;