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 15d11d0586ca..fe10faadc8a8 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 @@ -2269,6 +2269,16 @@ bool policy_mgr_is_hw_sbs_capable(struct wlan_objmgr_psoc *psoc); */ bool policy_mgr_is_current_hwmode_dbs(struct wlan_objmgr_psoc *psoc); +/** + * policy_mgr_is_dp_hw_dbs_2x2_capable() - if hardware is capable of dbs 2x2 + * for Data Path. + * @psoc: PSOC object information + * This API is for Data Path to get HW dbs 2x2 capable. + * + * Return: true - DBS2x2, false - DBS1x1 + */ +bool policy_mgr_is_dp_hw_dbs_2x2_capable(struct wlan_objmgr_psoc *psoc); + /** * policy_mgr_is_hw_dbs_2x2_capable() - if hardware is capable of dbs 2x2 * @psoc: PSOC object information @@ -2282,6 +2292,22 @@ bool policy_mgr_is_current_hwmode_dbs(struct wlan_objmgr_psoc *psoc); */ bool policy_mgr_is_hw_dbs_2x2_capable(struct wlan_objmgr_psoc *psoc); +/** + * policy_mgr_is_hw_dbs_required_for_band() - Check whether hardware needs DBS + * mode to support the given band + * @psoc: PSOC object information + * @band: band + * + * The function checks whether DBS mode switching required or not to support + * given band based on target capability. + * Any HW which doesn't support given band on PHY A will need DBS HW mode when a + * connection is coming up on that band. + * + * Return: true - DBS mode required for requested band + */ +bool policy_mgr_is_hw_dbs_required_for_band(struct wlan_objmgr_psoc *psoc, + enum hw_mode_mac_band_cap band); + /* * policy_mgr_is_2x2_1x1_dbs_capable() - check 2x2+1x1 DBS supported or not * @psoc: PSOC object data diff --git a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h index 9df41f65adcc..58605359e113 100644 --- a/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h +++ b/components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h @@ -1208,10 +1208,12 @@ struct policy_mgr_user_cfg { * struct dbs_nss - Number of spatial streams in DBS mode * @mac0_ss: Number of spatial streams on MAC0 * @mac1_ss: Number of spatial streams on MAC1 + * @single_mac0_band_cap: Mac0 band capability for single mac hw mode */ struct dbs_nss { enum hw_mode_ss_config mac0_ss; enum hw_mode_ss_config mac1_ss; + uint32_t single_mac0_band_cap; }; /** diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c index 5acbf1fadd79..01351eeda1f6 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c @@ -248,10 +248,10 @@ enum policy_mgr_conc_next_action policy_mgr_need_opportunistic_upgrade( } else if ((pm_conc_connection_list[conn_index].mac == 1) && pm_conc_connection_list[conn_index].in_use) { mac |= POLICY_MGR_MAC1; - if (policy_mgr_is_hw_dbs_2x2_capable(psoc) && + if (policy_mgr_is_hw_dbs_required_for_band( + psoc, HW_MODE_MAC_BAND_2G) && WLAN_REG_IS_24GHZ_CH_FREQ( - pm_conc_connection_list[conn_index].freq) - ) { + pm_conc_connection_list[conn_index].freq)) { qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); policy_mgr_debug("2X2 DBS capable with 2.4 GHZ connection"); goto done; @@ -527,7 +527,7 @@ bool policy_mgr_is_hwmode_set_for_given_chnl(struct wlan_objmgr_psoc *psoc, uint32_t ch_freq) { enum policy_mgr_band band; - bool is_hwmode_dbs, is_2x2_dbs; + bool is_hwmode_dbs, dbs_required_for_2g; if (policy_mgr_is_hw_dbs_capable(psoc) == false) return true; @@ -538,12 +538,14 @@ bool policy_mgr_is_hwmode_set_for_given_chnl(struct wlan_objmgr_psoc *psoc, band = POLICY_MGR_BAND_5; is_hwmode_dbs = policy_mgr_is_current_hwmode_dbs(psoc); - is_2x2_dbs = policy_mgr_is_hw_dbs_2x2_capable(psoc); + dbs_required_for_2g = policy_mgr_is_hw_dbs_required_for_band( + psoc, HW_MODE_MAC_BAND_2G); /* * If HW supports 2x2 chains in DBS HW mode and if DBS HW mode is not * yet set then this is the right time to block the connection. */ - if ((band == POLICY_MGR_BAND_24) && is_2x2_dbs && !is_hwmode_dbs) { + if (band == POLICY_MGR_BAND_24 && dbs_required_for_2g && + !is_hwmode_dbs) { policy_mgr_err("HW mode is not yet in DBS!!!!!"); return false; } @@ -828,7 +830,8 @@ policy_mgr_get_next_action(struct wlan_objmgr_psoc *psoc, switch (num_connections) { case 0: if (band == POLICY_MGR_BAND_24) - if (policy_mgr_is_hw_dbs_2x2_capable(psoc)) + if (policy_mgr_is_hw_dbs_required_for_band( + psoc, HW_MODE_MAC_BAND_2G)) *next_action = PM_DBS; else *next_action = PM_NOP; @@ -2348,7 +2351,9 @@ QDF_STATUS policy_mgr_check_and_set_hw_mode_for_channel_switch( } if (!policy_mgr_is_hw_dbs_capable(psoc) || - !policy_mgr_is_hw_dbs_2x2_capable(psoc)) { + (!policy_mgr_is_hw_dbs_2x2_capable(psoc) && + !policy_mgr_is_hw_dbs_required_for_band( + psoc, HW_MODE_MAC_BAND_2G))) { policy_mgr_err("2x2 DBS is not enabled"); return QDF_STATUS_E_NOSUPPORT; } @@ -2434,10 +2439,11 @@ void policy_mgr_checkn_update_hw_mode_single_mac_mode( policy_mgr_debug("DBS required"); return; } - if (policy_mgr_is_hw_dbs_2x2_capable(psoc) && + if (policy_mgr_is_hw_dbs_required_for_band( + psoc, HW_MODE_MAC_BAND_2G) && (WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq) || - WLAN_REG_IS_24GHZ_CH_FREQ - (pm_conc_connection_list[i].freq))) { + WLAN_REG_IS_24GHZ_CH_FREQ( + pm_conc_connection_list[i].freq))) { qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); policy_mgr_debug("DBS required"); return; 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 f7af65a4d7e7..2746228ba8c6 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 @@ -1152,7 +1152,7 @@ bool policy_mgr_is_dbs_enable(struct wlan_objmgr_psoc *psoc) bool policy_mgr_is_hw_dbs_2x2_capable(struct wlan_objmgr_psoc *psoc) { - struct dbs_nss nss_dbs; + struct dbs_nss nss_dbs = {0}; uint32_t nss; nss = policy_mgr_get_hw_dbs_nss(psoc, &nss_dbs); @@ -1162,6 +1162,27 @@ bool policy_mgr_is_hw_dbs_2x2_capable(struct wlan_objmgr_psoc *psoc) return false; } +bool policy_mgr_is_hw_dbs_required_for_band(struct wlan_objmgr_psoc *psoc, + enum hw_mode_mac_band_cap band) +{ + struct dbs_nss nss_dbs = {0}; + uint32_t nss; + + nss = policy_mgr_get_hw_dbs_nss(psoc, &nss_dbs); + if (nss >= HW_MODE_SS_1x1 && nss_dbs.mac0_ss == nss_dbs.mac1_ss && + !(nss_dbs.single_mac0_band_cap & band)) + return true; + else + return false; +} + +bool policy_mgr_is_dp_hw_dbs_2x2_capable(struct wlan_objmgr_psoc *psoc) +{ + return policy_mgr_is_hw_dbs_2x2_capable(psoc) || + policy_mgr_is_hw_dbs_required_for_band(psoc, + HW_MODE_MAC_BAND_2G); +} + /* * policy_mgr_is_2x2_1x1_dbs_capable() - check 2x2+1x1 DBS supported or not * @psoc: PSOC object data @@ -3546,7 +3567,7 @@ uint32_t policy_mgr_get_hw_dbs_nss(struct wlan_objmgr_psoc *psoc, struct dbs_nss *nss_dbs) { int i, param; - uint32_t dbs, tx_chain0, rx_chain0, tx_chain1, rx_chain1; + uint32_t dbs, sbs, tx_chain0, rx_chain0, tx_chain1, rx_chain1; uint32_t min_mac0_rf_chains, min_mac1_rf_chains; uint32_t max_rf_chains, final_max_rf_chains = HW_MODE_SS_0x0; struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -3557,9 +3578,15 @@ uint32_t policy_mgr_get_hw_dbs_nss(struct wlan_objmgr_psoc *psoc, return final_max_rf_chains; } + nss_dbs->single_mac0_band_cap = 0; for (i = 0; i < pm_ctx->num_dbs_hw_modes; i++) { param = pm_ctx->hw_mode.hw_mode_list[i]; dbs = POLICY_MGR_HW_MODE_DBS_MODE_GET(param); + sbs = POLICY_MGR_HW_MODE_SBS_MODE_GET(param); + + if (!dbs && !sbs && !nss_dbs->single_mac0_band_cap) + nss_dbs->single_mac0_band_cap = + POLICY_MGR_HW_MODE_MAC0_BAND_GET(param); if (dbs) { tx_chain0 diff --git a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_init_deinit.c b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_init_deinit.c index 6dbb5b37e250..d91f203a5269 100644 --- a/components/cmn_services/policy_mgr/src/wlan_policy_mgr_init_deinit.c +++ b/components/cmn_services/policy_mgr/src/wlan_policy_mgr_init_deinit.c @@ -420,7 +420,8 @@ QDF_STATUS policy_mgr_psoc_enable(struct wlan_objmgr_psoc *psoc) } /* init PCL table & function pointers based on HW capability */ - if (policy_mgr_is_hw_dbs_2x2_capable(psoc)) + if (policy_mgr_is_hw_dbs_2x2_capable(psoc) || + policy_mgr_is_hw_dbs_required_for_band(psoc, HW_MODE_MAC_BAND_2G)) policy_mgr_get_current_pref_hw_mode_ptr = policy_mgr_get_current_pref_hw_mode_dbs_2x2; else if (policy_mgr_is_2x2_1x1_dbs_capable(psoc)) @@ -431,6 +432,8 @@ QDF_STATUS policy_mgr_psoc_enable(struct wlan_objmgr_psoc *psoc) policy_mgr_get_current_pref_hw_mode_dbs_1x1; if (policy_mgr_is_hw_dbs_2x2_capable(psoc) || + policy_mgr_is_hw_dbs_required_for_band(psoc, + HW_MODE_MAC_BAND_2G) || policy_mgr_is_2x2_1x1_dbs_capable(psoc)) second_connection_pcl_dbs_table = &pm_second_connection_pcl_dbs_2x2_table; @@ -439,6 +442,8 @@ QDF_STATUS policy_mgr_psoc_enable(struct wlan_objmgr_psoc *psoc) &pm_second_connection_pcl_dbs_1x1_table; if (policy_mgr_is_hw_dbs_2x2_capable(psoc) || + policy_mgr_is_hw_dbs_required_for_band(psoc, + HW_MODE_MAC_BAND_2G) || policy_mgr_is_2x2_1x1_dbs_capable(psoc)) third_connection_pcl_dbs_table = &pm_third_connection_pcl_dbs_2x2_table; @@ -446,7 +451,9 @@ QDF_STATUS policy_mgr_psoc_enable(struct wlan_objmgr_psoc *psoc) third_connection_pcl_dbs_table = &pm_third_connection_pcl_dbs_1x1_table; - if (policy_mgr_is_hw_dbs_2x2_capable(psoc)) { + if (policy_mgr_is_hw_dbs_2x2_capable(psoc) || + policy_mgr_is_hw_dbs_required_for_band(psoc, + HW_MODE_MAC_BAND_2G)) { next_action_two_connection_table = &pm_next_action_two_connection_dbs_2x2_table; } else if (policy_mgr_is_2x2_1x1_dbs_capable(psoc)) { @@ -459,7 +466,9 @@ QDF_STATUS policy_mgr_psoc_enable(struct wlan_objmgr_psoc *psoc) &pm_next_action_two_connection_dbs_1x1_table; } - if (policy_mgr_is_hw_dbs_2x2_capable(psoc)) { + if (policy_mgr_is_hw_dbs_2x2_capable(psoc) || + policy_mgr_is_hw_dbs_required_for_band(psoc, + HW_MODE_MAC_BAND_2G)) { next_action_three_connection_table = &pm_next_action_three_connection_dbs_2x2_table; } else if (policy_mgr_is_2x2_1x1_dbs_capable(psoc)) { @@ -474,8 +483,10 @@ QDF_STATUS policy_mgr_psoc_enable(struct wlan_objmgr_psoc *psoc) policy_mgr_debug("is DBS Capable %d, is SBS Capable %d", policy_mgr_is_hw_dbs_capable(psoc), policy_mgr_is_hw_sbs_capable(psoc)); - policy_mgr_debug("is2x2 %d, is2x2+1x1 %d, is2x2_5g+1x1_2g %d, is2x2_2g+1x1_5g %d", + policy_mgr_debug("is2x2 %d, 2g-on-dbs %d is2x2+1x1 %d, is2x2_5g+1x1_2g %d, is2x2_2g+1x1_5g %d", policy_mgr_is_hw_dbs_2x2_capable(psoc), + policy_mgr_is_hw_dbs_required_for_band( + psoc, HW_MODE_MAC_BAND_2G), policy_mgr_is_2x2_1x1_dbs_capable(psoc), policy_mgr_is_2x2_5G_1x1_2G_dbs_capable(psoc), policy_mgr_is_2x2_2G_1x1_5G_dbs_capable(psoc)); diff --git a/components/tdls/core/src/wlan_tdls_main.c b/components/tdls/core/src/wlan_tdls_main.c index 6301718d2717..89c5aef54a95 100644 --- a/components/tdls/core/src/wlan_tdls_main.c +++ b/components/tdls/core/src/wlan_tdls_main.c @@ -988,6 +988,8 @@ tdls_process_decrement_active_session(struct wlan_objmgr_psoc *psoc) if (!psoc) return QDF_STATUS_E_NULL_VALUE; if(!policy_mgr_is_hw_dbs_2x2_capable(psoc) && + !policy_mgr_is_hw_dbs_required_for_band( + psoc, HW_MODE_MAC_BAND_2G) && policy_mgr_is_current_hwmode_dbs(psoc)) { tdls_err("Current HW mode is 1*1 DBS. Wait for Opportunistic timer to expire to enable TDLS in FW"); return QDF_STATUS_SUCCESS; diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c index 6300c14a1720..9168e8ca740d 100644 --- a/core/cds/src/cds_api.c +++ b/core/cds/src/cds_api.c @@ -89,7 +89,7 @@ static struct ol_if_ops dp_ol_if_ops = { .peer_set_default_routing = target_if_peer_set_default_routing, .peer_rx_reorder_queue_setup = target_if_peer_rx_reorder_queue_setup, .peer_rx_reorder_queue_remove = target_if_peer_rx_reorder_queue_remove, - .is_hw_dbs_2x2_capable = policy_mgr_is_hw_dbs_2x2_capable, + .is_hw_dbs_2x2_capable = policy_mgr_is_dp_hw_dbs_2x2_capable, .lro_hash_config = target_if_lro_hash_config, .rx_invalid_peer = wma_rx_invalid_peer_ind, .is_roam_inprogress = wma_is_roam_in_progress, diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c index 482d62183e57..1a4eca122741 100644 --- a/core/sme/src/csr/csr_api_scan.c +++ b/core/sme/src/csr/csr_api_scan.c @@ -1981,6 +1981,8 @@ csr_get_channel_for_hw_mode_change(struct mac_context *mac_ctx, } if (!policy_mgr_is_hw_dbs_2x2_capable(mac_ctx->psoc) && + !policy_mgr_is_hw_dbs_required_for_band(mac_ctx->psoc, + HW_MODE_MAC_BAND_2G) && !policy_mgr_get_connection_count(mac_ctx->psoc)) { QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, FL("1x1 DBS HW with no prior connection")); @@ -2000,7 +2002,9 @@ csr_get_channel_for_hw_mode_change(struct mac_context *mac_ctx, struct tag_csrscan_result, Link); ch_freq = scan_result->Result.BssDescriptor.chan_freq; - if (policy_mgr_is_hw_dbs_2x2_capable(mac_ctx->psoc)) { + if (policy_mgr_is_hw_dbs_required_for_band( + mac_ctx->psoc, + HW_MODE_MAC_BAND_2G)) { if (WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq)) break; } else {