Sfoglia il codice sorgente

qcacmn: Populate PCL list correctly using channel select logic ini

Currently, PCL list is populated without checking channel select logic
ini. Check for channel select logic ini before selecting the second
connection pcl table.

Change-Id: I5a64d4ff43a7dcc2c70eac75b51d5f87de2903bb
CRs-FIxed: 2237403
Bala Venkatesh 7 anni fa
parent
commit
d576e7fba8

+ 27 - 0
umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h

@@ -508,6 +508,19 @@ QDF_STATUS policy_mgr_current_connections_update(struct wlan_objmgr_psoc *psoc,
 		uint32_t session_id, uint8_t channel,
 		enum policy_mgr_conn_update_reason);
 
+/**
+ * policy_mgr_is_dbs_allowed_for_concurrency() - If dbs is allowed for current
+ * concurreny
+ * @new_conn_mode: new connection mode
+ *
+ * When a new connection is about to come up, check if dbs is allowed for
+ * STA+STA or STA+P2P
+ *
+ * Return: true if dbs is allowed for STA+STA or STA+P2P else false
+ */
+bool policy_mgr_is_dbs_allowed_for_concurrency(
+		struct wlan_objmgr_psoc *psoc, enum QDF_OPMODE new_conn_mode);
+
 /**
  * policy_mgr_is_ibss_conn_exist() - to check if IBSS connection already present
  * @psoc: PSOC object information
@@ -677,6 +690,20 @@ static inline QDF_STATUS policy_mgr_decr_connection_count_utfw(
 enum policy_mgr_con_mode policy_mgr_convert_device_mode_to_qdf_type(
 		enum QDF_OPMODE device_mode);
 
+/**
+ * policy_mgr_get_qdf_mode_from_pm - provides the
+ * type translation from policy manager type
+ * to generic connection mode type
+ * @device_mode: policy manager mode type
+ *
+ *
+ * This function provides the type translation
+ *
+ * Return: QDF_OPMODE enum
+ */
+enum QDF_OPMODE policy_mgr_get_qdf_mode_from_pm(
+			enum policy_mgr_con_mode device_mode);
+
 /**
  * policy_mgr_pdev_set_hw_mode() - Set HW mode command to FW
  * @psoc: PSOC object information

+ 16 - 8
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c

@@ -357,12 +357,11 @@ QDF_STATUS policy_mgr_update_and_wait_for_connection_update(
  *
  * Return: true if dbs is allowed for STA+STA or STA+P2P else false
  */
-static bool policy_mgr_is_dbs_allowed_for_concurrency(
-		struct wlan_objmgr_psoc *psoc, uint32_t session_id)
+bool policy_mgr_is_dbs_allowed_for_concurrency(
+		struct wlan_objmgr_psoc *psoc, enum QDF_OPMODE new_conn_mode)
 {
 	struct policy_mgr_psoc_priv_obj *pm_ctx;
 	uint32_t count, dbs_for_sta_sta, dbs_for_sta_p2p;
-	enum QDF_OPMODE new_conn_mode = QDF_MAX_NO_OF_MODE;
 	bool ret = true;
 
 	pm_ctx = policy_mgr_get_context(psoc);
@@ -372,9 +371,6 @@ static bool policy_mgr_is_dbs_allowed_for_concurrency(
 	}
 
 	count = policy_mgr_get_connection_count(psoc);
-	if (pm_ctx->hdd_cbacks.hdd_get_device_mode)
-		new_conn_mode = pm_ctx->hdd_cbacks.
-					hdd_get_device_mode(session_id);
 
 	if (count != 1 || new_conn_mode == QDF_MAX_NO_OF_MODE)
 		return ret;
@@ -430,6 +426,8 @@ QDF_STATUS policy_mgr_current_connections_update(struct wlan_objmgr_psoc *psoc,
 	enum policy_mgr_two_connection_mode third_index = 0;
 	enum policy_mgr_band band;
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+	enum QDF_OPMODE new_conn_mode = QDF_MAX_NO_OF_MODE;
 
 	if (policy_mgr_is_hw_dbs_capable(psoc) == false) {
 		policy_mgr_err("driver isn't dbs capable, no further action needed");
@@ -483,6 +481,16 @@ QDF_STATUS policy_mgr_current_connections_update(struct wlan_objmgr_psoc *psoc,
 		break;
 	}
 
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid context");
+		goto done;
+	}
+
+	if (pm_ctx->hdd_cbacks.hdd_get_device_mode)
+		new_conn_mode = pm_ctx->hdd_cbacks.
+					hdd_get_device_mode(session_id);
+
 	/*
 	 * Based on channel_select_logic_conc ini, hw mode is set
 	 * when second connection is about to come up that results
@@ -493,10 +501,10 @@ QDF_STATUS policy_mgr_current_connections_update(struct wlan_objmgr_psoc *psoc,
 	 *  mode change is not required.
 	 */
 	if (policy_mgr_is_current_hwmode_dbs(psoc) &&
-		!policy_mgr_is_dbs_allowed_for_concurrency(psoc, session_id))
+		!policy_mgr_is_dbs_allowed_for_concurrency(psoc, new_conn_mode))
 		next_action = PM_SINGLE_MAC;
 	else if (!policy_mgr_is_current_hwmode_dbs(psoc) &&
-		!policy_mgr_is_dbs_allowed_for_concurrency(psoc, session_id))
+		!policy_mgr_is_dbs_allowed_for_concurrency(psoc, new_conn_mode))
 		next_action = PM_NOP;
 
 	if (PM_NOP != next_action)

+ 2 - 20
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c

@@ -1206,7 +1206,6 @@ void policy_mgr_pdev_set_pcl(struct wlan_objmgr_psoc *psoc,
 		policy_mgr_debug("Set PCL to FW for mode:%d", mode);
 }
 
-
 /**
  * policy_mgr_set_pcl_for_existing_combo() - Set PCL for existing connection
  * @mode: Connection mode of type 'policy_mgr_con_mode'
@@ -1230,26 +1229,9 @@ void policy_mgr_set_pcl_for_existing_combo(
 		return;
 	}
 
-	switch (mode) {
-	case PM_STA_MODE:
-		pcl_mode = QDF_STA_MODE;
-		break;
-	case PM_SAP_MODE:
-		pcl_mode = QDF_SAP_MODE;
-		break;
-	case PM_P2P_CLIENT_MODE:
-		pcl_mode = QDF_P2P_CLIENT_MODE;
-		break;
-	case PM_P2P_GO_MODE:
-		pcl_mode = QDF_P2P_GO_MODE;
-		break;
-	case PM_IBSS_MODE:
-		pcl_mode = QDF_IBSS_MODE;
-		break;
-	default:
-		policy_mgr_err("Invalid mode to set PCL");
+	pcl_mode = policy_mgr_get_qdf_mode_from_pm(mode);
+	if (pcl_mode == QDF_MAX_NO_OF_MODE)
 		return;
-	};
 	qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock);
 	if (policy_mgr_mode_specific_connection_count(psoc, mode, NULL) > 0) {
 		/* Check, store and temp delete the mode's parameter */

+ 31 - 21
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c

@@ -2079,6 +2079,34 @@ enum policy_mgr_con_mode policy_mgr_convert_device_mode_to_qdf_type(
 	return mode;
 }
 
+enum QDF_OPMODE policy_mgr_get_qdf_mode_from_pm(
+			enum policy_mgr_con_mode device_mode)
+{
+	enum QDF_OPMODE mode = QDF_MAX_NO_OF_MODE;
+
+	switch (device_mode) {
+	case PM_STA_MODE:
+		mode = QDF_STA_MODE;
+		break;
+	case PM_SAP_MODE:
+		mode = QDF_SAP_MODE;
+		break;
+	case PM_P2P_CLIENT_MODE:
+		mode = QDF_P2P_CLIENT_MODE;
+		break;
+	case PM_P2P_GO_MODE:
+		mode = QDF_P2P_GO_MODE;
+		break;
+	case PM_IBSS_MODE:
+		mode = QDF_IBSS_MODE;
+		break;
+	default:
+		policy_mgr_err("Unsupported policy mgr mode (%d)",
+			       device_mode);
+	}
+	return mode;
+}
+
 QDF_STATUS policy_mgr_mode_specific_num_open_sessions(
 		struct wlan_objmgr_psoc *psoc, enum QDF_OPMODE mode,
 		uint8_t *num_sessions)
@@ -2265,27 +2293,9 @@ QDF_STATUS policy_mgr_get_nss_for_vdev(struct wlan_objmgr_psoc *psoc,
 	enum QDF_OPMODE dev_mode;
 	struct policy_mgr_psoc_priv_obj *pm_ctx;
 
-	switch (mode) {
-	case PM_STA_MODE:
-		dev_mode = QDF_STA_MODE;
-		break;
-	case PM_SAP_MODE:
-		dev_mode = QDF_SAP_MODE;
-		break;
-	case PM_P2P_CLIENT_MODE:
-		dev_mode = QDF_P2P_CLIENT_MODE;
-		break;
-	case PM_P2P_GO_MODE:
-		dev_mode = QDF_P2P_GO_MODE;
-		break;
-	case PM_IBSS_MODE:
-		dev_mode = QDF_IBSS_MODE;
-		break;
-	default:
-		policy_mgr_err("Invalid mode to get allowed NSS value");
-		return QDF_STATUS_E_FAILURE;
-	};
-
+	dev_mode = policy_mgr_get_qdf_mode_from_pm(mode);
+	if (dev_mode == QDF_MAX_NO_OF_MODE)
+		return  QDF_STATUS_E_FAILURE;
 	pm_ctx = policy_mgr_get_context(psoc);
 	if (!pm_ctx) {
 		policy_mgr_err("Invalid Context");

+ 8 - 2
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c

@@ -476,7 +476,7 @@ QDF_STATUS policy_mgr_get_pcl(struct wlan_objmgr_psoc *psoc,
 	enum policy_mgr_pcl_type pcl = PM_NONE;
 	enum policy_mgr_conc_priority_mode conc_system_pref = 0;
 	struct policy_mgr_psoc_priv_obj *pm_ctx;
-
+	enum QDF_OPMODE qdf_mode;
 	pm_ctx = policy_mgr_get_context(psoc);
 	if (!pm_ctx) {
 		policy_mgr_err("context is NULL");
@@ -522,7 +522,13 @@ QDF_STATUS policy_mgr_get_pcl(struct wlan_objmgr_psoc *psoc,
 			policy_mgr_err("couldn't find index for 2nd connection pcl table");
 			return status;
 		}
-		if (policy_mgr_is_hw_dbs_capable(psoc) == true) {
+		qdf_mode = policy_mgr_get_qdf_mode_from_pm(mode);
+		if (qdf_mode == QDF_MAX_NO_OF_MODE)
+			return status;
+
+		if (policy_mgr_is_hw_dbs_capable(psoc) == true &&
+		    policy_mgr_is_dbs_allowed_for_concurrency(
+							psoc, qdf_mode)) {
 			pcl = (*second_connection_pcl_dbs_table)
 				[second_index][mode][conc_system_pref];
 		} else {