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