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

qcacld-3.0: Update bss count based on channel offset only for same band

In sap_update_rssi_bsscount, bss count for channels is
incremented based on offset only and does not consider
if channel on which scan result is received and the
offset channel belong to same band. This could result
in incorrect increment of bss count for some channels
when channels from both bands are present.

Fix is to increment bss count based on channel offset
only if both channels belong to same band and also
choose channel with lower bss count among the channels
having least weight.

Change-Id: Icee978fc40047782c79fe36cba29e3feed3c90aa
CRs-Fixed: 2191324
Yeshwanth Sriram Guntuka 7 лет назад
Родитель
Сommit
273889e7cc
1 измененных файлов с 26 добавлено и 0 удалено
  1. 26 0
      core/sap/src/sap_ch_select.c

+ 26 - 0
core/sap/src/sap_ch_select.c

@@ -1035,6 +1035,24 @@ uint32_t sap_weight_channel_status(struct sap_context *sap_ctx,
 	       sap_weight_channel_txpwr_tput(sap_ctx, channel_stat);
 }
 
+/**
+ * sap_check_channels_same_band() - Check if two channels belong to same band
+ * @ch_num1: channel number
+ * @ch_num2: channel number
+ *
+ * Return: true if both channels belong to same band else false
+ */
+static bool sap_check_channels_same_band(uint16_t ch_num1, uint16_t ch_num2)
+{
+	if ((ch_num1 <= SIR_11B_CHANNEL_END &&
+	     ch_num2 <= SIR_11B_CHANNEL_END) ||
+	    (ch_num1 >= SIR_11A_CHANNEL_BEGIN &&
+	     ch_num2 >= SIR_11A_CHANNEL_BEGIN))
+	    return true;
+
+	return false;
+}
+
 /**
  * sap_update_rssi_bsscount() - updates bss count and rssi effect.
  *
@@ -1061,6 +1079,9 @@ static void sap_update_rssi_bsscount(tSapSpectChInfo *pSpectCh, int32_t offset,
 	if (pExtSpectCh != NULL &&
 	    pExtSpectCh >= spectch_start &&
 	    pExtSpectCh < spectch_end) {
+		if (!sap_check_channels_same_band(pSpectCh->chNum,
+		    pExtSpectCh->chNum))
+			return;
 		++pExtSpectCh->bssCount;
 		switch (offset) {
 		case -1:
@@ -1749,6 +1770,11 @@ static void sap_sort_chl_weight(tSapChSelSpectInfo *pSpectInfoParams)
 			if (pSpectCh[j].weight <
 			    pSpectCh[minWeightIndex].weight) {
 				minWeightIndex = j;
+			} else if (pSpectCh[j].weight ==
+				   pSpectCh[minWeightIndex].weight) {
+				if (pSpectCh[j].bssCount <
+				    pSpectCh[minWeightIndex].bssCount)
+					minWeightIndex = j;
 			}
 		}
 		if (minWeightIndex != i) {