qcacld-3.0: Add policy_mgr_is_hw_dbs_required_for_band API

policy_mgr_is_hw_dbs_required_for_band is for any HW where
PHYA/MAC0 doesn't support the given band. We need to switch
to DBS mode to support the band. So far we have
overloaded policy_mgr_is_hw_dbs_2x2_capable to achieve above.
Need a cleaner API to work in a generic way
(for 2x2, 1x1 or any chain mask configuration).

Change-Id: I1cb28bece1242fc749a0a6a56fadca0502850c43
CRs-Fixed: 2565939
This commit is contained in:
Liangwei Dong
2019-11-05 19:16:02 +08:00
committed by nshrivas
orang tua 4bcc0a7891
melakukan 897b439b3c
8 mengubah file dengan 97 tambahan dan 19 penghapusan

Melihat File

@@ -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

Melihat File

@@ -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;
};
/**

Melihat File

@@ -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;

Melihat File

@@ -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

Melihat File

@@ -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));

Melihat File

@@ -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;