Jelajahi Sumber

qcacld-3.0: Add support for four port concurrencies

Add Support for four port concurrency support for ML
sta + p2p + p2p. PCL will be same for SAP, P2P GO and
P2P CLI, so only SAP is considered in naming convention
to avoid repetitive handling.

Change-Id: Ie66407fd79f4e7b51271da8146c681dbf303810e
CRs-Fixed: 3177300
Sheenam Monga 3 tahun lalu
induk
melakukan
2b47974b8f

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

@@ -3337,6 +3337,19 @@ void policy_mgr_init_dbs_hw_mode(struct wlan_objmgr_psoc *psoc,
 
 QDF_STATUS policy_mgr_update_sbs_freq(struct wlan_objmgr_psoc *psoc,
 				      struct target_psoc_info *tgt_hdl);
+
+/**
+ * policy_mgr_get_sbs_cut_off_freq() - Function to get SBS 5g cut off freq
+ *
+ * @psoc: PSOC object information
+ *
+ * This function to get sbs cut off freq
+ *
+ * Return: cut of freq
+ *
+ */
+qdf_freq_t policy_mgr_get_sbs_cut_off_freq(struct wlan_objmgr_psoc *psoc);
+
 /**
  * policy_mgr_update_hw_mode_list() - Function to initialize DBS
  * HW modes in policy manager component

+ 26 - 0
components/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h

@@ -174,6 +174,8 @@ enum policy_mgr_pcl_group_id {
  * @POLICY_MGR_PCL_ORDER_5G_THEN_2G: 5 Ghz channel followed by 2.4 Ghz channel
  * @POLICY_MGR_PCL_ORDER_2G: 2G channels
  * @POLICY_MGR_PCL_ORDER_5G: 5G channels
+ * @POLICY_MGR_PCL_ORDER_5G_LOW : 5G low share
+ * @POLICY_MGR_PCL_ORDER_5G_HIGH : 5G High share
  *
  * Order in which the PCL is requested
  */
@@ -183,6 +185,8 @@ enum policy_mgr_pcl_channel_order {
 	POLICY_MGR_PCL_ORDER_5G_THEN_2G,
 	POLICY_MGR_PCL_ORDER_2G,
 	POLICY_MGR_PCL_ORDER_5G,
+	POLICY_MGR_PCL_ORDER_5G_LOW,
+	POLICY_MGR_PCL_ORDER_5G_HIGH,
 };
 
 /**
@@ -368,6 +372,9 @@ 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_CH_5G_LOW,
+	PM_CH_5G_HIGH,
+
 	PM_MAX_PCL_TYPE
 };
 
@@ -881,6 +888,19 @@ enum policy_mgr_two_connection_mode {
  * and second STA on 5Ghz SMM
  * @PM_NAN_DISC_24_STA_24_STA_5_DBS: NAN Disc on 2.4Ghz and first STA on 2.4Ghz
  * and second STA on 5Ghz DBS
+ * @PM_STA_24_SAP_5_LOW_MCC_STA_5_HIGH_SBS : First STA on 2.4 & SAP on low 5G
+ * MCC on mac 0 and second STA on high 5g on mac1
+ * @PM_STA_24_SAP_5_HIGH_MCC_STA_5_LOW_SBS : First STA on 2.4 & SAP on high 5G
+ * MCC on mac 0 and second STA on high 5g on mac1
+ * @PM_STA_SAP_5_LOW_STA_5_HIGH_SBS : First STA on low 5G & SAP on low 5G
+ * SCC/MCC on mac0 and second STA on high 5G on mac1
+ * @PM_STA_SAP_5_HIGH_STA_5_LOW_SBS : First STA on high 5G & SAP on high 5G
+ * SCC/MCC on mac1 and second STA on low 5G on mac0
+ * @PM_STA_5_LOW_SAP_24_MCC_STA_5_HIGH_SBS : First STA on low 5G & SAP on high
+ * 2.4G MCC on mac0 and second STA on high 5g on mac1
+ * @PM_STA_5_HIGH_SAP_24_MCC_STA_5_LOW_SBS : First STA on high 5G & SAP on 2.4G
+ * MCC on mac1 and second STA on low 5g on mac0
+ *
  */
 enum policy_mgr_three_connection_mode {
 	PM_STA_SAP_SCC_24_SAP_5_DBS,
@@ -911,6 +931,12 @@ enum policy_mgr_three_connection_mode {
 	PM_NAN_DISC_24_STA_5_STA_24_DBS,
 	PM_NAN_DISC_24_STA_24_STA_5_SMM,
 	PM_NAN_DISC_24_STA_24_STA_5_DBS,
+	PM_STA_24_SAP_5_LOW_MCC_STA_5_HIGH_SBS,
+	PM_STA_24_SAP_5_HIGH_MCC_STA_5_LOW_SBS,
+	PM_STA_SAP_5_LOW_STA_5_HIGH_SBS,
+	PM_STA_SAP_5_HIGH_STA_5_LOW_SBS,
+	PM_STA_5_LOW_SAP_24_MCC_STA_5_HIGH_SBS,
+	PM_STA_5_HIGH_SAP_24_MCC_STA_5_LOW_SBS,
 
 	PM_MAX_THREE_CONNECTION_MODE
 };

+ 122 - 6
components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c

@@ -2265,6 +2265,110 @@ get_sub_channels(struct wlan_objmgr_psoc *psoc,
 			chlist2, chlist2_len);
 }
 
+/**
+ * add_sbs_chlist_to_pcl() - add sbs channel list in pcl
+ *
+ * @psoc: psoc object
+ * @pcl_freqs: pcl frequencies
+ * @pcl_weights: pcl weight
+ * @pcl_sz: pcl size
+ * @index: pcl index
+ * @weight: provided weight for pcl list
+ * @skip_dfs_channel: to skip dfs channels or not
+ * @skip_6gh_channel: to skip 6g channels or not
+ * @chlist_5: 5g channel list
+ * @chlist_len_5: 5g channel list length
+ * @chlist_6: 6g channel list
+ * @chlist_len_6: 6g channel list length
+ * order: pcl order
+ *
+ * Get the pcl list based on current sbs concurrency
+ *
+ * Return: None
+ */
+static void
+add_sbs_chlist_to_pcl(struct wlan_objmgr_psoc *psoc,
+		      uint32_t *pcl_freqs, uint8_t *pcl_weights,
+		      uint32_t pcl_sz, uint32_t *index, uint32_t weight,
+		      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)
+{
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+	qdf_freq_t sbs_cut_off_freq;
+	uint32_t i;
+
+	if (!policy_mgr_is_hw_sbs_capable(psoc))
+		return;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid Context");
+		return;
+	}
+	sbs_cut_off_freq = policy_mgr_get_sbs_cut_off_freq(psoc);
+	if (order == POLICY_MGR_PCL_ORDER_5G_LOW) {
+		for (i = 0; i < chlist_len_5 && *index < pcl_sz; i++) {
+			if (chlist_5[i] > sbs_cut_off_freq)
+				return;
+
+			if (skip_dfs_channel &&
+			    wlan_reg_is_dfs_for_freq(pm_ctx->pdev, chlist_5[i]))
+				continue;
+
+			pcl_freqs[*index] = chlist_5[i];
+			pcl_weights[*index] = weight;
+			(*index)++;
+		}
+		for (i = 0; i < chlist_len_6 && *index < pcl_sz &&
+		     !skip_6gh_channel; i++) {
+			if (chlist_6[i] > sbs_cut_off_freq)
+				return;
+
+			if (skip_dfs_channel &&
+			    wlan_reg_is_dfs_for_freq(pm_ctx->pdev, chlist_6[i]))
+				continue;
+
+			pcl_freqs[*index] = chlist_6[i];
+			pcl_weights[*index] = weight;
+			(*index)++;
+		}
+	} else if (order == POLICY_MGR_PCL_ORDER_5G_HIGH) {
+		for (i = 0; i < chlist_len_5 && *index < pcl_sz; i++) {
+			if (chlist_5[i] < sbs_cut_off_freq)
+				continue;
+
+			if (skip_dfs_channel &&
+			    wlan_reg_is_dfs_for_freq(pm_ctx->pdev, chlist_5[i]))
+				continue;
+
+			pcl_freqs[*index] = chlist_5[i];
+			pcl_weights[*index] = weight;
+			(*index)++;
+		}
+		for (i = 0; i < chlist_len_6 && *index < pcl_sz &&
+		     !skip_6gh_channel; i++) {
+			if (chlist_6[i] < sbs_cut_off_freq)
+				return;
+
+			if (skip_dfs_channel &&
+			    wlan_reg_is_dfs_for_freq(pm_ctx->pdev, chlist_6[i]))
+				continue;
+
+			pcl_freqs[*index] = chlist_6[i];
+			pcl_weights[*index] = weight;
+			(*index)++;
+		}
+
+	} else {
+		policy_mgr_debug("invalid order");
+		return;
+	}
+
+	policy_mgr_debug("new pcl index %d", *index);
+}
+
 static void
 add_chlist_to_pcl(struct wlan_objmgr_pdev *pdev,
 		  uint32_t *pcl_freqs, uint8_t *pcl_weights,
@@ -3313,12 +3417,6 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc,
 				  len, WEIGHT_OF_GROUP1_PCL_CHANNELS,
 				  sbs_freqs, sbs_num,
 				  skip_dfs_channel, skip_6ghz_channel);
-		if (!sbs_num)
-			add_chlist_to_pcl(pm_ctx->pdev,
-					  pcl_channels, pcl_weights, pcl_sz,
-					  len, WEIGHT_OF_GROUP1_PCL_CHANNELS,
-					  scc_freqs, scc_num,
-					  skip_dfs_channel, skip_6ghz_channel);
 		add_chlist_to_pcl(pm_ctx->pdev,
 				  pcl_channels, pcl_weights, pcl_sz,
 				  len, WEIGHT_OF_GROUP2_PCL_CHANNELS,
@@ -3326,6 +3424,24 @@ QDF_STATUS policy_mgr_get_channel_list(struct wlan_objmgr_psoc *psoc,
 				  false, false);
 		status = QDF_STATUS_SUCCESS;
 		break;
+	case PM_CH_5G_LOW:
+		add_sbs_chlist_to_pcl(psoc,  pcl_channels,
+				      pcl_weights, pcl_sz,
+				      len, WEIGHT_OF_GROUP1_PCL_CHANNELS,
+				      skip_dfs_channel, skip_6ghz_channel,
+				      channel_list_5, chan_index_5,
+				      channel_list_6, chan_index_6,
+				      POLICY_MGR_PCL_ORDER_5G_LOW);
+		break;
+	case PM_CH_5G_HIGH:
+		add_sbs_chlist_to_pcl(psoc,  pcl_channels,
+				      pcl_weights, pcl_sz,
+				      len, WEIGHT_OF_GROUP1_PCL_CHANNELS,
+				      skip_dfs_channel, skip_6ghz_channel,
+				      channel_list_5, chan_index_5,
+				      channel_list_6, chan_index_6,
+				      POLICY_MGR_PCL_ORDER_5G_HIGH);
+		break;
 	default:
 		policy_mgr_err("unknown pcl value %d", pcl);
 		break;

+ 42 - 0
components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c

@@ -1296,6 +1296,47 @@ QDF_STATUS policy_mgr_update_sbs_freq(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
+qdf_freq_t policy_mgr_get_sbs_cut_off_freq(struct wlan_objmgr_psoc *psoc)
+{
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+	struct policy_mgr_freq_range *first_mac_range, *second_mac_range;
+	qdf_freq_t sbs_cut_off_freq = 0;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid Context");
+		return 0;
+	}
+
+	if (pm_ctx->hw_mode.sbs_lower_band_end_freq)
+		return pm_ctx->hw_mode.sbs_lower_band_end_freq;
+	/*
+	 * if cutoff freq is not available from FW (i.e SBS is not dynamic)
+	 * get it from SBS freq range
+	 */
+	first_mac_range = &pm_ctx->hw_mode.freq_range_caps[MODE_SBS][0];
+
+	second_mac_range =
+		&pm_ctx->hw_mode.freq_range_caps[MODE_SBS][1];
+
+	/*
+	 * SBS range is low 5Ghz shared with 2.4Ghz: The low_5Ghz of shared
+	 * mac will be starting of 5Ghz and low_5Ghz of non-shared mac will be
+	 * the cutoff freq
+	 *
+	 * SBS range is high 5Ghz shared with 2.4Ghz: The low_5Ghz of shared
+	 * mac will be cutoff freq and low_5Ghz of non-shared mac will be
+	 * the starting of 5Ghz
+	 *
+	 * so, maximum of low_5Ghz will be cutoff freq
+	 */
+	sbs_cut_off_freq = QDF_MAX(second_mac_range->low_5ghz_freq,
+				   first_mac_range->low_5ghz_freq) - 1;
+	policy_mgr_debug("sbs cutoff freq %d", sbs_cut_off_freq);
+
+	return sbs_cut_off_freq;
+}
+
 static bool
 policy_mgr_2_freq_same_mac_in_freq_range(
 				struct policy_mgr_psoc_priv_obj *pm_ctx,
@@ -2164,6 +2205,7 @@ bool policy_mgr_is_hw_sbs_capable(struct wlan_objmgr_psoc *psoc)
 	}
 
 	if (!policy_mgr_find_if_fw_supports_dbs(psoc)) {
+		policy_mgr_rl_debug("fw doesn't support dual band");
 		return false;
 	}
 

+ 1 - 1
components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h

@@ -215,7 +215,7 @@ extern policy_mgr_next_action_three_connection_table_type
 
 #ifdef FEATURE_FOURTH_CONNECTION
 extern const enum policy_mgr_pcl_type
-	fourth_connection_pcl_dbs_table
+	fourth_connection_pcl_dbs_sbs_table
 	[PM_MAX_THREE_CONNECTION_MODE][PM_MAX_NUM_OF_MODE]
 	[PM_MAX_CONC_PRIORITY_MODE];
 #endif

+ 7 - 2
components/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c

@@ -1056,7 +1056,8 @@ static enum policy_mgr_pcl_type policy_mgr_get_pcl_4_port(
 	}
 
 	/* SAP and P2P Go have same result in 4th port pcl table */
-	if (mode == PM_SAP_MODE || mode == PM_P2P_GO_MODE) {
+	if (mode == PM_SAP_MODE || mode == PM_P2P_GO_MODE ||
+	    mode == PM_P2P_CLIENT_MODE) {
 		mode = PM_SAP_MODE;
 	}
 
@@ -1074,7 +1075,7 @@ static enum policy_mgr_pcl_type policy_mgr_get_pcl_4_port(
 	}
 	policy_mgr_debug("Index for 4th port pcl table: %d", fourth_index);
 
-	pcl = fourth_connection_pcl_dbs_table[fourth_index][mode][pref];
+	pcl = fourth_connection_pcl_dbs_sbs_table[fourth_index][mode][pref];
 
 	return pcl;
 }
@@ -2065,6 +2066,8 @@ enum policy_mgr_three_connection_mode
 				psoc, PM_SAP_MODE, &list_sap[count_sap]);
 	count_sap += policy_mgr_mode_specific_connection_count(
 				psoc, PM_P2P_GO_MODE, &list_sap[count_sap]);
+	count_sap += policy_mgr_mode_specific_connection_count(
+				psoc, PM_P2P_CLIENT_MODE, &list_sap[count_sap]);
 	count_sta = policy_mgr_mode_specific_connection_count(
 				psoc, PM_STA_MODE, list_sta);
 	count_ndi = policy_mgr_mode_specific_connection_count(
@@ -2929,6 +2932,8 @@ bool policy_mgr_is_3rd_conn_on_same_band_allowed(struct wlan_objmgr_psoc *psoc,
 	case PM_5G_MCC_CH:
 	case PM_24G_SBS_CH_MCC_CH:
 	case PM_SBS_CH_2G:
+	case PM_CH_5G_LOW:
+	case PM_CH_5G_HIGH:
 		ret = true;
 		break;
 	default:

+ 25 - 11
components/cmn_services/policy_mgr/src/wlan_policy_mgr_tables_2x2_dbs_i.h

@@ -1906,13 +1906,13 @@ pm_third_connection_pcl_dbs_2x2_table = {
 
 #ifdef FEATURE_FOURTH_CONNECTION
 /**
- * fourth_connection_pcl_dbs_table - table which provides PCL for
+ * fourth_connection_pcl_dbs_sbs_table - table which provides PCL for
  * the 4th connection, when we have 3 connections already in
- * the system (with DBS supported by HW), this table is for auto products.
+ * the system (with DBS & SBS supported by HW), this table is for auto products.
  */
 #ifdef FOURTH_CONNECTION_AUTO
 const enum policy_mgr_pcl_type
-fourth_connection_pcl_dbs_table
+fourth_connection_pcl_dbs_sbs_table
 	[PM_MAX_THREE_CONNECTION_MODE][PM_MAX_NUM_OF_MODE]
 	[PM_MAX_CONC_PRIORITY_MODE] = {
 	[PM_STA_SAP_SCC_24_SAP_5_DBS] = {
@@ -1933,7 +1933,7 @@ fourth_connection_pcl_dbs_table
 };
 #elif defined(MDM_PLATFORM)
 const enum policy_mgr_pcl_type
-fourth_connection_pcl_dbs_table
+fourth_connection_pcl_dbs_sbs_table
 	[PM_MAX_THREE_CONNECTION_MODE][PM_MAX_NUM_OF_MODE]
 	[PM_MAX_CONC_PRIORITY_MODE] = {
 	[PM_SAP_SAP_SCC_24_SAP_5_DBS] = {
@@ -1943,15 +1943,15 @@ fourth_connection_pcl_dbs_table
 };
 #else
 /**
- * fourth_connection_pcl_dbs_table - table which provides PCL for
+ * fourth_connection_pcl_dbs_sbs_table - table which provides PCL for
  * the 4th connection, when we have 3 connections already in
- * the system (with DBS supported by HW), this table is for mobile products
- * If you want to support any 4 port other than the below in MCL add below as
- * other concurrencies supported by auto may not be PORed for mobile products
- * and vice-versa.
+ * the system (with DBS & SBS supported by HW), this table is for mobile
+ * products If you want to support any 4 port other than the below in MCL add
+ * below as other concurrencies supported by auto may not be PORed for mobile
+ * products and vice-versa.
  */
 const enum policy_mgr_pcl_type
-fourth_connection_pcl_dbs_table
+fourth_connection_pcl_dbs_sbs_table
 	[PM_MAX_THREE_CONNECTION_MODE][PM_MAX_NUM_OF_MODE]
 	[PM_MAX_CONC_PRIORITY_MODE] = {
 	[PM_NAN_DISC_STA_24_NDI_5_DBS] = {
@@ -1996,7 +1996,21 @@ fourth_connection_pcl_dbs_table
 	[PM_SAP_MODE] = { PM_SCC_ON_5_CH_5G, PM_SCC_ON_5_CH_5G,
 			 PM_SCC_ON_5_CH_5G} },
 	[PM_STA_SAP_5_STA_24_DBS] = {
-	[PM_SAP_MODE] = { PM_SBS_CH_2G, PM_SBS_CH_2G, PM_SBS_CH_2G } }
+	[PM_SAP_MODE] = { PM_SBS_CH_2G, PM_SBS_CH_2G, PM_SBS_CH_2G } },
+
+	[PM_STA_24_SAP_5_LOW_MCC_STA_5_HIGH_SBS] = {
+	[PM_SAP_MODE] = {PM_CH_5G_HIGH, PM_CH_5G_HIGH, PM_CH_5G_HIGH} },
+	[PM_STA_24_SAP_5_HIGH_MCC_STA_5_LOW_SBS] = {
+	[PM_SAP_MODE] = {PM_CH_5G_LOW, PM_CH_5G_LOW, PM_CH_5G_LOW} },
+	[PM_STA_SAP_5_LOW_STA_5_HIGH_SBS] = {
+	[PM_SAP_MODE] = {PM_CH_5G_HIGH, PM_CH_5G_HIGH, PM_CH_5G_HIGH} },
+	[PM_STA_SAP_5_HIGH_STA_5_LOW_SBS] = {
+	[PM_SAP_MODE] = {PM_CH_5G_LOW, PM_CH_5G_LOW, PM_CH_5G_LOW} },
+	[PM_STA_5_LOW_SAP_24_MCC_STA_5_HIGH_SBS] = {
+	[PM_SAP_MODE] = {PM_CH_5G_HIGH, PM_CH_5G_HIGH, PM_CH_5G_HIGH} },
+	[PM_STA_5_HIGH_SAP_24_MCC_STA_5_LOW_SBS] = {
+	[PM_SAP_MODE] = {PM_CH_5G_LOW, PM_CH_5G_LOW, PM_CH_5G_LOW} },
+
 };
 #endif
 #endif