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

qcacld-3.0: Fix get 4th connection pcl index failed

In concurrency case: GO on 5180 MHz, SAP on 5765 MHz,
MLO STA vdev 0 5180 MHz, MLO STA vdev 1 2462 MHz.
When the MLO STA is up and driver does force SCC on
SAP, the get PCL is failed because the GO vdev,
MLO STA vdev 0 and vdev 1 are all non-SBS channels
between each other. Driver doesn't handle the case in
policy_mgr_get_index_for_ml_sta_sap_sbs if current
hw mode is SBS. This case can happen the mlo sta link
vdev is inactive after get connected.
To fix it add new API:
policy_mgr_get_index_for_ml_sta_sap_hwmode_sbs to
handle it. It will return the correct PCL index
to avoid 3 home channels on same mac.

Change-Id: Ia16f8a391b34fc15287a93590b2c119d58250e20
CRs-Fixed: 3326358
Liangwei Dong 2 лет назад
Родитель
Сommit
32eb6434c7

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

@@ -108,6 +108,7 @@ static inline const char *pcl_type_to_string(uint32_t idx)
 	CASE_RETURN_STRING(PM_SCC_ON_5_5G_SCC_ON_24G);
 	CASE_RETURN_STRING(PM_SCC_ON_24_SCC_ON_5_24G);
 	CASE_RETURN_STRING(PM_SCC_ON_24_SCC_ON_5_5G);
+	CASE_RETURN_STRING(PM_SCC_ON_24_CH_24G);
 	CASE_RETURN_STRING(PM_SCC_ON_5_SCC_ON_24);
 	CASE_RETURN_STRING(PM_SCC_ON_24_SCC_ON_5);
 	CASE_RETURN_STRING(PM_MCC_CH_24G);

+ 14 - 1
components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h

@@ -378,6 +378,7 @@ enum policy_mgr_mac_use {
  *	channel on 5 Ghz & 2.4 Ghz channels
  * @PM_SCC_ON_24_SCC_ON_5_5G: SCC channel on 2.4 Ghz, SCC
  *	channel on 5 Ghz & 5 Ghz channels
+ * @PM_SCC_ON_24_CH_24G: SCC channel on 2.4 GHz & 2.4 GHz channels
  * @PM_SCC_ON_5_SCC_ON_24: SCC channel on 5 Ghz, SCC channel on
  *	2.4 Ghz
  * @PM_SCC_ON_24_SCC_ON_5: SCC channel on 2.4 Ghz, SCC channel
@@ -420,6 +421,7 @@ enum policy_mgr_pcl_type {
 	PM_SCC_ON_5_5G_SCC_ON_24G,
 	PM_SCC_ON_24_SCC_ON_5_24G,
 	PM_SCC_ON_24_SCC_ON_5_5G,
+	PM_SCC_ON_24_CH_24G,
 	PM_SCC_ON_5_SCC_ON_24,
 	PM_SCC_ON_24_SCC_ON_5,
 	PM_MCC_CH_24G,
@@ -971,6 +973,8 @@ enum policy_mgr_two_connection_mode {
  * 2.4 GHZ MCC on mac0 and second STA on low 5 GHZ on mac1 doing SBS
  * @PM_STA_STA_5_HIGH_MCC_SAP_5_LOW_SBS : First STA on high 5 GHZ & Second STA
  * on high 5 GHZ MCC on mac0 and SAP on low 5 GHZ on mac1 doing SBS
+ * @PM_STA_24_STA_5_MCC_SAP_5_HIGH_SBS: MLO STA 2+5/6 GHz, SAP on 5/6 GHz
+ * high band, the current hw mode is SBS.
  * @PM_MCC_SCC_5G_LOW_PLUS_5_HIGH_SBS: Any 2 link on low 5 GHZ mac
  * and one link on high 5 GHZ freq doing SBS
  * @PM_STA_24_SAP_5_LOW_MCC_STA_5_HIGH_SBS : First STA on 2.4 GHZ & SAP on low
@@ -986,13 +990,17 @@ enum policy_mgr_two_connection_mode {
  * @PM_24_5_MCC_SCC_PLUS_5_SBS: The 2.4 GHZ vdev creating MCC/SCC with low 5 GHZ
  * or high 5 GHZ (dynamic SBS) on mac 0 and one vdev on high 5 GHZ or low 5 GHZ
  * freq respectively on mac 1 doing SBS
+ * @PM_STA_24_STA_5_MCC_SAP_5_LOW_SBS: MLO STA 2+5/6 GHz, SAP on 5/6 GHz
+ * low band, the current hw mode is SBS.
  * @PM_SAP_24_STA_5_STA_5_LOW_N_HIGH_SHARE_SBS: The 2.4 GHZ SAP creating MCC/SCC
  * with STA of low 5 GHZ or high 5 GHZ (dynamic SBS) on mac 0 and one STA on
  * high 5 GHZ or low 5 GHZ freq respectively on mac 1 doing SBS
  * @PM_STA_24_SAP_5_STA_5_LOW_N_HIGH_SHARE_SBS: The 2.4 GHZ STA creating MCC/SCC
  * with SAP of low 5 GHZ or high 5 GHZ (dynamic SBS) on mac 0 and one STA on
  * high 5 GHZ or low 5 GHZ freq respectively on mac 1 doing SBS
- *
+ * @PM_24_5_PLUS_5_LOW_OR_HIGH_SHARE_SBS (not dynamic SBS): MLO STA 2+5/6 GHz,
+ * SAP on 5/6 GHz, and target only support 2.4 GHz shared with 5 GHz low band
+ * or 5 GHz high band but not both.
  */
 enum policy_mgr_three_connection_mode {
 	PM_STA_SAP_SCC_24_SAP_5_DBS,
@@ -1037,6 +1045,8 @@ enum policy_mgr_three_connection_mode {
 		PM_MCC_SCC_5G_HIGH_PLUS_5_LOW_SBS,
 	PM_STA_STA_5_HIGH_MCC_SAP_5_LOW_SBS =
 		PM_MCC_SCC_5G_HIGH_PLUS_5_LOW_SBS,
+	PM_STA_24_STA_5_MCC_SAP_5_HIGH_SBS =
+		PM_MCC_SCC_5G_HIGH_PLUS_5_LOW_SBS,
 	PM_MCC_SCC_5G_LOW_PLUS_5_HIGH_SBS,
 	PM_STA_24_SAP_5_LOW_MCC_STA_5_HIGH_SBS =
 		PM_MCC_SCC_5G_LOW_PLUS_5_HIGH_SBS,
@@ -1048,11 +1058,14 @@ enum policy_mgr_three_connection_mode {
 		PM_MCC_SCC_5G_LOW_PLUS_5_HIGH_SBS,
 	PM_STA_STA_5_LOW_MCC_SAP_5_HIGH_SBS =
 		PM_MCC_SCC_5G_LOW_PLUS_5_HIGH_SBS,
+	PM_STA_24_STA_5_MCC_SAP_5_LOW_SBS =
+		PM_MCC_SCC_5G_LOW_PLUS_5_HIGH_SBS,
 	PM_24_5_PLUS_5_LOW_N_HIGH_SHARE_SBS,
 	PM_SAP_24_STA_5_STA_5_LOW_N_HIGH_SHARE_SBS =
 			PM_24_5_PLUS_5_LOW_N_HIGH_SHARE_SBS,
 	PM_STA_24_SAP_5_STA_5_LOW_N_HIGH_SHARE_SBS =
 			PM_24_5_PLUS_5_LOW_N_HIGH_SHARE_SBS,
+	PM_24_5_PLUS_5_LOW_OR_HIGH_SHARE_SBS,
 
 	PM_MAX_THREE_CONNECTION_MODE,
 };

+ 36 - 7
components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c

@@ -2465,7 +2465,9 @@ get_sub_channels(struct wlan_objmgr_psoc *psoc,
  * @chlist_len_5: 5g channel list length
  * @chlist_6: 6g channel list
  * @chlist_len_6: 6g channel list length
- * order: pcl order
+ * @order: pcl order
+ * @high_5_band_scc_present: 5 GHz high band connection present
+ * @low_5_band_scc_present: 5 GHz low band connection present
  *
  * Get the pcl list based on current sbs concurrency
  *
@@ -2478,7 +2480,9 @@ add_sbs_chlist_to_pcl(struct wlan_objmgr_psoc *psoc,
 		      bool skip_dfs_channel, bool skip_6gh_channel,
 		      const uint32_t *chlist_5, uint8_t chlist_len_5,
 		      const uint32_t *chlist_6, uint8_t chlist_len_6,
-		      enum policy_mgr_pcl_channel_order order)
+		      enum policy_mgr_pcl_channel_order order,
+		      bool *high_5_band_scc_present,
+		      bool *low_5_band_scc_present)
 {
 	struct policy_mgr_psoc_priv_obj *pm_ctx;
 	qdf_freq_t sbs_cut_off_freq;
@@ -2513,6 +2517,7 @@ add_sbs_chlist_to_pcl(struct wlan_objmgr_psoc *psoc,
 				pcl_weights[*index] =
 						WEIGHT_OF_GROUP1_PCL_CHANNELS;
 				(*index)++;
+				*low_5_band_scc_present = true;
 				break;
 			}
 
@@ -2565,6 +2570,7 @@ add_sbs_chlist_to_pcl(struct wlan_objmgr_psoc *psoc,
 				pcl_weights[*index] =
 					WEIGHT_OF_GROUP1_PCL_CHANNELS;
 				(*index)++;
+				*high_5_band_scc_present = true;
 				break;
 			}
 
@@ -3134,6 +3140,8 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc,
 	uint32_t *channel_list, *channel_list_24, *channel_list_5,
 		 *sbs_freqs, *channel_list_6, *scc_freqs, *rest_freqs;
 	uint32_t sbs_num, scc_num, rest_num;
+	bool high_5_band_scc_present = false;
+	bool low_5_band_scc_present = false;
 
 	pm_ctx = policy_mgr_get_context(psoc);
 	if (!pm_ctx) {
@@ -3368,6 +3376,18 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc,
 					 channel_list_6, chan_index_6);
 		status = QDF_STATUS_SUCCESS;
 		break;
+	case PM_SCC_ON_24_CH_24G:
+		policy_mgr_get_connection_channels(psoc, mode,
+						   POLICY_MGR_PCL_ORDER_2G,
+						   true,
+						   POLICY_MGR_PCL_GROUP_ID1_ID2,
+						   pcl_channels, pcl_weights,
+						   pcl_sz, len);
+		policy_mgr_add_24g_to_pcl(pcl_channels, pcl_weights, pcl_sz,
+					  len, WEIGHT_OF_GROUP3_PCL_CHANNELS,
+					  channel_list_24, chan_index_24);
+		status = QDF_STATUS_SUCCESS;
+		break;
 	case PM_SCC_ON_5_CH_5G:
 		policy_mgr_get_connection_channels(psoc, mode,
 						   POLICY_MGR_PCL_ORDER_5G,
@@ -3722,12 +3742,17 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc,
 				      skip_6ghz_channel,
 				      channel_list_5, chan_index_5,
 				      channel_list_6, chan_index_6,
-				      POLICY_MGR_PCL_ORDER_SCC_5G_LOW_5G_LOW);
+				      POLICY_MGR_PCL_ORDER_SCC_5G_LOW_5G_LOW,
+				      &high_5_band_scc_present,
+				      &low_5_band_scc_present);
+
 		/*
 		 * If no 2.4 GHZ connection is present and If 2.4 GHZ is shared
-		 * with 5 GHz low freq then 2.4 GHz can be added as well
+		 * with 5 GHz low freq then 2.4 GHz can be added as well.
+		 * If no 5 GHz low band connection, 2.4 GHz can be added.
 		 */
-		if (!policy_mgr_2ghz_connection_present(pm_ctx) &&
+		if ((!policy_mgr_2ghz_connection_present(pm_ctx) ||
+		     !low_5_band_scc_present) &&
 		    policy_mgr_sbs_24_shared_with_low_5(pm_ctx))
 			add_chlist_to_pcl(pm_ctx->pdev,
 					  pcl_channels, pcl_weights, pcl_sz,
@@ -3743,12 +3768,16 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc,
 				      skip_6ghz_channel,
 				      channel_list_5, chan_index_5,
 				      channel_list_6, chan_index_6,
-				      POLICY_MGR_PCL_ORDER_SCC_5G_HIGH_5G_HIGH);
+				      POLICY_MGR_PCL_ORDER_SCC_5G_HIGH_5G_HIGH,
+				      &high_5_band_scc_present,
+				      &low_5_band_scc_present);
 		/*
 		 * If no 2.4 GHZ connection is present and if 2.4 GHZ is shared
 		 * with 5 GHz High freq then 2.4 GHz can be added as well
+		 * If no 5 GHz high band connection, 2.4 GHz can be added.
 		 */
-		if (!policy_mgr_2ghz_connection_present(pm_ctx) &&
+		if ((!policy_mgr_2ghz_connection_present(pm_ctx) ||
+		     !high_5_band_scc_present) &&
 		    policy_mgr_sbs_24_shared_with_high_5(pm_ctx))
 			add_chlist_to_pcl(pm_ctx->pdev,
 					  pcl_channels, pcl_weights, pcl_sz,

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

@@ -2266,6 +2266,110 @@ policy_mgr_get_index_for_ml_sta_sap_dbs(
 		*index = PM_STA_SAP_5_STA_24_DBS;
 }
 
+/**
+ * policy_mgr_get_index_for_ml_sta_sap_sbs() - Find the index for next
+ * connection for ML STA + SAP, in case current HW mode is SBS but ML STA is
+ * with 2 GHz + 5/6 GHz.
+ * @pm_ctx: policy manager context
+ * @index: Index to return for next connection
+ * @sap_freq: SAP freq
+ * @sta_freq_list: STA freq list
+ * @ml_sta_idx: ML STA index in freq_list
+ *
+ * This function finds the index for next connection for ML STA + SAP,
+ * in case current HW mode is SBS but ML STA is with 2 GHz + 5/6 GHz.
+ *
+ * Return: none
+ */
+static void policy_mgr_get_index_for_ml_sta_sap_hwmode_sbs(
+	struct policy_mgr_psoc_priv_obj *pm_ctx,
+	enum policy_mgr_three_connection_mode *index, qdf_freq_t sap_freq,
+	qdf_freq_t *sta_freq_list, uint8_t *ml_sta_idx)
+{
+	bool sbs_24_shared_high_support =
+		policy_mgr_sbs_24_shared_with_high_5(pm_ctx);
+	bool sbs_24_shared_low_support =
+		policy_mgr_sbs_24_shared_with_low_5(pm_ctx);
+	qdf_freq_t sbs_cut_off_freq, ml_sta_5g_freq;
+	bool ml_sta_5g_low;
+
+	/* HW supports sbs but ml sta 2 home channels are not in sbs frequency
+	 * separation by check policy_mgr_are_sbs_chan.
+	 * It means one ml sta is 2.4 GHz, the other is 5/6 GHz.
+	 * The combinations handled by this API:
+	 * 2.4 GHz band    |  5 GHz low band  | 5/6 GHz high band |   PCL list
+	 * ----------------------------------------------------------------------
+	 * ML STA          |  ML STA+SAP      |               |   5 GHz High + 2.4 GHz
+	 * ML STA          |  ML STA+SAP      |               |   2.4 GHz(nhss)
+	 * ML STA          |  ML STA          | SAP           |   5 GHz Low + 2.4 GHz
+	 * ML STA          |  ML STA          | SAP           |   2.4 GHz (nhss)
+	 * ML STA          |  SAP             | ML STA        |   5 GHz High+ 2.4 GHz
+	 * ML STA          |  SAP             | ML STA        |   2.4 GHz (nlss)
+	 * ML STA          |                  | ML STA+SAP    |   5 GHz Low + 2.4 GHz
+	 * ML STA          |                  | ML STA+SAP    |   2.4 GHz (nlss)
+	 * ML STA+SAP      |  ML STA          |               |   5 GHz Low+5 GHz High
+	 * ML STA+SAP      |                  | ML STA        |   5 GHz Low+5 GHz High
+	 *
+	 * nhss: no high share supported
+	 * nlss: no low share supported
+	 */
+
+	if (!WLAN_REG_IS_24GHZ_CH_FREQ(sta_freq_list[ml_sta_idx[0]]) &&
+	    !WLAN_REG_IS_24GHZ_CH_FREQ(sta_freq_list[ml_sta_idx[1]])) {
+		policy_mgr_err("unexpected ml sta home freq to handle (%d %d)",
+			       sta_freq_list[ml_sta_idx[0]],
+			       sta_freq_list[ml_sta_idx[1]]);
+		return;
+	}
+	if (!sbs_24_shared_high_support && !sbs_24_shared_high_support) {
+		policy_mgr_err("unexpected sbs mode: low share %d high share %d",
+			       sbs_24_shared_low_support,
+			       sbs_24_shared_high_support);
+		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 (!WLAN_REG_IS_24GHZ_CH_FREQ(sta_freq_list[ml_sta_idx[0]]))
+		ml_sta_5g_freq = sta_freq_list[ml_sta_idx[0]];
+	else
+		ml_sta_5g_freq = sta_freq_list[ml_sta_idx[1]];
+	if (ml_sta_5g_freq < sbs_cut_off_freq)
+		ml_sta_5g_low = true;
+	else
+		ml_sta_5g_low = false;
+
+	if (WLAN_REG_IS_24GHZ_CH_FREQ(sap_freq)) {
+		/* pcl 5 GHz Low+5 GHz High - PM_SCC_ON_5_CH_5G */
+		*index = PM_24_5_PLUS_5_LOW_N_HIGH_SHARE_SBS;
+	} else if (sap_freq < sbs_cut_off_freq) {
+		if ((ml_sta_5g_low && sbs_24_shared_high_support) ||
+		    (!ml_sta_5g_low && sbs_24_shared_low_support))
+			/* pcl 5 GHz High + 2.4 GHz -
+			 * PM_SCC_ON_5G_HIGH_5G_HIGH_PLUS_SHARED_2G
+			 */
+			*index = PM_STA_24_STA_5_MCC_SAP_5_LOW_SBS;
+		else
+			*index = PM_24_5_PLUS_5_LOW_OR_HIGH_SHARE_SBS;
+	} else {
+		if ((ml_sta_5g_low && sbs_24_shared_high_support) ||
+		    (!ml_sta_5g_low && sbs_24_shared_low_support))
+			/* pcl 5 GHz Low + 2.4 GHz -
+			 * PM_SCC_ON_5G_LOW_5G_LOW_PLUS_SHARED_2G
+			 */
+			*index = PM_STA_24_STA_5_MCC_SAP_5_HIGH_SBS;
+		else
+			*index = PM_24_5_PLUS_5_LOW_OR_HIGH_SHARE_SBS;
+	}
+	policy_mgr_debug("4th index %d sap freq %d ml sta 5g %d sbs_cut_off_freq %d support high share %d low share %d",
+			 *index, sap_freq, ml_sta_5g_freq, sbs_cut_off_freq,
+			 sbs_24_shared_high_support,
+			 sbs_24_shared_low_support);
+}
+
 /**
  * policy_mgr_get_index_for_ml_sta_sap_sbs() - Find the index for next
  * connection for ML STA + SAP, in case current HW mode is SBS or ML STA is
@@ -2302,6 +2406,12 @@ static void policy_mgr_get_index_for_ml_sta_sap_sbs(
 				     sta_freq_list[ml_sta_idx[0]]) &&
 	    !policy_mgr_are_sbs_chan(pm_ctx->psoc, sap_freq,
 				     sta_freq_list[ml_sta_idx[1]])) {
+		if (policy_mgr_is_current_hwmode_sbs(pm_ctx->psoc)) {
+			policy_mgr_get_index_for_ml_sta_sap_hwmode_sbs(
+				pm_ctx, index, sap_freq, sta_freq_list,
+				ml_sta_idx);
+			return;
+		}
 		policy_mgr_err("SAP freq (%d) and ML STA freq %d and %d, none of the 2 connections/3 vdevs are leading to SBS",
 			       sap_freq,
 			       sta_freq_list[ml_sta_idx[0]],
@@ -3812,6 +3922,7 @@ bool policy_mgr_is_3rd_conn_on_same_band_allowed(struct wlan_objmgr_psoc *psoc,
 	case PM_SCC_ON_5_5G_SCC_ON_24G:
 	case PM_SCC_ON_24_SCC_ON_5_24G:
 	case PM_SCC_ON_24_SCC_ON_5_5G:
+	case PM_SCC_ON_24_CH_24G:
 	case PM_SCC_ON_5_SCC_ON_24:
 	case PM_SCC_ON_24_SCC_ON_5:
 	case PM_24G_SCC_CH_SBS_CH:

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

@@ -2021,6 +2021,11 @@ fourth_connection_pcl_dbs_sbs_table
 			 PM_SCC_ON_5_CH_5G},
 	[PM_SAP_MODE] = {PM_SCC_ON_5_CH_5G, PM_SCC_ON_5_CH_5G,
 			 PM_SCC_ON_5_CH_5G} },
+	[PM_24_5_PLUS_5_LOW_OR_HIGH_SHARE_SBS] = {
+	[PM_STA_MODE] = {PM_SCC_ON_24_CH_24G, PM_SCC_ON_24_CH_24G,
+			PM_SCC_ON_24_CH_24G},
+	[PM_SAP_MODE] = {PM_SCC_ON_24_CH_24G, PM_SCC_ON_24_CH_24G,
+			PM_SCC_ON_24_CH_24G} },
 };
 #endif
 #endif