Browse Source

qcacld-3.0: Send only PCL to supplicant

For non-DBS and no Interband MCC supported targets, send only
PCL to supplicant when number of connections are more then 0.

Change-Id: I12b1d483de55cca2d70d17d7114bdbde72c59826
CRs-Fixed: 2711485
Rachit Kankane 4 years ago
parent
commit
46554fb229
1 changed files with 46 additions and 39 deletions
  1. 46 39
      core/hdd/src/wlan_hdd_cfg80211.c

+ 46 - 39
core/hdd/src/wlan_hdd_cfg80211.c

@@ -10783,16 +10783,16 @@ const struct nla_policy get_preferred_freq_list_policy[
 };
 
 static uint32_t wlan_hdd_populate_weigh_pcl(
+				struct wlan_objmgr_psoc *psoc,
 				struct policy_mgr_pcl_chan_weights *
 				chan_weights,
 				struct weighed_pcl *w_pcl,
 				enum policy_mgr_con_mode intf_mode)
 {
-	int i, j;
-	uint32_t chan_idx = 0;
-	uint32_t set = 0;
-	uint32_t pcl_len = chan_weights->pcl_len;
-	uint32_t valid_weight;
+	u32 i, j, valid_weight;
+	u32 chan_idx = 0;
+	u32 pcl_len = chan_weights->pcl_len;
+	u32 conn_count = policy_mgr_get_connection_count(psoc);
 
 	/* convert channel number to frequency */
 	for (i = 0; i < chan_weights->pcl_len; i++) {
@@ -10800,45 +10800,51 @@ static uint32_t wlan_hdd_populate_weigh_pcl(
 		w_pcl[i].weight = chan_weights->weight_list[i];
 
 		if (intf_mode == PM_SAP_MODE || intf_mode == PM_P2P_GO_MODE)
-			w_pcl[i].flag = set | PCL_CHANNEL_SUPPORT_GO;
+			w_pcl[i].flag = PCL_CHANNEL_SUPPORT_GO;
 		else
-			w_pcl[i].flag = set | PCL_CHANNEL_SUPPORT_CLI;
+			w_pcl[i].flag = PCL_CHANNEL_SUPPORT_CLI;
 	}
 	chan_idx = pcl_len;
-	if (pcl_len && chan_weights->weight_list[pcl_len - 1] >
-	    PCL_GROUPS_WEIGHT_DIFFERENCE)
-	/* Set non-pcl channels weight 20 point less than the last PCL entry */
-		valid_weight = chan_weights->weight_list[pcl_len - 1] -
-				PCL_GROUPS_WEIGHT_DIFFERENCE;
-	else
-		valid_weight = 1;
+	if (!conn_count || policy_mgr_is_hw_dbs_capable(psoc) ||
+	    policy_mgr_is_interband_mcc_supported(psoc)) {
+		if (pcl_len && chan_weights->weight_list[pcl_len - 1] >
+		    PCL_GROUPS_WEIGHT_DIFFERENCE)
+		/*
+		 * Set non-pcl channels weight 20 point less than the
+		 * last PCL entry
+		 */
+			valid_weight = chan_weights->weight_list[pcl_len - 1] -
+					PCL_GROUPS_WEIGHT_DIFFERENCE;
+		else
+			valid_weight = 1;
 
-	/* Include rest of the valid channels */
-	for (i = 0; i < chan_weights->saved_num_chan; i++) {
-		for (j = 0; j < chan_weights->pcl_len; j++) {
-			if (chan_weights->saved_chan_list[i] ==
-				chan_weights->pcl_list[j])
-				break;
-		}
-		if (j == chan_weights->pcl_len) {
-			w_pcl[chan_idx].freq =
-				chan_weights->saved_chan_list[i];
-
-			if (!chan_weights->weighed_valid_list[i]) {
-				w_pcl[chan_idx].flag =
-					set | PCL_CHANNEL_EXCLUDE_IN_GO_NEG;
-				w_pcl[chan_idx].weight = 0;
-			} else {
-				if (intf_mode == PM_SAP_MODE ||
-				    intf_mode == PM_P2P_GO_MODE)
-					w_pcl[chan_idx].flag =
-						set | PCL_CHANNEL_SUPPORT_GO;
-				else
+		/* Include rest of the valid channels */
+		for (i = 0; i < chan_weights->saved_num_chan; i++) {
+			for (j = 0; j < chan_weights->pcl_len; j++) {
+				if (chan_weights->saved_chan_list[i] ==
+					chan_weights->pcl_list[j])
+					break;
+			}
+			if (j == chan_weights->pcl_len) {
+				w_pcl[chan_idx].freq =
+					chan_weights->saved_chan_list[i];
+
+				if (!chan_weights->weighed_valid_list[i]) {
 					w_pcl[chan_idx].flag =
-						set | PCL_CHANNEL_SUPPORT_CLI;
-				w_pcl[chan_idx].weight = valid_weight;
+						PCL_CHANNEL_EXCLUDE_IN_GO_NEG;
+					w_pcl[chan_idx].weight = 0;
+				} else {
+					if (intf_mode == PM_SAP_MODE ||
+					    intf_mode == PM_P2P_GO_MODE)
+						w_pcl[chan_idx].flag =
+						      PCL_CHANNEL_SUPPORT_GO;
+					else
+						w_pcl[chan_idx].flag =
+						      PCL_CHANNEL_SUPPORT_CLI;
+					w_pcl[chan_idx].weight = valid_weight;
+				}
+				chan_idx++;
 			}
-			chan_idx++;
 		}
 	}
 	return chan_idx;
@@ -10935,7 +10941,8 @@ static int __wlan_hdd_cfg80211_get_preferred_freq_list(struct wiphy *wiphy,
 		qdf_mem_free(chan_weights);
 		return -ENOMEM;
 	}
-	pcl_len = wlan_hdd_populate_weigh_pcl(chan_weights, w_pcl, intf_mode);
+	pcl_len = wlan_hdd_populate_weigh_pcl(hdd_ctx->psoc, chan_weights,
+					      w_pcl, intf_mode);
 	qdf_mem_free(chan_weights);
 
 	for (i = 0; i < pcl_len; i++)