Browse Source

qcacld-3.0: Increase the range of PCL if dynamic SBS is enabled for 4 port

In dynamic SBS if 2.4 GHz is sharing mac with 5 GHz low, it can be
dynamically be moved have mac sharing with 5 GHz high.
So if one of the freq is 2.4 GHz in existing 3 connection, the
4th connection can be brought up on any 5 GHz freq (low/high) and
the 2.4 GHz vdev will be moved with other mac.
Similarly for all 3 connection be on 5 GHz and SBS, in case of the
dynamic SBS along with the low/high 5 GHz freq, 2.4 GHz freq can be
included in PCL, as 2.4 GHz can share mac with any of high/low 5 GHz.
e.g
if current concurrency is:
    => STA (2.4 GHz) + SAP (5 GHz low) on mac 0 and STA (5 GHz high)
       on mac 1 (LOW mac share with 2.4 GHz)
currently only 5 GHz high is present in PCL thus making:
    => STA (2.4 GHz) + SAP (5 GHz low) on mac 0 and STA (5 GHz high) +
       SAP (5 GHz high) on mac 1 (LOW mac shared with 2.4 GHz)
but 5 GHz low (i.e. all 5 GHz) can be provided in PCL to make it as below:
    => STA (2.4 GHz) + SAP (5 GHz high) on mac 0 and STA (5 GHz low) +
       SAP (5 GHz low) on mac 1 (HIGH mac shared with 2.4 GHz)
Also for below 5 GHz high and 2.4 GHz can be provided in PCL
    => STA (5 GHz low) + SAP (5 GHz low) on mac 0 and STA (5 GHz high)
       on mac 1
If it select 5GHz high:
    => STA (5 GHz low) + SAP (5 GHz low) on mac 0 and STA (5 GHz high) +
       SAP (5 GHz high) on mac 1
if it select 2.4 GHz:
    => STA (5 GHz high) + SAP (2 GHz) on mac 0 and STA (5 GHz low) +
       SAP (5 GHz low) on mac 1 (HIGH mac shared with 2.4 GHz)
Thus increasing the range of PCL for dynamic SBS.

Change-Id: I3fc555f137050fd49b5ce5eaf12f57f19ee9d903
CRs-Fixed: 3227280
Sheenam Monga 2 years ago
parent
commit
cffb442e97

+ 2 - 2
components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h

@@ -126,8 +126,8 @@ static inline const char *pcl_type_to_string(uint32_t idx)
 	CASE_RETURN_STRING(PM_SBS_CH_SCC_CH_5G_24G);
 	CASE_RETURN_STRING(PM_SCC_CH_MCC_CH_SBS_CH_24G);
 	CASE_RETURN_STRING(PM_SBS_CH_2G);
-	CASE_RETURN_STRING(PM_SCC_ON_5G_LOW_5G_LOW);
-	CASE_RETURN_STRING(PM_SCC_ON_5G_HIGH_5G_HIGH);
+	CASE_RETURN_STRING(PM_SCC_ON_5G_LOW_5G_LOW_PLUS_SHARED_2G);
+	CASE_RETURN_STRING(PM_SCC_ON_5G_HIGH_5G_HIGH_PLUS_SHARED_2G);
 	default:
 		return "Unknown";
 	}

+ 20 - 6
components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h

@@ -389,10 +389,10 @@ enum policy_mgr_mac_use {
  *      SBS channels & rest of the 5G channels
  * @PM_24G_SBS_CH_MCC_CH: 2.4 Ghz channels, SBS channels & MCC channels
  * @PM_SBS_CH_2G: SBS channels & 2.4 Ghz channels
- * @PM_SCC_ON_5G_LOW_5G_LOW: 5G low SCC channel followed by
- * 5G frequencies < sbs cut off freq
- * @PM_SCC_ON_5G_HIGH_5G_HIGH: 5G high SCC channel followed by
- * frequencies > sbs cut off freq
+ * @PM_SCC_ON_5G_LOW_5G_LOW_PLUS_SHARED_2G: 5 GHz low SCC channel followed by
+ * 5 GHz low frequencies, add 2.4 GHz if its shared with 5 GHz low
+ * @PM_SCC_ON_5G_HIGH_5G_HIGH_PLUS_SHARED_2G: 5GHZ high SCC channel followed by
+ * 5 GHz high frequencies, add 2.4 GHZ if its shared with 5GHz high
  *
  * @PM_MAX_PCL_TYPE: Max place holder
  *
@@ -434,8 +434,8 @@ enum policy_mgr_pcl_type {
 	PM_SBS_CH_SCC_CH_5G_24G,
 	PM_SCC_CH_MCC_CH_SBS_CH_24G,
 	PM_SBS_CH_2G,
-	PM_SCC_ON_5G_LOW_5G_LOW,
-	PM_SCC_ON_5G_HIGH_5G_HIGH,
+	PM_SCC_ON_5G_LOW_5G_LOW_PLUS_SHARED_2G,
+	PM_SCC_ON_5G_HIGH_5G_HIGH_PLUS_SHARED_2G,
 
 	PM_MAX_PCL_TYPE
 };
@@ -980,6 +980,15 @@ enum policy_mgr_two_connection_mode {
  * 2.4 GHZ MCC on mac0 and second STA on high 5 GHZ on mac1 doing SBS
  * @PM_STA_STA_5_LOW_MCC_SAP_5_HIGH_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_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_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
  *
  */
 enum policy_mgr_three_connection_mode {
@@ -1036,6 +1045,11 @@ 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_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_MAX_THREE_CONNECTION_MODE,
 };

+ 47 - 2
components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c

@@ -3114,6 +3114,27 @@ policy_mgr_add_24g_to_pcl(uint32_t *pcl_freqs, uint8_t *pcl_weights,
 			 chlist_24g_len, num_to_add, *index);
 }
 
+static bool
+policy_mgr_2ghz_connection_present(struct policy_mgr_psoc_priv_obj *pm_ctx)
+{
+	bool is_2ghz_present = false;
+	uint32_t conn_index;
+
+	qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock);
+	for (conn_index = 0; conn_index < MAX_NUMBER_OF_CONC_CONNECTIONS;
+		conn_index++) {
+		if (pm_conc_connection_list[conn_index].in_use &&
+		    (WLAN_REG_IS_24GHZ_CH_FREQ(
+				pm_conc_connection_list[conn_index].freq))) {
+			is_2ghz_present = true;
+			break;
+		}
+	}
+	qdf_mutex_release(&pm_ctx->qdf_conc_list_lock);
+
+	return is_2ghz_present;
+}
+
 /**
  * policy_mgr_get_channel_list() - provides the channel list
  * suggestion for new connection
@@ -3728,7 +3749,7 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc,
 				  false, false);
 		status = QDF_STATUS_SUCCESS;
 		break;
-	case PM_SCC_ON_5G_LOW_5G_LOW:
+	case PM_SCC_ON_5G_LOW_5G_LOW_PLUS_SHARED_2G:
 		add_sbs_chlist_to_pcl(psoc,  pcl_channels,
 				      pcl_weights, pcl_sz,
 				      len, skip_dfs_channel,
@@ -3736,8 +3757,20 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc,
 				      channel_list_5, chan_index_5,
 				      channel_list_6, chan_index_6,
 				      POLICY_MGR_PCL_ORDER_SCC_5G_LOW_5G_LOW);
+		/*
+		 * If no 2.4 GHZ connetcion is present and If 2.4 GHZ is shared
+		 * with 5 GHz low freq then 2.4 GHz can be added as well
+		 */
+		if (!policy_mgr_2ghz_connection_present(pm_ctx) &&
+		    policy_mgr_sbs_24_shared_with_low_5(pm_ctx))
+			add_chlist_to_pcl(pm_ctx->pdev,
+					  pcl_channels, pcl_weights, pcl_sz,
+					  len, WEIGHT_OF_GROUP3_PCL_CHANNELS,
+					  channel_list_24, chan_index_24,
+					  false, false);
+		status = QDF_STATUS_SUCCESS;
 		break;
-	case PM_SCC_ON_5G_HIGH_5G_HIGH:
+	case PM_SCC_ON_5G_HIGH_5G_HIGH_PLUS_SHARED_2G:
 		add_sbs_chlist_to_pcl(psoc,  pcl_channels,
 				      pcl_weights, pcl_sz,
 				      len, skip_dfs_channel,
@@ -3745,6 +3778,18 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc,
 				      channel_list_5, chan_index_5,
 				      channel_list_6, chan_index_6,
 				      POLICY_MGR_PCL_ORDER_SCC_5G_HIGH_5G_HIGH);
+		/*
+		 * If no 2.4 GHZ connetcion is present and if 2.4 GHZ is shared
+		 * with 5 GHz High freq then 2.4 GHz can be added as well
+		 */
+		if (!policy_mgr_2ghz_connection_present(pm_ctx) &&
+		    policy_mgr_sbs_24_shared_with_high_5(pm_ctx))
+			add_chlist_to_pcl(pm_ctx->pdev,
+					  pcl_channels, pcl_weights, pcl_sz,
+					  len, WEIGHT_OF_GROUP3_PCL_CHANNELS,
+					  channel_list_24, chan_index_24,
+					  false, false);
+		status = QDF_STATUS_SUCCESS;
 		break;
 	default:
 		policy_mgr_err("unknown pcl value %d", pcl);

+ 72 - 1
components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c

@@ -1423,6 +1423,77 @@ policy_mgr_2_freq_same_mac_in_freq_range(
 	return false;
 }
 
+bool policy_mgr_can_2ghz_share_low_high_5ghz_sbs(
+			struct policy_mgr_psoc_priv_obj *pm_ctx)
+{
+	if (pm_ctx->hw_mode.sbs_lower_band_end_freq)
+		return true;
+
+	return false;
+}
+
+bool
+policy_mgr_sbs_24_shared_with_high_5(struct policy_mgr_psoc_priv_obj *pm_ctx)
+{
+	qdf_freq_t sbs_cut_off_freq;
+	struct policy_mgr_freq_range freq_range;
+	uint8_t i = 0;
+
+	if (policy_mgr_can_2ghz_share_low_high_5ghz_sbs(pm_ctx))
+		return true;
+
+	sbs_cut_off_freq = policy_mgr_get_sbs_cut_off_freq(pm_ctx->psoc);
+	if (!sbs_cut_off_freq) {
+		policy_mgr_err("Invalid cut off freq");
+		return false;
+	}
+
+	for (i = 0; i < MAX_MAC; i++) {
+		freq_range = pm_ctx->hw_mode.freq_range_caps[MODE_SBS][i];
+		/*
+		 * if 5 GHZ start freq of this mac is greater than cutoff
+		 * return true
+		 */
+		if (freq_range.low_2ghz_freq && freq_range.low_5ghz_freq) {
+			if  (sbs_cut_off_freq < freq_range.low_5ghz_freq)
+				return true;
+		}
+	}
+
+	return false;
+}
+
+bool
+policy_mgr_sbs_24_shared_with_low_5(struct policy_mgr_psoc_priv_obj *pm_ctx)
+{
+	qdf_freq_t sbs_cut_off_freq;
+	struct policy_mgr_freq_range freq_range;
+	uint8_t i = 0;
+
+	if (policy_mgr_can_2ghz_share_low_high_5ghz_sbs(pm_ctx))
+		return true;
+
+	sbs_cut_off_freq = policy_mgr_get_sbs_cut_off_freq(pm_ctx->psoc);
+	if (!sbs_cut_off_freq) {
+		policy_mgr_err("Invalid cut off freq");
+		return false;
+	}
+
+	for (i = 0; i < MAX_MAC; i++) {
+		freq_range = pm_ctx->hw_mode.freq_range_caps[MODE_SBS][i];
+		if (freq_range.low_2ghz_freq && freq_range.high_5ghz_freq) {
+			/*
+			 * if 5 GHZ end freq of this mac is less than cutoff
+			 * return true
+			 */
+			if  (sbs_cut_off_freq > freq_range.high_5ghz_freq)
+				return true;
+		}
+	}
+
+	return false;
+}
+
 bool
 policy_mgr_2_freq_same_mac_in_sbs(struct policy_mgr_psoc_priv_obj *pm_ctx,
 				  qdf_freq_t freq_1, qdf_freq_t freq_2)
@@ -1435,7 +1506,7 @@ policy_mgr_2_freq_same_mac_in_sbs(struct policy_mgr_psoc_priv_obj *pm_ctx,
 	if (!policy_mgr_is_hw_sbs_capable(pm_ctx->psoc))
 		return true;
 
-	if (pm_ctx->hw_mode.sbs_lower_band_end_freq) {
+	if (policy_mgr_can_2ghz_share_low_high_5ghz_sbs(pm_ctx)) {
 		sbs_uppr_share =
 			pm_ctx->hw_mode.freq_range_caps[MODE_SBS_UPPER_SHARE];
 		sbs_low_share =

+ 32 - 0
components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h

@@ -873,6 +873,38 @@ bool policy_mgr_is_concurrency_allowed(struct wlan_objmgr_psoc *psoc,
 				       enum hw_mode_bandwidth bw,
 				       uint32_t ext_flags);
 
+/**
+ * policy_mgr_can_2ghz_share_low_high_5ghz_sbs() - if SBS mode is dynamic where
+ * 2.4 GHZ can be shared by any of high 5 GHZ or low 5GHZ at a time.
+ * @pm_ctx: policy mgr psoc priv object
+ *
+ * Return: true is sbs is dynamic else false.
+ */
+bool policy_mgr_can_2ghz_share_low_high_5ghz_sbs(
+				struct policy_mgr_psoc_priv_obj *pm_ctx);
+
+/**
+ * policy_mgr_sbs_24_shared_with_high_5() - if 2.4 GHZ
+ * can be shared by high 5 GHZ
+ *
+ * @pm_ctx: policy mgr psoc priv object
+ *
+ * Return: true if 2.4 GHz is shared by high 5 GHZ
+ */
+bool
+policy_mgr_sbs_24_shared_with_high_5(struct policy_mgr_psoc_priv_obj *pm_ctx);
+
+/**
+ * policy_mgr_sbs_24_shared_with_low_5() - if 2.4 GHZ
+ * can be shared by low 5 GHZ
+ *
+ * @pm_ctx: policy mgr psoc priv object
+ *
+ * Return: true if 2.4 GHz is shared by low 5 GHZ
+ */
+bool
+policy_mgr_sbs_24_shared_with_low_5(struct policy_mgr_psoc_priv_obj *pm_ctx);
+
 /**
  * policy_mgr_2_freq_same_mac_in_sbs() - to check provided frequencies are
  * in sbs freq range or not

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

@@ -2242,6 +2242,8 @@ static void policy_mgr_get_index_for_ml_sta_sap_sbs(
 	qdf_freq_t *sta_freq_list, uint8_t *ml_sta_idx)
 {
 	qdf_freq_t sbs_cut_off_freq;
+	bool can_2ghz_share_low_high_5ghz =
+			policy_mgr_can_2ghz_share_low_high_5ghz_sbs(pm_ctx);
 
 	/*
 	 * Sanity check: At least one of the 3 combo (ML STA OR SAP + one of
@@ -2268,6 +2270,17 @@ static void policy_mgr_get_index_for_ml_sta_sap_sbs(
 	}
 
 	if (WLAN_REG_IS_24GHZ_CH_FREQ(sap_freq)) {
+		/*
+		 * 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 SAP is
+		 * 2.4 GHZ, this mean that the new SAP can come up on 5 GHZ LOW
+		 * or HIGH and HW mode will move the 2.4 GHZ SAP to the other
+		 * mac dynamically.
+		 */
+		if (can_2ghz_share_low_high_5ghz) {
+			*index = PM_SAP_24_STA_5_STA_5_LOW_N_HIGH_SHARE_SBS;
+			return;
+		}
 		/*
 		 * if SAP is 2.4 GHZ that means both ML STA needs to
 		 * be with 5 GHZ + 5 GHZ/6 GHZ SBS separation. If not, it would
@@ -2304,6 +2317,17 @@ static void policy_mgr_get_index_for_ml_sta_sap_sbs(
 	/* SAP freq is 5 GHZ or 6 GHZ and one ML sta is on 2.4 GHZ */
 	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]])) {
+		/*
+		 * 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 STA
+		 * link is 2.4 GHZ, this mean that the new SAP 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 (can_2ghz_share_low_high_5ghz) {
+			*index = PM_STA_24_SAP_5_STA_5_LOW_N_HIGH_SHARE_SBS;
+			return;
+		}
 		/*
 		 * If (2 GHZ + 5 GHZ/6 GHZ) ML is MCC i.e Both sta links are on
 		 * same mac and SAP is on separate mac. This can happen if SBS
@@ -2503,6 +2527,21 @@ static void policy_mgr_get_index_for_3_given_freq_sbs(
 		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.

+ 17 - 8
components/cmn_services/policy_mgr/src/wlan_policy_mgr_tables_2x2_dbs_i.h

@@ -2003,15 +2003,24 @@ fourth_connection_pcl_dbs_sbs_table
 	[PM_SAP_MODE] = { PM_SBS_CH_2G, PM_SBS_CH_2G,
 			  PM_SBS_CH_2G } },
 	[PM_MCC_SCC_5G_HIGH_PLUS_5_LOW_SBS] = {
-	[PM_STA_MODE] = {PM_SCC_ON_5G_LOW_5G_LOW, PM_SCC_ON_5G_LOW_5G_LOW,
-			 PM_SCC_ON_5G_LOW_5G_LOW},
-	[PM_SAP_MODE] = {PM_SCC_ON_5G_LOW_5G_LOW, PM_SCC_ON_5G_LOW_5G_LOW,
-			 PM_SCC_ON_5G_LOW_5G_LOW} },
+	[PM_STA_MODE] = {PM_SCC_ON_5G_LOW_5G_LOW_PLUS_SHARED_2G,
+			 PM_SCC_ON_5G_LOW_5G_LOW_PLUS_SHARED_2G,
+			 PM_SCC_ON_5G_LOW_5G_LOW_PLUS_SHARED_2G},
+	[PM_SAP_MODE] = {PM_SCC_ON_5G_LOW_5G_LOW_PLUS_SHARED_2G,
+			 PM_SCC_ON_5G_LOW_5G_LOW_PLUS_SHARED_2G,
+			 PM_SCC_ON_5G_LOW_5G_LOW_PLUS_SHARED_2G} },
 	[PM_MCC_SCC_5G_LOW_PLUS_5_HIGH_SBS] = {
-	[PM_STA_MODE] = {PM_SCC_ON_5G_HIGH_5G_HIGH, PM_SCC_ON_5G_HIGH_5G_HIGH,
-			 PM_SCC_ON_5G_HIGH_5G_HIGH},
-	[PM_SAP_MODE] = {PM_SCC_ON_5G_HIGH_5G_HIGH, PM_SCC_ON_5G_HIGH_5G_HIGH,
-			 PM_SCC_ON_5G_HIGH_5G_HIGH} },
+	[PM_STA_MODE] = {PM_SCC_ON_5G_HIGH_5G_HIGH_PLUS_SHARED_2G,
+			 PM_SCC_ON_5G_HIGH_5G_HIGH_PLUS_SHARED_2G,
+			 PM_SCC_ON_5G_HIGH_5G_HIGH_PLUS_SHARED_2G},
+	[PM_SAP_MODE] = {PM_SCC_ON_5G_HIGH_5G_HIGH_PLUS_SHARED_2G,
+			 PM_SCC_ON_5G_HIGH_5G_HIGH_PLUS_SHARED_2G,
+			 PM_SCC_ON_5G_HIGH_5G_HIGH_PLUS_SHARED_2G} },
+	[PM_24_5_PLUS_5_LOW_N_HIGH_SHARE_SBS] = {
+	[PM_STA_MODE] = {PM_SCC_ON_5_CH_5G, PM_SCC_ON_5_CH_5G,
+			 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} },
 };
 #endif
 #endif