Browse Source

qcacld-3.0: Add DBS_OR_SBS support in hw_mode_list

The enhancement is to add DBS_OR_SBS hardware mode
support.

Change-Id: Id5a2f0babcf0a1a2f6982ff671af8f660ec56a0f
CRs-Fixed: 2931621
Arun Kumar Khandavalli 4 years ago
parent
commit
33bef282bb

+ 11 - 0
components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h

@@ -3638,4 +3638,15 @@ bool policy_mgr_is_sta_mon_concurrency(struct wlan_objmgr_psoc *psoc);
  *
  */
 QDF_STATUS policy_mgr_check_mon_concurrency(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * policy_mgr_get_hw_max_dbs_bw() - Computes DBS BW
+ * @psoc: PSOC object information
+ * @dbs_bw: BW info of both MAC0 and MAC1
+ * This function computes BW info of both MAC0 and MAC1
+ *
+ * Return: void
+ */
+void policy_mgr_get_hw_dbs_max_bw(struct wlan_objmgr_psoc *psoc,
+				  struct dbs_bw *bw_dbs);
 #endif /* __WLAN_POLICY_MGR_API_H */

+ 10 - 0
components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h

@@ -1248,6 +1248,16 @@ struct policy_mgr_user_cfg {
 	bool sub_20_mhz_enabled;
 };
 
+/**
+ * struct dbs_bw - Max BW supported in DBS mode
+ * @mac0_bw: BW of MAC0
+ * @mac1_bw: BW of MAC1
+ */
+struct dbs_bw {
+	enum hw_mode_bandwidth mac0_bw;
+	enum hw_mode_bandwidth mac1_bw;
+};
+
 /**
  * struct dbs_nss - Number of spatial streams in DBS mode
  * @mac0_ss: Number of spatial streams on MAC0

+ 9 - 4
components/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c

@@ -1184,8 +1184,11 @@ QDF_STATUS policy_mgr_next_actions(
 {
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
 	struct dbs_nss nss_dbs = {0};
+	struct dbs_bw bw_dbs = {0};
 	struct policy_mgr_hw_mode_params hw_mode;
 	enum policy_mgr_conc_next_action next_action;
+	bool is_sbs_supported;
+	enum hw_mode_sbs_capab sbs_capab;
 
 	if (policy_mgr_is_hw_dbs_capable(psoc) == false) {
 		policy_mgr_rl_debug("driver isn't dbs capable, no further action needed");
@@ -1213,16 +1216,18 @@ QDF_STATUS policy_mgr_next_actions(
 		break;
 	case PM_DBS:
 		(void)policy_mgr_get_hw_dbs_nss(psoc, &nss_dbs);
-
+		policy_mgr_get_hw_dbs_max_bw(psoc, &bw_dbs);
+		is_sbs_supported = policy_mgr_is_hw_sbs_capable(psoc);
+		sbs_capab = is_sbs_supported ? HW_MODE_SBS : HW_MODE_SBS_NONE;
 		status = policy_mgr_pdev_set_hw_mode(psoc, session_id,
 						     nss_dbs.mac0_ss,
-						     HW_MODE_80_MHZ,
+						     bw_dbs.mac0_bw,
 						     nss_dbs.mac1_ss,
-						     HW_MODE_40_MHZ,
+						     bw_dbs.mac1_bw,
 						     HW_MODE_MAC_BAND_NONE,
 						     HW_MODE_DBS,
 						     HW_MODE_AGILE_DFS_NONE,
-						     HW_MODE_SBS_NONE,
+						     sbs_capab,
 						     reason, PM_NOP, PM_DBS,
 						     request_id);
 		break;

+ 39 - 4
components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c

@@ -704,15 +704,18 @@ QDF_STATUS policy_mgr_update_hw_mode_list(struct wlan_objmgr_psoc *psoc,
 
 		/* SBS and DBS have dual MAC. Upto 2 MACs are considered. */
 		if ((hw_config_type == WMI_HW_MODE_DBS) ||
-			(hw_config_type == WMI_HW_MODE_SBS_PASSIVE) ||
-			(hw_config_type == WMI_HW_MODE_SBS)) {
+		    (hw_config_type == WMI_HW_MODE_SBS_PASSIVE) ||
+		    (hw_config_type == WMI_HW_MODE_SBS) ||
+		    (hw_config_type == WMI_HW_MODE_DBS_OR_SBS)) {
 			/* Update for MAC1 */
 			tmp = &info->mac_phy_cap[j++];
 			policy_mgr_get_hw_mode_params(tmp, &mac1_ss_bw_info);
-			if (hw_config_type == WMI_HW_MODE_DBS)
+			if (hw_config_type == WMI_HW_MODE_DBS ||
+			    hw_config_type == WMI_HW_MODE_DBS_OR_SBS)
 				dbs_mode = HW_MODE_DBS;
 			if ((hw_config_type == WMI_HW_MODE_SBS_PASSIVE) ||
-				(hw_config_type == WMI_HW_MODE_SBS))
+			    (hw_config_type == WMI_HW_MODE_SBS) ||
+			    (hw_config_type == WMI_HW_MODE_DBS_OR_SBS))
 				sbs_mode = HW_MODE_SBS;
 		}
 
@@ -3802,6 +3805,38 @@ QDF_STATUS policy_mgr_is_chan_ok_for_dnbs(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
+void policy_mgr_get_hw_dbs_max_bw(struct wlan_objmgr_psoc *psoc,
+				  struct dbs_bw *bw_dbs)
+{
+	uint32_t dbs, sbs, i, param;
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid Context");
+		return;
+	}
+
+	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)
+			bw_dbs->mac0_bw =
+				POLICY_MGR_HW_MODE_MAC0_BANDWIDTH_GET(param);
+
+		if (dbs) {
+			bw_dbs->mac0_bw =
+				POLICY_MGR_HW_MODE_MAC0_BANDWIDTH_GET(param);
+			bw_dbs->mac1_bw =
+				POLICY_MGR_HW_MODE_MAC1_BANDWIDTH_GET(param);
+		} else {
+			continue;
+		}
+	}
+}
+
 uint32_t policy_mgr_get_hw_dbs_nss(struct wlan_objmgr_psoc *psoc,
 				   struct dbs_nss *nss_dbs)
 {

+ 11 - 5
components/cmn_services/policy_mgr/src/wlan_policy_mgr_init_deinit.c

@@ -502,11 +502,17 @@ QDF_STATUS policy_mgr_psoc_enable(struct wlan_objmgr_psoc *psoc)
 	/* Initialize non-DBS pcl table pointer to particular table*/
 	policy_mgr_init_non_dbs_pcl(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;
+	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_two_connection_table =
+				&pm_next_action_two_connection_dbs_2x2_table;
+			policy_mgr_debug("using hst/hsp policy manager table");
+		} else {
+			next_action_two_connection_table =
+			      &pm_next_action_two_connection_dbs_2x2_table_v2;
+			policy_mgr_debug("using hmt policy manager table");
+		}
 	} else if (policy_mgr_is_2x2_1x1_dbs_capable(psoc)) {
 		next_action_two_connection_table =
 		&pm_next_action_two_connection_dbs_2x2_5g_1x1_2g_table;

+ 24 - 0
components/cmn_services/policy_mgr/src/wlan_policy_mgr_tables_2x2_dbs_i.h

@@ -1937,4 +1937,28 @@ static policy_mgr_next_action_three_connection_table_type
 	[PM_P2P_GO_SAP_SBS_5_1x1] = {PM_DBS_UPGRADE, PM_NOP},
 };
 
+/**
+ * next_action_two_connection_table_v2 - table which provides next
+ * action while a new connection is coming up, with one
+ * connection already in the system.
+ */
+static policy_mgr_next_action_two_connection_table_type
+	pm_next_action_two_connection_dbs_2x2_table_v2 = {
+	[PM_STA_24_1x1]     = {PM_NOP, PM_DBS},
+	[PM_STA_24_2x2]     = {PM_NOP, PM_DBS},
+	[PM_STA_5_1x1]      = {PM_DBS, PM_NOP},
+	[PM_STA_5_2x2]      = {PM_DBS, PM_NOP},
+	[PM_P2P_CLI_24_1x1] = {PM_NOP, PM_DBS},
+	[PM_P2P_CLI_24_2x2] = {PM_NOP, PM_DBS},
+	[PM_P2P_CLI_5_1x1]  = {PM_DBS, PM_NOP},
+	[PM_P2P_CLI_5_2x2]  = {PM_DBS, PM_NOP},
+	[PM_P2P_GO_24_1x1]  = {PM_NOP, PM_DBS},
+	[PM_P2P_GO_24_2x2]  = {PM_NOP, PM_DBS},
+	[PM_P2P_GO_5_1x1]   = {PM_DBS, PM_NOP},
+	[PM_P2P_GO_5_2x2]   = {PM_DBS, PM_NOP},
+	[PM_SAP_24_1x1]     = {PM_NOP, PM_DBS},
+	[PM_SAP_24_2x2]     = {PM_NOP, PM_DBS},
+	[PM_SAP_5_1x1]      = {PM_DBS, PM_NOP},
+	[PM_SAP_5_2x2]      = {PM_DBS, PM_NOP},
+};
 #endif

+ 6 - 3
core/wma/src/wma_main.c

@@ -6519,14 +6519,17 @@ static QDF_STATUS wma_update_hw_mode_list(t_wma_handle *wma_handle,
 		/* SBS and DBS have dual MAC. Upto 2 MACs are considered. */
 		if ((hw_config_type == WMI_HW_MODE_DBS) ||
 		    (hw_config_type == WMI_HW_MODE_SBS_PASSIVE) ||
-		    (hw_config_type == WMI_HW_MODE_SBS)) {
+		    (hw_config_type == WMI_HW_MODE_SBS) ||
+		    (hw_config_type == WMI_HW_MODE_DBS_OR_SBS)) {
 			/* Update for MAC1 */
 			tmp = &mac_phy_cap[j++];
 			wma_get_hw_mode_params(tmp, &mac1_ss_bw_info);
-			if (hw_config_type == WMI_HW_MODE_DBS)
+			if (hw_config_type == WMI_HW_MODE_DBS ||
+			    hw_config_type == WMI_HW_MODE_DBS_OR_SBS)
 				dbs_mode = HW_MODE_DBS;
 			if ((hw_config_type == WMI_HW_MODE_SBS_PASSIVE) ||
-			    (hw_config_type == WMI_HW_MODE_SBS))
+			    (hw_config_type == WMI_HW_MODE_SBS) ||
+			    (hw_config_type == WMI_HW_MODE_DBS_OR_SBS))
 				sbs_mode = HW_MODE_SBS;
 			if (QDF_STATUS_SUCCESS !=
 			wma_update_supported_bands(tmp->supported_bands,