From 71562069e1cc4abec8f8ebad218f98d6ade91a72 Mon Sep 17 00:00:00 2001 From: gaurank kathpalia Date: Tue, 3 Dec 2019 14:23:27 +0530 Subject: [PATCH] qcacld-3.0: Fix combined weight issue in ACS Currently the driver calculates the best channel amoung the given spectrum and uses logic to select best frequency amoung the BW members, but the logic to maximize the weight before selecting the min weight is wrong, and must be done after the selection of the minimum weight frequency. Fix is to maximize the weight after the minimum weight channel is selected. Change-Id: Ie196462fbcc4215e6eb655168d07305110ff0ee7 CRs-Fixed: 2578582 --- core/sap/src/sap_ch_select.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/sap/src/sap_ch_select.c b/core/sap/src/sap_ch_select.c index 63923b499460..6e526509d7eb 100644 --- a/core/sap/src/sap_ch_select.c +++ b/core/sap/src/sap_ch_select.c @@ -1653,11 +1653,11 @@ static void sap_sort_chl_weight_80_mhz(struct mac_context *mac_ctx, minIdx = 0; for (i = 0; i < 4; i++) { - pSpectInfo[j + i].weight = SAP_ACS_WEIGHT_MAX * 4; if (min_ch_weight > pSpectInfo[j + i].weight) { min_ch_weight = pSpectInfo[j + i].weight; minIdx = i; } + pSpectInfo[j + i].weight = SAP_ACS_WEIGHT_MAX * 4; } pSpectInfo[j + minIdx].weight = combined_weight; @@ -1818,12 +1818,11 @@ static void sap_sort_chl_weight_160_mhz(struct mac_context *mac_ctx, minIdx = 0; for (i = 0; i < 8; i++) { - pSpectInfo[j + i].weight = SAP_ACS_WEIGHT_MAX * 8; - if (min_ch_weight > pSpectInfo[j + i].weight) { min_ch_weight = pSpectInfo[j + i].weight; minIdx = i; } + pSpectInfo[j + i].weight = SAP_ACS_WEIGHT_MAX * 8; } pSpectInfo[j + minIdx].weight = combined_weight; @@ -2118,11 +2117,11 @@ static void sap_sort_chl_weight_40_mhz(struct mac_context *mac_ctx, minIdx = 0; for (i = 0; i < 2; i++) { - pSpectInfo[j + i].weight = SAP_ACS_WEIGHT_MAX * 2; if (min_ch_weight > pSpectInfo[j + i].weight) { min_ch_weight = pSpectInfo[j + i].weight; minIdx = i; } + pSpectInfo[j + i].weight = SAP_ACS_WEIGHT_MAX * 2; } pSpectInfo[j + minIdx].weight = combined_weight;