Ver Fonte

qcacld-3.0: Set chainmask for 2x2 dbs capable device

Set chainmask for 2x2 dbs capable device if enable2x2,
AS, and diversity are disabled.

Change-Id: I3ec8da95b868e79af1f44fdba63b2ee57e4365fa
CRs-Fixed: 2528035
gaurank kathpalia há 5 anos atrás
pai
commit
7633dfcccb

+ 2 - 0
components/mlme/dispatcher/inc/wlan_mlme_public_struct.h

@@ -1107,6 +1107,7 @@ struct wlan_mlme_chainmask {
  * @enable_change_channel_bandwidth: enable/disable change channel bw in mission
  * mode
  * @disable_4way_hs_offload: enable/disable 4 way handshake offload to firmware
+ * @as_enabled: antenna sharing enabled or not (FW capability)
  */
 struct wlan_mlme_generic {
 	enum band_info band_capability;
@@ -1138,6 +1139,7 @@ struct wlan_mlme_generic {
 	bool data_stall_recovery_fw_support;
 	bool enable_change_channel_bandwidth;
 	bool disable_4way_hs_offload;
+	bool as_enabled;
 };
 
 /*

+ 61 - 4
components/mlme/dispatcher/src/wlan_mlme_api.c

@@ -28,6 +28,7 @@
 #include "wma_internal.h"
 #include "wlan_crypto_global_api.h"
 #include "wlan_utility.h"
+#include "wlan_policy_mgr_ucfg.h"
 
 QDF_STATUS wlan_mlme_get_cfg_str(uint8_t *dst, struct mlme_cfg_str *cfg_str,
 				 qdf_size_t *len)
@@ -875,11 +876,57 @@ 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 wlan_mlme_psoc_obj *mlme_obj = mlme_get_psoc_obj(psoc);
+	QDF_STATUS status;
+	bool enable2x2, as_enabled, enable_bt_chain_sep;
+	uint8_t dual_mac_feature;
+	bool hw_dbs_2x2_cap, mrc_disabled_2g_rx, mrc_disabled_2g_tx;
+	bool mrc_disabled_5g_rx, mrc_disabled_5g_tx;
 
 	if (!mlme_obj)
 		return QDF_STATUS_E_FAILURE;
 
+	status = wma_get_caps_for_phyidx_hwmode(&non_dbs_phy_cap,
+						HW_MODE_DBS_NONE,
+						CDS_BAND_ALL);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		mlme_legacy_err("couldn't get phy caps. skip chain mask programming");
+		return status;
+	}
+
+	if (non_dbs_phy_cap.tx_chain_mask_2G < 3 ||
+	    non_dbs_phy_cap.rx_chain_mask_2G < 3 ||
+	    non_dbs_phy_cap.tx_chain_mask_5G < 3 ||
+	    non_dbs_phy_cap.rx_chain_mask_5G < 3) {
+		mlme_legacy_debug("firmware not capable. skip chain mask programming");
+		return 0;
+	}
+
+	enable2x2 = mlme_obj->cfg.vht_caps.vht_cap_info.enable2x2;
+	enable_bt_chain_sep =
+			mlme_obj->cfg.chainmask_cfg.enable_bt_chain_separation;
+	as_enabled = mlme_obj->cfg.gen.as_enabled;
+	ucfg_policy_mgr_get_dual_mac_feature(psoc, &dual_mac_feature);
+
+	hw_dbs_2x2_cap = policy_mgr_is_hw_dbs_2x2_capable(psoc);
+	mrc_disabled_2g_rx =
+	  mlme_obj->cfg.nss_chains_ini_cfg.disable_rx_mrc[NSS_CHAINS_BAND_2GHZ];
+	mrc_disabled_2g_tx =
+	  mlme_obj->cfg.nss_chains_ini_cfg.disable_tx_mrc[NSS_CHAINS_BAND_2GHZ];
+	mrc_disabled_5g_rx =
+	  mlme_obj->cfg.nss_chains_ini_cfg.disable_rx_mrc[NSS_CHAINS_BAND_5GHZ];
+	mrc_disabled_5g_tx =
+	  mlme_obj->cfg.nss_chains_ini_cfg.disable_tx_mrc[NSS_CHAINS_BAND_5GHZ];
+
+	mlme_legacy_debug("enable2x2 %d enable_bt_chain_sep %d dual mac feature %d antenna sharing %d HW 2x2 cap %d",
+			  enable2x2, enable_bt_chain_sep, dual_mac_feature,
+			  as_enabled, hw_dbs_2x2_cap);
+
+	mlme_legacy_debug("MRC values TX:- 2g %d 5g %d RX:- 2g %d 5g %d",
+			  mrc_disabled_2g_tx, mrc_disabled_5g_tx,
+			  mrc_disabled_2g_rx, mrc_disabled_5g_rx);
+
 	mlme_legacy_debug("txchainmask1x1: %d rxchainmask1x1: %d",
 			  mlme_obj->cfg.chainmask_cfg.txchainmask1x1,
 			  mlme_obj->cfg.chainmask_cfg.rxchainmask1x1);
@@ -890,6 +937,12 @@ QDF_STATUS wlan_mlme_configure_chain_mask(struct wlan_objmgr_psoc *psoc,
 			  mlme_obj->cfg.chainmask_cfg.tx_chain_mask_5g,
 			  mlme_obj->cfg.chainmask_cfg.rx_chain_mask_5g);
 
+	if (enable2x2 || !enable_bt_chain_sep || as_enabled ||
+	   (!hw_dbs_2x2_cap && dual_mac_feature != DISABLE_DBS_CXN_AND_SCAN)) {
+		mlme_legacy_err("Cannot configure chainmask to FW");
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	if (mlme_obj->cfg.chainmask_cfg.txchainmask1x1) {
 		ch_msk_val = mlme_obj->cfg.chainmask_cfg.txchainmask1x1;
 		ret_val = wma_cli_set_command(session_id,
@@ -914,7 +967,8 @@ QDF_STATUS wlan_mlme_configure_chain_mask(struct wlan_objmgr_psoc *psoc,
 		return QDF_STATUS_SUCCESS;
 	}
 
-	if (mlme_obj->cfg.chainmask_cfg.tx_chain_mask_2g) {
+	if (mlme_obj->cfg.chainmask_cfg.tx_chain_mask_2g &&
+	    mrc_disabled_2g_tx) {
 		ch_msk_val = mlme_obj->cfg.chainmask_cfg.tx_chain_mask_2g;
 		ret_val = wma_cli_set_command(session_id,
 					      WMI_PDEV_PARAM_TX_CHAIN_MASK_2G,
@@ -923,7 +977,8 @@ QDF_STATUS wlan_mlme_configure_chain_mask(struct wlan_objmgr_psoc *psoc,
 			return QDF_STATUS_E_FAILURE;
 	}
 
-	if (mlme_obj->cfg.chainmask_cfg.rx_chain_mask_2g) {
+	if (mlme_obj->cfg.chainmask_cfg.rx_chain_mask_2g &&
+	    mrc_disabled_2g_rx) {
 		ch_msk_val = mlme_obj->cfg.chainmask_cfg.rx_chain_mask_2g;
 		ret_val = wma_cli_set_command(session_id,
 					      WMI_PDEV_PARAM_RX_CHAIN_MASK_2G,
@@ -932,7 +987,8 @@ QDF_STATUS wlan_mlme_configure_chain_mask(struct wlan_objmgr_psoc *psoc,
 			return QDF_STATUS_E_FAILURE;
 	}
 
-	if (mlme_obj->cfg.chainmask_cfg.tx_chain_mask_5g) {
+	if (mlme_obj->cfg.chainmask_cfg.tx_chain_mask_5g &&
+	    mrc_disabled_5g_tx) {
 		ch_msk_val = mlme_obj->cfg.chainmask_cfg.tx_chain_mask_5g;
 		ret_val = wma_cli_set_command(session_id,
 					      WMI_PDEV_PARAM_TX_CHAIN_MASK_5G,
@@ -941,7 +997,8 @@ QDF_STATUS wlan_mlme_configure_chain_mask(struct wlan_objmgr_psoc *psoc,
 			return QDF_STATUS_E_FAILURE;
 	}
 
-	if (mlme_obj->cfg.chainmask_cfg.rx_chain_mask_5g) {
+	if (mlme_obj->cfg.chainmask_cfg.rx_chain_mask_5g &&
+	    mrc_disabled_5g_rx) {
 		ch_msk_val = mlme_obj->cfg.chainmask_cfg.rx_chain_mask_5g;
 		ret_val = wma_cli_set_command(session_id,
 					      WMI_PDEV_PARAM_RX_CHAIN_MASK_5G,

+ 1 - 55
core/hdd/src/wlan_hdd_main.c

@@ -4950,65 +4950,11 @@ static void hdd_set_fw_log_params(struct hdd_context *hdd_ctx,
 static int hdd_configure_chain_mask(struct hdd_adapter *adapter)
 {
 	QDF_STATUS status;
-	struct wma_caps_per_phy non_dbs_phy_cap;
 	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
-	bool enable2x2 = false, enable_bt_chain_sep = false;
-	uint8_t dual_mac_feature = DISABLE_DBS_CXN_AND_SCAN;
-
-	status = ucfg_policy_mgr_get_dual_mac_feature(hdd_ctx->psoc,
-						      &dual_mac_feature);
-	if (!QDF_IS_STATUS_SUCCESS(status))
-		hdd_err("unable to get dual mac feature");
-
-	status = ucfg_mlme_get_vht_enable2x2(hdd_ctx->psoc, &enable2x2);
-	if (QDF_IS_STATUS_ERROR(status))
-		hdd_err("unable to get vht_enable2x2");
-
-	status = ucfg_mlme_get_bt_chain_separation_flag(hdd_ctx->psoc,
-							&enable_bt_chain_sep);
-	if (QDF_IS_STATUS_ERROR(status))
-		hdd_debug("unable to get BT chain separation. using default");
-
-	hdd_debug("enable2x2: %d, lte_coex: %d, disable_DBS: %d",
-		  enable2x2, hdd_ctx->lte_coex_ant_share,
-		  dual_mac_feature);
-	hdd_debug("enable_bt_chain_separation %d", enable_bt_chain_sep);
-
-	status = wma_get_caps_for_phyidx_hwmode(&non_dbs_phy_cap,
-						HW_MODE_DBS_NONE,
-						CDS_BAND_ALL);
-	if (QDF_IS_STATUS_ERROR(status)) {
-		hdd_err("couldn't get phy caps. skip chain mask programming");
-		return qdf_status_to_os_return(status);
-	}
-
-	if (non_dbs_phy_cap.tx_chain_mask_2G < 3 ||
-	    non_dbs_phy_cap.rx_chain_mask_2G < 3 ||
-	    non_dbs_phy_cap.tx_chain_mask_5G < 3 ||
-	    non_dbs_phy_cap.rx_chain_mask_5G < 3) {
-		hdd_debug("firmware not capable. skip chain mask programming");
-		return 0;
-	}
-
-	if (enable2x2 && !enable_bt_chain_sep) {
-		hdd_debug("2x2 enabled. skip chain mask programming");
-		return 0;
-	}
-
-	if (dual_mac_feature != DISABLE_DBS_CXN_AND_SCAN) {
-		hdd_debug("DBS enabled(%d). skip chain mask programming",
-			  dual_mac_feature);
-		return 0;
-	}
-
-	if (hdd_ctx->lte_coex_ant_share) {
-		hdd_debug("lte ant sharing enabled. skip chainmask programming");
-		return 0;
-	}
 
 	status = ucfg_mlme_configure_chain_mask(hdd_ctx->psoc,
 						adapter->vdev_id);
-	if (status != QDF_STATUS_SUCCESS)
+	if (QDF_IS_STATUS_ERROR(status))
 		goto error;
 
 	return 0;

+ 1 - 0
core/sme/src/common/sme_api.c

@@ -12642,6 +12642,7 @@ void sme_update_tgt_services(mac_handle_t mac_handle,
 	mac_ctx->obss_scan_offload = cfg->obss_scan_offload;
 	sme_debug("obss_scan_offload: %d", mac_ctx->obss_scan_offload);
 	mac_ctx->lteCoexAntShare = cfg->lte_coex_ant_share;
+	mac_ctx->mlme_cfg->gen.as_enabled = cfg->lte_coex_ant_share;
 	mac_ctx->beacon_offload = cfg->beacon_offload;
 	mac_ctx->pmf_offload = cfg->pmf_offload;
 	QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,