Просмотр исходного кода

qcacld-3.0: Don't allow GO/GC+GO/GC+STA on the same band

Add support to allow/disallow three port combinations on
same band based on PCL table

Change-Id: Id2e9ad7d17bab6ea0aff6913b25f0eb330dc6c13
CRs-Fixed: 3028527
Jyoti Kumari 3 лет назад
Родитель
Сommit
6387e91bc8

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

@@ -3902,4 +3902,18 @@ static inline bool policy_mgr_is_mlo_sap_concurrency_allowed(
  *         False otherwise.
  */
 bool policy_mgr_is_hwmode_offload_enabled(struct wlan_objmgr_psoc *psoc);
+/**
+ * policy_mgr_is_3rd_conn_on_same_band_allowed() - Check the third connection
+ * on same band allowed or not
+ * list for third connection
+ * @psoc: PSOC object information
+ * @mode: Device mode
+ *
+ * This function checks whether to allow third connection on same band or not
+ * based on pcl table
+ *
+ * Return: TRUE/FALSE
+ */
+bool policy_mgr_is_3rd_conn_on_same_band_allowed(struct wlan_objmgr_psoc *psoc,
+						 enum policy_mgr_con_mode mode);
 #endif /* __WLAN_POLICY_MGR_API_H */

+ 33 - 41
components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c

@@ -2993,35 +2993,37 @@ bool policy_mgr_disallow_mcc(struct wlan_objmgr_psoc *psoc,
 }
 
 /**
- * policy_mgr_is_multi_ap_plus_sta_3vif_conc() - Check multiple AP plus STA
- * concurrency
- * @mode1: policy_mgr_con_mode of connection 1
- * @mode2: policy_mgr_con_mode of connection 2
- * @mode2: policy_mgr_con_mode of connection 3
+ * policy_mgr_is_3rd_conn_on_same_band() - Check whether 3rd connection is on
+ * same band or not
+ * @ch_freq: channel frequency
  *
- * Check the 3vif concurrency is SAP(GO)+SAP(GO)+STA or not based on
- * connection mode.
+ * Check the existing two connection are in same band or not. If it is in
+ * same band then check the 3rd connection is also in same band or not
  *
  * Return: True/False
  */
-static bool policy_mgr_is_multi_ap_plus_sta_3vif_conc(
-	enum policy_mgr_con_mode mode1, enum policy_mgr_con_mode mode2,
-	enum policy_mgr_con_mode mode3)
-{
-	if (mode1 == PM_STA_MODE &&
-	    (mode2 == PM_SAP_MODE || mode2 == PM_P2P_GO_MODE) &&
-	    (mode3 == PM_SAP_MODE || mode3 == PM_P2P_GO_MODE))
-		return true;
-	if (mode2 == PM_STA_MODE &&
-	    (mode1 == PM_SAP_MODE || mode1 == PM_P2P_GO_MODE) &&
-	    (mode3 == PM_SAP_MODE || mode3 == PM_P2P_GO_MODE))
-		return true;
-	if (mode3 == PM_STA_MODE &&
-	    (mode1 == PM_SAP_MODE || mode1 == PM_P2P_GO_MODE) &&
-	    (mode2 == PM_SAP_MODE || mode2 == PM_P2P_GO_MODE))
-		return true;
-
-	return false;
+static bool policy_mgr_is_3rd_conn_on_same_band(uint32_t ch_freq)
+{
+	bool ret = false;
+
+	if (((WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq)) &&
+	    (WLAN_REG_IS_24GHZ_CH_FREQ
+	    (pm_conc_connection_list[0].freq)) &&
+	    (WLAN_REG_IS_24GHZ_CH_FREQ
+	    (pm_conc_connection_list[1].freq))) ||
+	    (((WLAN_REG_IS_5GHZ_CH_FREQ(ch_freq)) ||
+	    (WLAN_REG_IS_6GHZ_CHAN_FREQ(ch_freq))) &&
+	    ((WLAN_REG_IS_5GHZ_CH_FREQ
+	    (pm_conc_connection_list[0].freq)) ||
+	    (WLAN_REG_IS_6GHZ_CHAN_FREQ
+	    (pm_conc_connection_list[0].freq))) &&
+	    ((WLAN_REG_IS_5GHZ_CH_FREQ
+	    (pm_conc_connection_list[1].freq)) ||
+	    (WLAN_REG_IS_6GHZ_CHAN_FREQ
+	    (pm_conc_connection_list[1].freq))))) {
+		ret = true;
+	}
+	return ret;
 }
 
 /**
@@ -3097,16 +3099,8 @@ bool policy_mgr_allow_new_home_channel(
 					policy_mgr_rl_debug("don't allow 3rd home channel on same MAC");
 					status = false;
 				}
-			} else if (((WLAN_REG_IS_24GHZ_CH_FREQ(ch_freq)) &&
-				   (WLAN_REG_IS_24GHZ_CH_FREQ
-				   (pm_conc_connection_list[0].freq)) &&
-				   (WLAN_REG_IS_24GHZ_CH_FREQ
-				   (pm_conc_connection_list[1].freq))) ||
-				   ((WLAN_REG_IS_5GHZ_CH_FREQ(ch_freq)) &&
-				   (WLAN_REG_IS_5GHZ_CH_FREQ
-				   (pm_conc_connection_list[0].freq)) &&
-				   (WLAN_REG_IS_5GHZ_CH_FREQ
-				   (pm_conc_connection_list[1].freq)))) {
+			} else if (policy_mgr_is_3rd_conn_on_same_band(
+				   ch_freq)) {
 				policy_mgr_rl_debug("don't allow 3rd home channel on same MAC");
 				status = false;
 			}
@@ -3132,12 +3126,10 @@ bool policy_mgr_allow_new_home_channel(
 				 * and therefore a 3rd connection with the
 				 * same MAC is possible.
 				 */
-			} else if (wlan_reg_is_same_band_freqs(ch_freq,
-					pm_conc_connection_list[0].freq) &&
-				   policy_mgr_is_multi_ap_plus_sta_3vif_conc(
-					pm_conc_connection_list[0].mode,
-					pm_conc_connection_list[1].mode,
-					mode)) {
+			} else if (policy_mgr_is_3rd_conn_on_same_band(
+				   ch_freq) &&
+				   !(policy_mgr_is_3rd_conn_on_same_band_allowed(
+				   psoc, mode))) {
 				policy_mgr_rl_debug("don't allow 3rd home channel on same MAC - sta existing");
 				status = false;
 			}

+ 84 - 0
components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c

@@ -2739,3 +2739,87 @@ QDF_STATUS policy_mgr_filter_passive_ch(struct wlan_objmgr_pdev *pdev,
 
 	return QDF_STATUS_SUCCESS;
 }
+
+bool policy_mgr_is_3rd_conn_on_same_band_allowed(struct wlan_objmgr_psoc *psoc,
+						 enum policy_mgr_con_mode mode)
+{
+	enum policy_mgr_pcl_type pcl = PM_NONE;
+	enum policy_mgr_conc_priority_mode conc_system_pref = 0;
+	enum policy_mgr_two_connection_mode third_index = 0;
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+	bool ret = false;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("context is NULL");
+			return false;
+	}
+
+	policy_mgr_debug("pref:%d requested mode:%d",
+			 pm_ctx->cur_conc_system_pref, mode);
+
+	switch (pm_ctx->cur_conc_system_pref) {
+	case 0:
+		conc_system_pref = PM_THROUGHPUT;
+		break;
+	case 1:
+		conc_system_pref = PM_POWERSAVE;
+		break;
+	case 2:
+		conc_system_pref = PM_LATENCY;
+		break;
+	default:
+		policy_mgr_err("unknown cur_conc_system_pref value %d",
+			       pm_ctx->cur_conc_system_pref);
+		break;
+	}
+
+	third_index = policy_mgr_get_third_connection_pcl_table_index(psoc);
+	if (PM_MAX_TWO_CONNECTION_MODE == third_index) {
+		policy_mgr_err(
+			"couldn't find index for 3rd connection pcl table");
+			return false;
+	}
+	if (policy_mgr_is_hw_dbs_capable(psoc) == true) {
+		pcl = (*third_connection_pcl_dbs_table)
+			[third_index][mode][conc_system_pref];
+	} else {
+		pcl = (*third_connection_pcl_non_dbs_table)
+			[third_index][mode][conc_system_pref];
+	}
+
+	policy_mgr_debug("pcl for third connection is %d", pcl);
+	switch (pcl) {
+	case PM_SCC_CH:
+	case PM_SCC_CH_24G:
+	case PM_SCC_CH_5G:
+	case PM_24G_SCC_CH:
+	case PM_5G_SCC_CH:
+	case PM_SCC_ON_5_SCC_ON_24_24G:
+	case PM_SCC_ON_5_SCC_ON_24_5G:
+	case PM_SCC_ON_24_SCC_ON_5_24G:
+	case PM_SCC_ON_24_SCC_ON_5_5G:
+	case PM_SCC_ON_5_SCC_ON_24:
+	case PM_SCC_ON_24_SCC_ON_5:
+	case PM_24G_SCC_CH_SBS_CH:
+	case PM_24G_SCC_CH_SBS_CH_5G:
+	case PM_SBS_CH_24G_SCC_CH:
+	case PM_SBS_CH_SCC_CH_24G:
+	case PM_SCC_CH_SBS_CH_24G:
+	case PM_SBS_CH_SCC_CH_5G_24G:
+	case PM_SCC_CH_MCC_CH_SBS_CH_24G:
+	case PM_MCC_CH:
+	case PM_MCC_CH_24G:
+	case PM_MCC_CH_5G:
+	case PM_24G_MCC_CH:
+	case PM_5G_MCC_CH:
+	case PM_24G_SBS_CH_MCC_CH:
+		ret = true;
+		break;
+	default:
+		policy_mgr_debug("Not in SCC case");
+		ret = false;
+		break;
+	}
+	return ret;
+}