From 8859a74378a3cbf46d06e33ddf360a7b8bb79224 Mon Sep 17 00:00:00 2001 From: Liangwei Dong Date: Thu, 25 May 2023 14:42:59 +0800 Subject: [PATCH] qcacmn: Update scan entry chan based on RSSI For 11A only AP, HT and DS IE are not present in beacon, STA may receive the beacon on adjacent channel, then driver may record wrong channel frequency in scan entry. Fix by update the channel frequency by old scan entry channel frequency if new beacon RSSI lower than old beacon RSSI and gap is bigger than 40 db within 5s. Change-Id: Idbd144befa78597fcd50a753ca13b0f11d1f45f5 CRs-Fixed: 3484664 --- umac/scan/core/src/wlan_scan_cache_db.c | 17 ++++++++++++----- umac/scan/core/src/wlan_scan_cache_db.h | 1 + 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/umac/scan/core/src/wlan_scan_cache_db.c b/umac/scan/core/src/wlan_scan_cache_db.c index 6e07862620..6b43944a01 100644 --- a/umac/scan/core/src/wlan_scan_cache_db.c +++ b/umac/scan/core/src/wlan_scan_cache_db.c @@ -779,11 +779,21 @@ scm_copy_info_from_dup_entry(struct wlan_objmgr_pdev *pdev, * -- RSSI is less than -80, this indicate that the signal has leaked * in adjacent channel. */ - if ((scan_params->frm_subtype == MGMT_SUBTYPE_BEACON) && + time_gap = + scan_params->scan_entry_time - + scan_entry->rssi_timestamp; + + if ((scan_params->frm_subtype == MGMT_SUBTYPE_BEACON || + scan_params->frm_subtype == MGMT_SUBTYPE_PROBE_RESP) && !util_scan_entry_htinfo(scan_params) && !util_scan_entry_ds_param(scan_params) && + !util_scan_entry_vhtop(scan_params) && + !util_scan_entry_heop(scan_params) && (scan_params->channel.chan_freq != scan_entry->channel.chan_freq) && - (scan_params->rssi_raw < ADJACENT_CHANNEL_RSSI_THRESHOLD)) { + (scan_params->rssi_raw < ADJACENT_CHANNEL_RSSI_THRESHOLD || + (time_gap < WLAN_RSSI_AVERAGING_TIME && + (scan_params->rssi_raw + ADJACENT_CHANNEL_RSSI_DIFF_THRESHOLD) < + scan_entry->rssi_raw))) { scan_params->channel.chan_freq = scan_entry->channel.chan_freq; scan_params->channel_mismatch = true; } @@ -803,9 +813,6 @@ scm_copy_info_from_dup_entry(struct wlan_objmgr_pdev *pdev, * Otherwise new frames RSSI and SNR are more representative * of the signal strength. */ - time_gap = - scan_params->scan_entry_time - - scan_entry->rssi_timestamp; if (time_gap > WLAN_RSSI_AVERAGING_TIME) { scan_params->avg_rssi = WLAN_RSSI_IN(scan_params->rssi_raw); diff --git a/umac/scan/core/src/wlan_scan_cache_db.h b/umac/scan/core/src/wlan_scan_cache_db.h index ff1804350c..cecd3d12f5 100644 --- a/umac/scan/core/src/wlan_scan_cache_db.h +++ b/umac/scan/core/src/wlan_scan_cache_db.h @@ -35,6 +35,7 @@ (((const uint8_t *)(addr))[QDF_MAC_ADDR_SIZE - 1] % SCAN_HASH_SIZE) #define ADJACENT_CHANNEL_RSSI_THRESHOLD -80 +#define ADJACENT_CHANNEL_RSSI_DIFF_THRESHOLD 40 /** * struct scan_dbs - scan cache data base definition