From e314029ccfa99d857e222e3bdc100b1227c5c654 Mon Sep 17 00:00:00 2001 From: gaurank kathpalia Date: Tue, 12 Nov 2019 16:44:31 +0530 Subject: [PATCH] qcacld-3.0: Enable the DBS ini if DBS is mandatory The driver does not check the device DBS capability and the DBS ini compatibility. If the DBS ini gDualMacFeatureDisable is disabled and HW mandates DBS capability then overide the ini to always keep it enable. Change-Id: I2b31453f9c8a04cef7f943b30d3c28f844c276b5 CRs-Fixed: 2551644 --- .../policy_mgr/inc/wlan_policy_mgr_api.h | 13 ++++++ .../src/wlan_policy_mgr_get_set_utils.c | 18 ++++++++- .../policy_mgr/src/wlan_policy_mgr_i.h | 10 +++++ core/wma/src/wma_main.c | 40 +++++++++++++++++++ 4 files changed, 80 insertions(+), 1 deletion(-) diff --git a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h index e0161d1a78af5..a28e33af55c55 100644 --- a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h +++ b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h @@ -151,6 +151,19 @@ policy_mgr_get_enable_overlap_chnl(struct wlan_objmgr_psoc *psoc, */ QDF_STATUS policy_mgr_get_dual_mac_feature(struct wlan_objmgr_psoc *psoc, uint8_t *dual_mac_feature); + +/** + * policy_mgr_set_dual_mac_feature() - to set the dual mac feature value + * @psoc: pointer to psoc + * @dual_mac_feature: value to be updated + * + * This API is used to update the dual mac (dual radio) specific feature value + * + * Return: QDF_STATUS_SUCCESS up on success and any other status for failure. + */ +QDF_STATUS policy_mgr_set_dual_mac_feature(struct wlan_objmgr_psoc *psoc, + uint8_t dual_mac_feature); + /** * policy_mgr_get_force_1x1() - to find out if 1x1 connection is enforced * diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c index a79ac5c724dd3..e8bc517adf906 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c @@ -71,6 +71,22 @@ policy_mgr_get_enable_overlap_chnl(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } +QDF_STATUS policy_mgr_set_dual_mac_feature(struct wlan_objmgr_psoc *psoc, + uint8_t dual_mac_feature) +{ + struct policy_mgr_psoc_priv_obj *pm_ctx; + + pm_ctx = policy_mgr_get_context(psoc); + if (!pm_ctx) { + policy_mgr_err("pm_ctx is NULL"); + return QDF_STATUS_E_FAILURE; + } + + pm_ctx->cfg.dual_mac_feature = dual_mac_feature; + + return QDF_STATUS_SUCCESS; +} + QDF_STATUS policy_mgr_get_dual_mac_feature(struct wlan_objmgr_psoc *psoc, uint8_t *dual_mac_feature) { @@ -856,7 +872,7 @@ bool policy_mgr_find_if_fw_supports_dbs(struct wlan_objmgr_psoc *psoc) return true; } -static bool policy_mgr_find_if_hwlist_has_dbs(struct wlan_objmgr_psoc *psoc) +bool policy_mgr_find_if_hwlist_has_dbs(struct wlan_objmgr_psoc *psoc) { struct policy_mgr_psoc_priv_obj *pm_ctx; uint32_t param, i, found = 0; diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h index 868985bb93ba7..85ef6c1fc21c6 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h @@ -396,6 +396,16 @@ QDF_STATUS policy_mgr_get_updated_fw_mode_config( bool policy_mgr_is_dual_mac_disabled_in_ini( struct wlan_objmgr_psoc *psoc); +/** + * policy_mgr_find_if_hwlist_has_dbs() - Find if hw list has DBS modes or not + * @psoc: PSOC object information + * + * Find if hw list has DBS modes or not + * + * Return: true or false + */ +bool policy_mgr_find_if_hwlist_has_dbs(struct wlan_objmgr_psoc *psoc); + /** * policy_mgr_get_mcc_to_scc_switch_mode() - MCC to SCC * switch mode value in the user config diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index c1a635334d99f..4b65cddc7fd2c 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -98,6 +98,7 @@ #include "nan_ucfg_api.h" #include "wma_coex.h" #include "target_if_vdev_mgr_rx_ops.h" +#include "wlan_policy_mgr_i.h" #ifdef DIRECT_BUF_RX_ENABLE #include @@ -5396,6 +5397,40 @@ static void wma_update_mlme_related_tgt_caps(struct wlan_objmgr_psoc *psoc, wlan_mlme_update_cfg_with_tgt_caps(psoc, &mlme_tgt_cfg); } +static bool +wma_is_dbs_mandatory(struct wlan_objmgr_psoc *psoc, + struct target_psoc_info *tgt_hdl) +{ + uint8_t i, total_mac_phy_cnt; + struct wlan_psoc_host_mac_phy_caps *mac_cap, *mac_phy_cap; + uint8_t supported_band = 0; + + if (!policy_mgr_find_if_fw_supports_dbs(psoc) || + !policy_mgr_find_if_hwlist_has_dbs(psoc)) + return false; + + total_mac_phy_cnt = target_psoc_get_total_mac_phy_cnt(tgt_hdl); + mac_phy_cap = target_psoc_get_mac_phy_cap(tgt_hdl); + + for (i = 0; i < total_mac_phy_cnt; i++) { + mac_cap = &mac_phy_cap[i]; + if (mac_cap->phy_id == 0) + supported_band |= mac_cap->supported_bands; + } + + /* If Mac0 supports both the bands then DBS is not mandatory */ + if (supported_band & WLAN_2G_CAPABILITY && + supported_band & WLAN_5G_CAPABILITY) { + wma_debug("Mac0 supports both bands DBS is optional"); + return false; + } + + wma_info("MAC0 does not support both bands %d DBS is mandatory", + supported_band); + + return true; +} + /** * wma_update_hdd_cfg() - update HDD config * @wma_handle: wma handle @@ -6696,6 +6731,11 @@ int wma_rx_service_ready_ext_event(void *handle, uint8_t *event, WMA_LOGD("WMA --> WMI_INIT_CMDID"); + if (wma_is_dbs_mandatory(wma_handle->psoc, tgt_hdl) && + (policy_mgr_is_dual_mac_disabled_in_ini(wma_handle->psoc))) + policy_mgr_set_dual_mac_feature(wma_handle->psoc, + ENABLE_DBS_CXN_AND_DISABLE_SIMULTANEOUS_SCAN); + wma_init_scan_fw_mode_config(wma_handle->psoc, conc_scan_config_bits, fw_config_bits);