Ver código fonte

qcacld-3.0: skip channel switch if best channel is in PCL list

Currently during ACS process, if best channel after weight sorting
is not in PCL list, then further check if there is a channel in PCL
has some weight, if there is, then switch to this new channel.

Skip above process if best channel is already in PCL list.

Change-Id: I5bfb6d18c531e6b7b4ff0b8b2bb2bd47388fed0c
CRs-Fixed: 2589033
Kai Liu 5 anos atrás
pai
commit
a664146e1d
1 arquivos alterados com 22 adições e 17 exclusões
  1. 22 17
      core/sap/src/sap_ch_select.c

+ 22 - 17
core/sap/src/sap_ch_select.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -2338,26 +2338,31 @@ uint32_t sap_select_channel(mac_handle_t mac_handle,
 	 * channel which has same weightage and is in PCL, choose the one in
 	 * PCL
 	 */
-	for (count = 0; count < spect_info->numSpectChans; count++) {
-		if (best_chan_freq == spect_info->pSpectCh[count].chan_freq)
-			continue;
+	if (!ch_in_pcl(sap_ctx, best_chan_freq)) {
+		uint32_t cal_chan_freq, cal_chan_weight;
+		for (count = 0; count < spect_info->numSpectChans; count++) {
+			cal_chan_freq = spect_info->pSpectCh[count].chan_freq;
+			cal_chan_weight = spect_info->pSpectCh[count].weight;
+			/* skip pcl channel whose weight is bigger than best */
+			if (!ch_in_pcl(sap_ctx, cal_chan_freq) ||
+			    (cal_chan_weight > best_ch_weight))
+				continue;
 
-		if (!ch_in_pcl(sap_ctx,
-			       spect_info->pSpectCh[count].chan_freq) ||
-		    (spect_info->pSpectCh[count].weight != best_ch_weight))
-			continue;
+			if (best_chan_freq == cal_chan_freq)
+				continue;
 
-		if (sap_select_preferred_channel_from_channel_list(
-			spect_info->pSpectCh[count].chan_freq, sap_ctx,
-			spect_info)
-			== SAP_CHANNEL_NOT_SELECTED)
-			continue;
+			if (sap_select_preferred_channel_from_channel_list(
+				cal_chan_freq, sap_ctx,
+				spect_info)
+				== SAP_CHANNEL_NOT_SELECTED)
+				continue;
 
-		best_chan_freq = spect_info->pSpectCh[count].chan_freq;
-		sap_debug("Changed best freq to %d Preferred freq",
-			  best_chan_freq);
+			best_chan_freq = cal_chan_freq;
+			sap_debug("Changed best freq to %d Preferred freq",
+				  best_chan_freq);
 
-		break;
+			break;
+		}
 	}
 
 	sap_ctx->acs_cfg->pri_ch_freq = best_chan_freq;