mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 06:09:23 -04:00
qcacmn: update average rssi in scan entry
If elapsed time since last rssi update for a particular scan entry is smaller than a thresold, calculate a running average of the RSSI values. Otherwise last RSSI is more representive of the signal strength. Change-Id: I4cbecc8b6bfbb73c272544114b063b25c26e14fe CRs-Fixed: 1095299
This commit is contained in:
parent
d9e8b4f531
commit
cdcbb39764
4 changed files with 27 additions and 7 deletions
|
|
@ -364,12 +364,11 @@ static void scm_delete_duplicate_entry(struct scan_dbs *scan_db,
|
|||
struct scan_cache_node *scan_node)
|
||||
{
|
||||
struct scan_cache_entry *scan_entry;
|
||||
uint64_t time_gap;
|
||||
|
||||
scan_entry = scan_node->entry;
|
||||
/* If old entry have the ssid but new entry does not */
|
||||
if (!scan_params->ssid.length && scan_entry->ssid.length) {
|
||||
uint64_t time_gap;
|
||||
|
||||
/*
|
||||
* New entry has a hidden SSID and old one has the SSID.
|
||||
* Add the entry by using the ssid of the old entry
|
||||
|
|
@ -397,9 +396,29 @@ static void scm_delete_duplicate_entry(struct scan_dbs *scan_db,
|
|||
*/
|
||||
if (scan_params->channel_mismatch) {
|
||||
scan_params->rssi_raw = scan_entry->rssi_raw;
|
||||
scan_params->avg_rssi = scan_entry->avg_rssi;
|
||||
scan_params->rssi_timestamp =
|
||||
scan_entry->rssi_timestamp;
|
||||
} else {
|
||||
/* If elapsed time since last rssi update for this
|
||||
* entry is smaller than a thresold, calculate a
|
||||
* running average of the RSSI values.
|
||||
* Otherwise last RSSI is more representive of the
|
||||
* signal strength.
|
||||
*/
|
||||
time_gap =
|
||||
scan_entry->rssi_timestamp -
|
||||
scan_params->rssi_timestamp;
|
||||
if (time_gap > WLAN_RSSI_AVERAGING_TIME)
|
||||
scan_params->avg_rssi =
|
||||
WLAN_RSSI_IN(scan_params->rssi_raw);
|
||||
else
|
||||
WLAN_RSSI_LPF(scan_params->avg_rssi,
|
||||
scan_params->rssi_raw);
|
||||
|
||||
scan_params->rssi_timestamp = scan_params->scan_entry_time;
|
||||
}
|
||||
|
||||
/* copy wsn ie from scan_entry to scan_params*/
|
||||
scm_update_alt_wcn_ie(scan_entry, scan_params);
|
||||
|
||||
|
|
@ -542,6 +561,7 @@ QDF_STATUS scm_handle_bcn_probe(struct scheduler_msg *msg)
|
|||
goto free_nbuf;
|
||||
}
|
||||
|
||||
|
||||
scm_info("Received %s from BSSID: %pM tsf_delta = %u Seq Num: %x ssid:%.*s",
|
||||
(bcn->frm_type == MGMT_SUBTYPE_PROBE_RESP) ?
|
||||
"Probe Rsp" : "Beacon", scan_entry->bssid.bytes,
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ struct scan_cache_entry {
|
|||
struct wlan_ssid ssid;
|
||||
uint16_t seq_num;
|
||||
enum wlan_phymode phy_mode;
|
||||
int8_t avg_rssi;
|
||||
int32_t avg_rssi;
|
||||
int8_t rssi_raw;
|
||||
uint16_t bcn_int;
|
||||
union wlan_capability cap_info;
|
||||
|
|
|
|||
|
|
@ -181,6 +181,7 @@ util_scan_entry_reset_timestamp(struct scan_cache_entry *scan_entry)
|
|||
/*
|
||||
* Macros used for RSSI calculation.
|
||||
*/
|
||||
#define WLAN_RSSI_AVERAGING_TIME (5 * 1000) /* 5 seconds */
|
||||
|
||||
#define WLAN_RSSI_EP_MULTIPLIER (1<<7) /* pow2 to optimize out * and / */
|
||||
|
||||
|
|
|
|||
|
|
@ -575,6 +575,7 @@ util_scan_unpack_beacon_frame(uint8_t *frame,
|
|||
(le16toh(*(uint16_t *)hdr->i_seq) >> WLAN_SEQ_SEQ_SHIFT);
|
||||
|
||||
scan_entry->rssi_raw = rx_param->rssi;
|
||||
scan_entry->avg_rssi = WLAN_RSSI_DUMMY_MARKER;
|
||||
scan_entry->tsf_delta = rx_param->tsf_delta;
|
||||
|
||||
/* store jiffies */
|
||||
|
|
@ -593,10 +594,8 @@ util_scan_unpack_beacon_frame(uint8_t *frame,
|
|||
bcn->timestamp, 8);
|
||||
scan_entry->erp = ERP_NON_ERP_PRESENT;
|
||||
|
||||
|
||||
scan_entry->rssi_timestamp =
|
||||
scan_entry->scan_entry_time =
|
||||
qdf_mc_timer_get_system_time();
|
||||
scan_entry->scan_entry_time =
|
||||
qdf_mc_timer_get_system_time();
|
||||
|
||||
scan_entry->raw_frame.len = frame_len;
|
||||
qdf_mem_copy(scan_entry->raw_frame.ptr,
|
||||
|
|
|
|||
Loading…
Reference in a new issue