diff --git a/components/mlme/dispatcher/src/wlan_mlme_api.c b/components/mlme/dispatcher/src/wlan_mlme_api.c index f447f7296010..470527856fd1 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_api.c @@ -876,7 +876,7 @@ QDF_STATUS wlan_mlme_configure_chain_mask(struct wlan_objmgr_psoc *psoc, { int ret_val; uint8_t ch_msk_val; - struct wma_caps_per_phy non_dbs_phy_cap; + struct wma_caps_per_phy non_dbs_phy_cap = {0}; struct wlan_mlme_psoc_ext_obj *mlme_obj = mlme_get_psoc_ext_obj(psoc); QDF_STATUS status; bool enable2x2, as_enabled, enable_bt_chain_sep; diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 356e73cbe3d4..c5a4f5129146 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -1748,7 +1748,7 @@ static void hdd_update_tgt_vht_cap(struct hdd_context *hdd_ctx, struct ieee80211_supported_band *band_5g = wiphy->bands[HDD_NL80211_BAND_5GHZ]; uint32_t ch_width; - struct wma_caps_per_phy caps_per_phy; + struct wma_caps_per_phy caps_per_phy = {0}; if (!band_5g) { hdd_debug("5GHz band disabled, skipping capability population"); @@ -1879,7 +1879,7 @@ static void hdd_update_vhtcap_2g(struct hdd_context *hdd_ctx) QDF_STATUS status; bool b2g_vht_cfg = false; bool b2g_vht_target = false; - struct wma_caps_per_phy caps_per_phy; + struct wma_caps_per_phy caps_per_phy = {0}; struct wmi_unified *wmi_handle; wmi_handle = get_wmi_unified_hdl_from_psoc(hdd_ctx->psoc); diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index f2c22e2b4976..03e00b6974de 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -5932,56 +5932,6 @@ free_hw_mode_list: } -/** - * wma_get_phyid_for_given_band() - to get phyid for band - * - * @wma_handle: Pointer to wma handle -* @tgt_hdl: target psoc information - * @band: enum value of for 2G or 5G band - * @phyid: Pointer to phyid which needs to be filled - * - * This API looks in to the map to find out which particular phy supports - * provided band and return the idx (also called phyid) of that phy. Caller - * use this phyid to fetch various caps of that phy - * - * Return: QDF_STATUS - */ -static QDF_STATUS wma_get_phyid_for_given_band( - tp_wma_handle wma_handle, - struct target_psoc_info *tgt_hdl, - enum cds_band_type band, uint8_t *phyid) -{ - uint8_t idx, i, total_mac_phy_cnt; - struct wlan_psoc_host_mac_phy_caps *mac_phy_cap; - - if (!wma_handle) { - WMA_LOGE("Invalid wma handle"); - return QDF_STATUS_E_FAILURE; - } - - idx = 0; - *phyid = idx; - 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++) { - if ((band == CDS_BAND_2GHZ) && - (WLAN_2G_CAPABILITY == mac_phy_cap[idx + i].supported_bands)) { - *phyid = idx + i; - WMA_LOGD("Select 2G capable phyid[%d]", *phyid); - return QDF_STATUS_SUCCESS; - } else if ((band == CDS_BAND_5GHZ) && - (WLAN_5G_CAPABILITY == mac_phy_cap[idx + i].supported_bands)) { - *phyid = idx + i; - WMA_LOGD("Select 5G capable phyid[%d]", *phyid); - return QDF_STATUS_SUCCESS; - } - } - WMA_LOGD("Using default single hw mode phyid[%d] total_mac_phy_cnt %d", - *phyid, total_mac_phy_cnt); - return QDF_STATUS_SUCCESS; -} - /** * wma_get_caps_for_phyidx_hwmode() - to fetch caps for given hw mode and band * @caps_per_phy: Pointer to capabilities structure which needs to be filled @@ -6000,9 +5950,10 @@ QDF_STATUS wma_get_caps_for_phyidx_hwmode(struct wma_caps_per_phy *caps_per_phy, t_wma_handle *wma_handle = cds_get_context(QDF_MODULE_ID_WMA); struct target_psoc_info *tgt_hdl; int ht_cap_info, vht_cap_info; - uint8_t phyid, our_hw_mode = hw_mode, num_hw_modes; + uint8_t our_hw_mode = hw_mode, num_hw_modes; struct wlan_psoc_host_mac_phy_caps *mac_phy_cap; struct wlan_psoc_target_capability_info *tgt_cap_info; + uint8_t total_mac_phy_cnt, i; if (!wma_handle) { WMA_LOGE("Invalid wma handle"); @@ -6014,6 +5965,10 @@ QDF_STATUS wma_get_caps_for_phyidx_hwmode(struct wma_caps_per_phy *caps_per_phy, WMA_LOGE("%s: target psoc info is NULL", __func__); return -EINVAL; } + if (!caps_per_phy) { + WMA_LOGE("Invalid caps pointer"); + return QDF_STATUS_E_FAILURE; + } ht_cap_info = target_if_get_ht_cap_info(tgt_hdl); vht_cap_info = target_if_get_vht_cap_info(tgt_hdl); @@ -6047,31 +6002,56 @@ QDF_STATUS wma_get_caps_for_phyidx_hwmode(struct wma_caps_per_phy *caps_per_phy, if (!policy_mgr_is_dbs_enable(wma_handle->psoc)) our_hw_mode = HW_MODE_DBS_NONE; - if (!caps_per_phy) { - WMA_LOGE("Invalid caps pointer"); - return QDF_STATUS_E_FAILURE; + total_mac_phy_cnt = target_psoc_get_total_mac_phy_cnt(tgt_hdl); + for (i = 0; i < total_mac_phy_cnt; i++) { + if (our_hw_mode == HW_MODE_DBS && + mac_phy_cap[i].hw_mode_config_type != WMI_HW_MODE_DBS) + continue; + + if ((band == CDS_BAND_2GHZ || band == CDS_BAND_ALL) && + (WLAN_2G_CAPABILITY & mac_phy_cap[i].supported_bands) && + !caps_per_phy->tx_chain_mask_2G) { + caps_per_phy->ht_2g = mac_phy_cap[i].ht_cap_info_2G; + caps_per_phy->vht_2g = mac_phy_cap[i].vht_cap_info_2G; + qdf_mem_copy(caps_per_phy->he_2g, + mac_phy_cap[i].he_cap_info_2G, + sizeof(caps_per_phy->he_2g)); + + caps_per_phy->tx_chain_mask_2G = + mac_phy_cap[i].tx_chain_mask_2G; + caps_per_phy->rx_chain_mask_2G = + mac_phy_cap[i].rx_chain_mask_2G; + + WMA_LOGD("Select 2G capable phyid[%d] chain %d %d ht 0x%x vht 0x%x", + i, + caps_per_phy->tx_chain_mask_2G, + caps_per_phy->rx_chain_mask_2G, + caps_per_phy->ht_2g, + caps_per_phy->vht_2g); + } + if ((band == CDS_BAND_5GHZ || band == CDS_BAND_ALL) && + (WLAN_5G_CAPABILITY & mac_phy_cap[i].supported_bands) && + !caps_per_phy->tx_chain_mask_5G) { + caps_per_phy->ht_5g = mac_phy_cap[i].ht_cap_info_5G; + caps_per_phy->vht_5g = mac_phy_cap[i].vht_cap_info_5G; + qdf_mem_copy(caps_per_phy->he_5g, + mac_phy_cap[i].he_cap_info_5G, + sizeof(caps_per_phy->he_5g)); + + caps_per_phy->tx_chain_mask_5G = + mac_phy_cap[i].tx_chain_mask_5G; + caps_per_phy->rx_chain_mask_5G = + mac_phy_cap[i].rx_chain_mask_5G; + + WMA_LOGD("Select 5G capable phyid[%d] chain %d %d ht 0x%x vht 0x%x", + i, + caps_per_phy->tx_chain_mask_5G, + caps_per_phy->rx_chain_mask_5G, + caps_per_phy->ht_5g, + caps_per_phy->vht_5g); + } } - if (QDF_STATUS_SUCCESS != - wma_get_phyid_for_given_band(wma_handle, tgt_hdl, band, &phyid)) { - WMA_LOGE("Invalid phyid"); - return QDF_STATUS_E_FAILURE; - } - - caps_per_phy->ht_2g = mac_phy_cap[phyid].ht_cap_info_2G; - caps_per_phy->ht_5g = mac_phy_cap[phyid].ht_cap_info_5G; - caps_per_phy->vht_2g = mac_phy_cap[phyid].vht_cap_info_2G; - caps_per_phy->vht_5g = mac_phy_cap[phyid].vht_cap_info_5G; - qdf_mem_copy(caps_per_phy->he_2g, mac_phy_cap[phyid].he_cap_info_2G, - sizeof(caps_per_phy->he_2g)); - qdf_mem_copy(caps_per_phy->he_5g, mac_phy_cap[phyid].he_cap_info_5G, - sizeof(caps_per_phy->he_5g)); - - caps_per_phy->tx_chain_mask_2G = mac_phy_cap->tx_chain_mask_2G; - caps_per_phy->rx_chain_mask_2G = mac_phy_cap->rx_chain_mask_2G; - caps_per_phy->tx_chain_mask_5G = mac_phy_cap->tx_chain_mask_5G; - caps_per_phy->rx_chain_mask_5G = mac_phy_cap->rx_chain_mask_5G; - return QDF_STATUS_SUCCESS; }