From 652d7e834ea042b9c9acf6bbf421cd78a48f37b9 Mon Sep 17 00:00:00 2001 From: Deepak Dhamdhere Date: Thu, 6 Aug 2015 14:16:53 -0700 Subject: [PATCH] qcacld-3.0: Fix issue about signal jump rssi_raw should not be updated when the channel in probe response does not match the channel in BD. Added rx_channel field to beacon descriptor passed from LIM to CSR. Channel check is performed in csr_remove_dup_bss_description() before computing new averaged rssi. CRs-Fixed: 873549 Change-Id: Iefacbf73f880e9d0c957ad83839dd2203fdf862d --- core/mac/inc/sir_api.h | 3 +- core/mac/src/pe/lim/lim_scan_result_utils.c | 2 ++ core/sme/src/csr/csr_api_scan.c | 37 ++++++++++++--------- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 2577959cc4af..162cebc9c294 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -655,7 +655,8 @@ typedef struct sSirBssDescription { /* whether it is from a probe rsp */ uint8_t fProbeRsp; - uint8_t reservedPadding1; + /* Actual channel the beacon/probe response was received on */ + uint8_t rx_channel; uint8_t reservedPadding2; uint8_t reservedPadding3; uint32_t WscIeLen; diff --git a/core/mac/src/pe/lim/lim_scan_result_utils.c b/core/mac/src/pe/lim/lim_scan_result_utils.c index 85d60932d66a..a26a289531c5 100644 --- a/core/mac/src/pe/lim/lim_scan_result_utils.c +++ b/core/mac/src/pe/lim/lim_scan_result_utils.c @@ -165,6 +165,8 @@ lim_collect_bss_description(tpAniSirGlobal pMac, } pBssDescr->channelIdSelf = pBssDescr->channelId; + pBssDescr->rx_channel = rxChannel; + /* set the network type in bss description */ channelNum = pBssDescr->channelId; pBssDescr->nwType = diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c index b775de7e74a8..fde1c3038bb1 100644 --- a/core/sme/src/csr/csr_api_scan.c +++ b/core/sme/src/csr/csr_api_scan.c @@ -2525,23 +2525,30 @@ bool csr_remove_dup_bss_description(tpAniSirGlobal pMac, if (csr_is_duplicate_bss_description(pMac, &scan_entry->Result.BssDescriptor, bss_dscp, pIes, fForced)) { - int32_t rssi_new, rssi_old; + if (bss_dscp->rx_channel == bss_dscp->channelId) { + /* + * Update rssi values only if beacon is + * received on the same channel that was + * sent on. + */ + int32_t rssi_new, rssi_old; + const int32_t weight = + CSR_SCAN_RESULT_RSSI_WEIGHT; - rssi_new = (int32_t) bss_dscp->rssi; - rssi_old = (int32_t) scan_entry-> - Result.BssDescriptor.rssi; - rssi_new = ((rssi_new * CSR_SCAN_RESULT_RSSI_WEIGHT) + - rssi_old * - (100 - CSR_SCAN_RESULT_RSSI_WEIGHT)) / 100; - bss_dscp->rssi = (int8_t) rssi_new; + rssi_new = (int32_t) bss_dscp->rssi; + rssi_old = (int32_t) scan_entry-> + Result.BssDescriptor.rssi; + rssi_new = ((rssi_new * weight) + + rssi_old * (100 - weight)) / 100; + bss_dscp->rssi = (int8_t) rssi_new; - rssi_new = (int32_t) bss_dscp->rssi_raw; - rssi_old = (int32_t) scan_entry-> - Result.BssDescriptor.rssi_raw; - rssi_new = ((rssi_new * CSR_SCAN_RESULT_RSSI_WEIGHT) + - rssi_old * - (100 - CSR_SCAN_RESULT_RSSI_WEIGHT)) / 100; - bss_dscp->rssi_raw = (int8_t) rssi_new; + rssi_new = (int32_t) bss_dscp->rssi_raw; + rssi_old = (int32_t) scan_entry-> + Result.BssDescriptor.rssi_raw; + rssi_new = ((rssi_new * weight) + + rssi_old * (100 - weight)) / 100; + bss_dscp->rssi_raw = (int8_t) rssi_new; + } /* Remove the old entry from the list */ if (csr_ll_remove_entry