Эх сурвалжийг харах

qcacld-3.0: Adding 4 SAP PCL table to support SBS mode

Previously 4 SAP PCL table only check 3 SAP in DBS mode,
it is not applicable if SBS mode available, for example if SAP1/SAP2
on channel 5805 and SAP3 on channel 5220 in SBS mode, if SAP4 start
on channel 2.4 GHz, it will be rejected.

Move policy_mgr_get_index_for_3_given_freq_dbs() and
policy_mgr_get_index_for_3_given_freq_sbs() out of macro
WLAN_FEATURE_11BE_MLO, so it can be reused by 4 SAP case.
Use above APIs to get common four connection PCL table index
and remove exist four SAP connection PCL index.

Change-Id: I7a8a3e6736feaae139e2c81050f00b2078df371e
CRs-Fixed: 3500354
Will Huang 1 жил өмнө
parent
commit
f7c7264840

+ 180 - 193
components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c

@@ -2378,6 +2378,174 @@ policy_mgr_get_third_connection_pcl_table_index(
 }
 
 #ifdef FEATURE_FOURTH_CONNECTION
+/**
+ * policy_mgr_get_index_for_3_given_freq_dbs() - Find the index for next
+ * connection for given 3 freq in DBS mode
+ * @pm_ctx: policy manager context
+ * @index: Index to return for next connection
+ * @freq1: freq of interface 1
+ * @freq2: freq of interface 2
+ * @freq3: freq of interface 3
+ *
+ * This function finds the index for next connection for 3 freq in DBS mode.
+ *
+ * Return: none
+ */
+static void
+policy_mgr_get_index_for_3_given_freq_dbs(
+	struct policy_mgr_psoc_priv_obj *pm_ctx,
+	enum policy_mgr_three_connection_mode *index,
+	qdf_freq_t freq1, qdf_freq_t freq2, qdf_freq_t freq3)
+{
+	/* If all freq are on same band */
+	if ((WLAN_REG_IS_24GHZ_CH_FREQ(freq1) ==
+	     WLAN_REG_IS_24GHZ_CH_FREQ(freq2) &&
+	    (WLAN_REG_IS_24GHZ_CH_FREQ(freq2) ==
+	     WLAN_REG_IS_24GHZ_CH_FREQ(freq3)))) {
+		policy_mgr_err("Invalid mode for all freq %d, %d and %d on same band",
+			       freq1, freq2, freq3);
+		return;
+	}
+
+	/*
+	 * If freq1 and freq2 are on same band and freq3 is on differet band and
+	 * is not sharing mac with any SAP. STA on same band is handled above,
+	 * so both SAP on same band mean STA cannot be on same band. This can
+	 * happen if SBS is not enabled.
+	 */
+	if (WLAN_REG_IS_24GHZ_CH_FREQ(freq1) ==
+	    WLAN_REG_IS_24GHZ_CH_FREQ(freq2)) {
+		if (WLAN_REG_IS_24GHZ_CH_FREQ(freq3))
+			/*
+			 * As all 3 cannot be on same band, so if freq3 is
+			 * 2.4 GHZ mean both freq1 and freq2 are on 5 / 6 GHZ
+			 */
+			*index = PM_5_SCC_MCC_PLUS_24_DBS;
+		else
+			/*
+			 * As all 3 cannot be on same band, so if freq3 is
+			 * 5 / 6 GHZ, mean both freq1 and freq2 are on 2.4 GHZ.
+			 */
+			*index = PM_24_SCC_MCC_PLUS_5_DBS;
+		return;
+	}
+
+	/*
+	 * if freq1 and freq 2 are on different band (2 GHZ + 5 GHZ/6 GHZ DBS),
+	 * check with which freq the freq3 will share mac, and return index as
+	 * per it.
+	 */
+	if (WLAN_REG_IS_24GHZ_CH_FREQ(freq3))
+		*index = PM_24_SCC_MCC_PLUS_5_DBS;
+	else
+		*index = PM_5_SCC_MCC_PLUS_24_DBS;
+}
+
+/**
+ * policy_mgr_get_index_for_3_given_freq_sbs() - Find the index for next
+ * connection for 3 given freq, in case current HW mode is SBS
+ * @pm_ctx: policy manager context
+ * @index: Index to return for next connection
+ * @freq1: freq of interface 1
+ * @freq2: freq of interface 2
+ * @freq3: freq of interface 3
+ *
+ * This function finds the index for next
+ * connection for 3 given freq, in case current HW mode is SBS
+ *
+ * Return: none
+ */
+static void policy_mgr_get_index_for_3_given_freq_sbs(
+	struct policy_mgr_psoc_priv_obj *pm_ctx,
+	enum policy_mgr_three_connection_mode *index,
+	qdf_freq_t freq1, qdf_freq_t freq2, qdf_freq_t freq3)
+{
+	qdf_freq_t sbs_cut_off_freq;
+	qdf_freq_t shared_5_ghz_freq = 0;
+
+	/*
+	 * Sanity check: At least 2 of the given freq needs to be creating SBS
+	 * separation for HW mode to be in SBS, if not it shouldn't have
+	 * entered this API.
+	 */
+	if (!policy_mgr_are_sbs_chan(pm_ctx->psoc, freq1, freq2) &&
+	    !policy_mgr_are_sbs_chan(pm_ctx->psoc, freq2, freq3) &&
+	    !policy_mgr_are_sbs_chan(pm_ctx->psoc, freq3, freq1)) {
+		policy_mgr_err("freq1 %d, freq2 %d and freq3 %d, none of the 2 connections/3 vdevs are leading to SBS",
+			       freq1, freq2, freq3);
+		return;
+	}
+
+	sbs_cut_off_freq =  policy_mgr_get_sbs_cut_off_freq(pm_ctx->psoc);
+	if (!sbs_cut_off_freq) {
+		policy_mgr_err("Invalid cutoff freq");
+		return;
+	}
+
+	/*
+	 * If dynamic SBS is enabled (2.4 GHZ can share mac with HIGH
+	 * 5GHZ as well as LOW 5 GHZ, but one at a time) and one of the
+	 * freq is 2.4 GHZ, this mean that the new interface can come up on
+	 * 5 GHZ LOW or HIGH and HW mode will move the 2.4 GHZ link to
+	 * the other mac dynamically.
+	 */
+	if (policy_mgr_can_2ghz_share_low_high_5ghz_sbs(pm_ctx) &&
+	    (WLAN_REG_IS_24GHZ_CH_FREQ(freq1) ||
+	     WLAN_REG_IS_24GHZ_CH_FREQ(freq2) ||
+	     WLAN_REG_IS_24GHZ_CH_FREQ(freq3))) {
+		*index = PM_24_5_PLUS_5_LOW_N_HIGH_SHARE_SBS;
+		return;
+	}
+	/*
+	 * if freq1 on freq2 same mac, get the 5 / 6 GHZ freq from it check
+	 * and determine shared mac.
+	 */
+	if (policy_mgr_2_freq_same_mac_in_sbs(pm_ctx, freq1, freq2)) {
+		/*
+		 * If freq1 is 2.4 GHZ that mean freq2 is 5 / 6 GHZ.
+		 * so take decision using freq2.
+		 */
+		if (WLAN_REG_IS_24GHZ_CH_FREQ(freq1))
+			shared_5_ghz_freq = freq2;
+		else
+			/* freq1 5 / 6 GHZ, use freq1 */
+			shared_5_ghz_freq = freq1;
+	} else if (policy_mgr_2_freq_same_mac_in_sbs(pm_ctx, freq2, freq3)) {
+		/*
+		 * If freq2 is 2.4 GHZ that mean freq3 is 5 / 6 GHZ.
+		 * so take decision using freq3.
+		 */
+		if (WLAN_REG_IS_24GHZ_CH_FREQ(freq2))
+			shared_5_ghz_freq = freq3;
+		else
+			/* freq2 5 / 6 GHZ, use freq1 */
+			shared_5_ghz_freq = freq2;
+	} else if (policy_mgr_2_freq_same_mac_in_sbs(pm_ctx, freq3, freq1)) {
+		/*
+		 * If freq1 is 2.4 GHZ that mean freq3 is 5 / 6 GHZ.
+		 * so take decision using freq3.
+		 */
+		if (WLAN_REG_IS_24GHZ_CH_FREQ(freq1))
+			shared_5_ghz_freq = freq3;
+		else
+			/* freq1 5 / 6 GHZ, use freq1 */
+			shared_5_ghz_freq = freq1;
+	}
+
+	if (!shared_5_ghz_freq ||
+	    WLAN_REG_IS_24GHZ_CH_FREQ(shared_5_ghz_freq)) {
+		policy_mgr_err("shared_5_ghz_freq %d is not 5 / 6 GHZ",
+			       shared_5_ghz_freq);
+		return;
+	}
+
+	/* If shared 5 / 6 GHZ freq is low 5 GHZ, then return high 5 GHZ freq */
+	if (shared_5_ghz_freq < sbs_cut_off_freq)
+		*index = PM_MCC_SCC_5G_LOW_PLUS_5_HIGH_SBS;
+	else
+		*index = PM_MCC_SCC_5G_HIGH_PLUS_5_LOW_SBS;
+}
+
 #ifdef WLAN_FEATURE_11BE_MLO
 /**
  * policy_mgr_get_index_for_ml_sta_sap_dbs() - Find the index for next
@@ -2762,174 +2930,6 @@ policy_mgr_get_index_for_ml_sta_sap(
 						sta_freq_list, ml_sta_idx);
 }
 
-/**
- * policy_mgr_get_index_for_3_given_freq_dbs() - Find the index for next
- * connection for given 3 freq in DBS mode
- * @pm_ctx: policy manager context
- * @index: Index to return for next connection
- * @freq1: freq of interface 1
- * @freq2: freq of interface 2
- * @freq3: freq of interface 3
- *
- * This function finds the index for next connection for 3 freq in DBS mode.
- *
- * Return: none
- */
-static void
-policy_mgr_get_index_for_3_given_freq_dbs(
-	struct policy_mgr_psoc_priv_obj *pm_ctx,
-	enum policy_mgr_three_connection_mode *index,
-	qdf_freq_t freq1, qdf_freq_t freq2, qdf_freq_t freq3)
-{
-	/* If all freq are on same band */
-	if ((WLAN_REG_IS_24GHZ_CH_FREQ(freq1) ==
-	     WLAN_REG_IS_24GHZ_CH_FREQ(freq2) &&
-	    (WLAN_REG_IS_24GHZ_CH_FREQ(freq2) ==
-	     WLAN_REG_IS_24GHZ_CH_FREQ(freq3)))) {
-		policy_mgr_err("Invalid mode for all freq %d, %d and %d on same band",
-			       freq1, freq2, freq3);
-		return;
-	}
-
-	/*
-	 * If freq1 and freq2 are on same band and freq3 is on differet band and
-	 * is not sharing mac with any SAP. STA on same band is handled above,
-	 * so both SAP on same band mean STA cannot be on same band. This can
-	 * happen if SBS is not enabled.
-	 */
-	if (WLAN_REG_IS_24GHZ_CH_FREQ(freq1) ==
-	    WLAN_REG_IS_24GHZ_CH_FREQ(freq2)) {
-		if (WLAN_REG_IS_24GHZ_CH_FREQ(freq3))
-			/*
-			 * As all 3 cannot be on same band, so if freq3 is
-			 * 2.4 GHZ mean both freq1 and freq2 are on 5 / 6 GHZ
-			 */
-			*index = PM_5_SCC_MCC_PLUS_24_DBS;
-		else
-			/*
-			 * As all 3 cannot be on same band, so if freq3 is
-			 * 5 / 6 GHZ, mean both freq1 and freq2 are on 2.4 GHZ.
-			 */
-			*index = PM_24_SCC_MCC_PLUS_5_DBS;
-		return;
-	}
-
-	/*
-	 * if freq1 and freq 2 are on different band (2 GHZ + 5 GHZ/6 GHZ DBS),
-	 * check with which freq the freq3 will share mac, and return index as
-	 * per it.
-	 */
-	if (WLAN_REG_IS_24GHZ_CH_FREQ(freq3))
-		*index = PM_24_SCC_MCC_PLUS_5_DBS;
-	else
-		*index = PM_5_SCC_MCC_PLUS_24_DBS;
-}
-
-/**
- * policy_mgr_get_index_for_3_given_freq_sbs() - Find the index for next
- * connection for 3 given freq, in case current HW mode is SBS
- * @pm_ctx: policy manager context
- * @index: Index to return for next connection
- * @freq1: freq of interface 1
- * @freq2: freq of interface 2
- * @freq3: freq of interface 3
- *
- * This function finds the index for next
- * connection for 3 given freq, in case current HW mode is SBS
- *
- * Return: none
- */
-static void policy_mgr_get_index_for_3_given_freq_sbs(
-	struct policy_mgr_psoc_priv_obj *pm_ctx,
-	enum policy_mgr_three_connection_mode *index,
-	qdf_freq_t freq1, qdf_freq_t freq2, qdf_freq_t freq3)
-{
-	qdf_freq_t sbs_cut_off_freq;
-	qdf_freq_t shared_5_ghz_freq = 0;
-
-	/*
-	 * Sanity check: At least 2 of the given freq needs to be creating SBS
-	 * separation for HW mode to be in SBS, if not it shouldn't have
-	 * entered this API.
-	 */
-	if (!policy_mgr_are_sbs_chan(pm_ctx->psoc, freq1, freq2) &&
-	    !policy_mgr_are_sbs_chan(pm_ctx->psoc, freq2, freq3) &&
-	    !policy_mgr_are_sbs_chan(pm_ctx->psoc, freq3, freq1)) {
-		policy_mgr_err("freq1 %d, freq2 %d and freq3 %d, none of the 2 connections/3 vdevs are leading to SBS",
-			       freq1, freq2, freq3);
-		return;
-	}
-
-	sbs_cut_off_freq =  policy_mgr_get_sbs_cut_off_freq(pm_ctx->psoc);
-	if (!sbs_cut_off_freq) {
-		policy_mgr_err("Invalid cutoff freq");
-		return;
-	}
-
-	/*
-	 * If dynamic SBS is enabled (2.4 GHZ can share mac with HIGH
-	 * 5GHZ as well as LOW 5 GHZ, but one at a time) and one of the
-	 * freq is 2.4 GHZ, this mean that the new interface can come up on
-	 * 5 GHZ LOW or HIGH and HW mode will move the 2.4 GHZ link to
-	 * the other mac dynamically.
-	 */
-	if (policy_mgr_can_2ghz_share_low_high_5ghz_sbs(pm_ctx) &&
-	    (WLAN_REG_IS_24GHZ_CH_FREQ(freq1) ||
-	     WLAN_REG_IS_24GHZ_CH_FREQ(freq2) ||
-	     WLAN_REG_IS_24GHZ_CH_FREQ(freq3))) {
-		*index = PM_24_5_PLUS_5_LOW_N_HIGH_SHARE_SBS;
-		return;
-	}
-	/*
-	 * if freq1 on freq2 same mac, get the 5 / 6 GHZ freq from it check
-	 * and determine shared mac.
-	 */
-	if (policy_mgr_2_freq_same_mac_in_sbs(pm_ctx, freq1, freq2)) {
-		/*
-		 * If freq1 is 2.4 GHZ that mean freq2 is 5 / 6 GHZ.
-		 * so take decision using freq2.
-		 */
-		if (WLAN_REG_IS_24GHZ_CH_FREQ(freq1))
-			shared_5_ghz_freq = freq2;
-		else
-			/* freq1 5 / 6 GHZ, use freq1 */
-			shared_5_ghz_freq = freq1;
-	} else if (policy_mgr_2_freq_same_mac_in_sbs(pm_ctx, freq2, freq3)) {
-		/*
-		 * If freq2 is 2.4 GHZ that mean freq3 is 5 / 6 GHZ.
-		 * so take decision using freq3.
-		 */
-		if (WLAN_REG_IS_24GHZ_CH_FREQ(freq2))
-			shared_5_ghz_freq = freq3;
-		else
-			/* freq2 5 / 6 GHZ, use freq1 */
-			shared_5_ghz_freq = freq2;
-	} else if (policy_mgr_2_freq_same_mac_in_sbs(pm_ctx, freq3, freq1)) {
-		/*
-		 * If freq1 is 2.4 GHZ that mean freq3 is 5 / 6 GHZ.
-		 * so take decision using freq3.
-		 */
-		if (WLAN_REG_IS_24GHZ_CH_FREQ(freq1))
-			shared_5_ghz_freq = freq3;
-		else
-			/* freq1 5 / 6 GHZ, use freq1 */
-			shared_5_ghz_freq = freq1;
-	}
-
-	if (!shared_5_ghz_freq ||
-	    WLAN_REG_IS_24GHZ_CH_FREQ(shared_5_ghz_freq)) {
-		policy_mgr_err("shared_5_ghz_freq %d is not 5 / 6 GHZ",
-			       shared_5_ghz_freq);
-		return;
-	}
-
-	/* If shared 5 / 6 GHZ freq is low 5 GHZ, then return high 5 GHZ freq */
-	if (shared_5_ghz_freq < sbs_cut_off_freq)
-		*index = PM_MCC_SCC_5G_LOW_PLUS_5_HIGH_SBS;
-	else
-		*index = PM_MCC_SCC_5G_HIGH_PLUS_5_LOW_SBS;
-}
-
 static void
 policy_mgr_get_index_for_ml_sta_sap_sap(
 			struct policy_mgr_psoc_priv_obj *pm_ctx,
@@ -3176,31 +3176,18 @@ enum policy_mgr_three_connection_mode
 			index = PM_NDI_NDI_NAN_DISC_24_SMM;
 		}
 	} else if (count_sap == 3) {
-		if (WLAN_REG_IS_SAME_BAND_FREQS(
-			pm_conc_connection_list[list_sap[0]].freq,
-			pm_conc_connection_list[list_sap[1]].freq)) {
-			if (WLAN_REG_IS_24GHZ_CH_FREQ(
-				pm_conc_connection_list[list_sap[2]].freq))
-				index = PM_SAP_SAP_SCC_5_SAP_24_DBS;
-			else
-				index = PM_SAP_SAP_SCC_24_SAP_5_DBS;
-		} else if (WLAN_REG_IS_SAME_BAND_FREQS(
-			pm_conc_connection_list[list_sap[0]].freq,
-			pm_conc_connection_list[list_sap[2]].freq)) {
-			if (WLAN_REG_IS_24GHZ_CH_FREQ(
-				pm_conc_connection_list[list_sap[1]].freq))
-				index = PM_SAP_SAP_SCC_5_SAP_24_DBS;
-			else
-				index = PM_SAP_SAP_SCC_24_SAP_5_DBS;
-		} else if (WLAN_REG_IS_SAME_BAND_FREQS(
-			pm_conc_connection_list[list_sap[1]].freq,
-			pm_conc_connection_list[list_sap[2]].freq)) {
-			if (WLAN_REG_IS_24GHZ_CH_FREQ(
-				pm_conc_connection_list[list_sap[0]].freq))
-				index = PM_SAP_SAP_SCC_5_SAP_24_DBS;
-			else
-				index = PM_SAP_SAP_SCC_24_SAP_5_DBS;
-		}
+		if (policy_mgr_is_current_hwmode_sbs(psoc))
+			policy_mgr_get_index_for_3_given_freq_sbs(pm_ctx,
+								  &index,
+								  pm_conc_connection_list[list_sap[0]].freq,
+								  pm_conc_connection_list[list_sap[1]].freq,
+								  pm_conc_connection_list[list_sap[2]].freq);
+		else if (policy_mgr_is_current_hwmode_dbs(psoc))
+			policy_mgr_get_index_for_3_given_freq_dbs(pm_ctx,
+								  &index,
+								  pm_conc_connection_list[list_sap[0]].freq,
+								  pm_conc_connection_list[list_sap[1]].freq,
+								  pm_conc_connection_list[list_sap[2]].freq);
 	}
 
 	policy_mgr_debug(

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

@@ -1983,11 +1983,6 @@ fourth_connection_pcl_dbs_sbs_table
 	[PM_NDI_MODE] = { PM_5G, PM_5G, PM_5G } },
 	[PM_NAN_DISC_24_STA_24_STA_5_DBS] = {
 	[PM_NDI_MODE] = { PM_5G, PM_5G, PM_5G } },
-#else
-	[PM_SAP_SAP_SCC_24_SAP_5_DBS] = {
-	[PM_SAP_MODE] = { PM_5G, PM_5G, PM_5G } },
-	[PM_SAP_SAP_SCC_5_SAP_24_DBS] = {
-	[PM_SAP_MODE] = { PM_24G, PM_24G, PM_24G } },
 #endif
 	[PM_24_SCC_MCC_PLUS_5_DBS] = {
 	[PM_STA_MODE] = { PM_SCC_ON_5_CH_5G, PM_SCC_ON_5_CH_5G,