summaryrefslogtreecommitdiffstats
path: root/net/mac80211/mlme.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r--net/mac80211/mlme.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 79cfc2b35ef0..c7d316b440ef 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -82,13 +82,6 @@ MODULE_PARM_DESC(probe_wait_ms,
82 " before disconnecting (reason 4)."); 82 " before disconnecting (reason 4).");
83 83
84/* 84/*
85 * Weight given to the latest Beacon frame when calculating average signal
86 * strength for Beacon frames received in the current BSS. This must be
87 * between 1 and 15.
88 */
89#define IEEE80211_SIGNAL_AVE_WEIGHT 3
90
91/*
92 * How many Beacon frames need to have been used in average signal strength 85 * How many Beacon frames need to have been used in average signal strength
93 * before starting to indicate signal change events. 86 * before starting to indicate signal change events.
94 */ 87 */
@@ -3366,21 +3359,19 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
3366 /* Track average RSSI from the Beacon frames of the current AP */ 3359 /* Track average RSSI from the Beacon frames of the current AP */
3367 if (ifmgd->flags & IEEE80211_STA_RESET_SIGNAL_AVE) { 3360 if (ifmgd->flags & IEEE80211_STA_RESET_SIGNAL_AVE) {
3368 ifmgd->flags &= ~IEEE80211_STA_RESET_SIGNAL_AVE; 3361 ifmgd->flags &= ~IEEE80211_STA_RESET_SIGNAL_AVE;
3369 ifmgd->ave_beacon_signal = rx_status->signal * 16; 3362 ewma_beacon_signal_init(&ifmgd->ave_beacon_signal);
3370 ifmgd->last_cqm_event_signal = 0; 3363 ifmgd->last_cqm_event_signal = 0;
3371 ifmgd->count_beacon_signal = 1; 3364 ifmgd->count_beacon_signal = 1;
3372 ifmgd->last_ave_beacon_signal = 0; 3365 ifmgd->last_ave_beacon_signal = 0;
3373 } else { 3366 } else {
3374 ifmgd->ave_beacon_signal =
3375 (IEEE80211_SIGNAL_AVE_WEIGHT * rx_status->signal * 16 +
3376 (16 - IEEE80211_SIGNAL_AVE_WEIGHT) *
3377 ifmgd->ave_beacon_signal) / 16;
3378 ifmgd->count_beacon_signal++; 3367 ifmgd->count_beacon_signal++;
3379 } 3368 }
3380 3369
3370 ewma_beacon_signal_add(&ifmgd->ave_beacon_signal, -rx_status->signal);
3371
3381 if (ifmgd->rssi_min_thold != ifmgd->rssi_max_thold && 3372 if (ifmgd->rssi_min_thold != ifmgd->rssi_max_thold &&
3382 ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT) { 3373 ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT) {
3383 int sig = ifmgd->ave_beacon_signal / 16; 3374 int sig = -ewma_beacon_signal_read(&ifmgd->ave_beacon_signal);
3384 int last_sig = ifmgd->last_ave_beacon_signal; 3375 int last_sig = ifmgd->last_ave_beacon_signal;
3385 struct ieee80211_event event = { 3376 struct ieee80211_event event = {
3386 .type = RSSI_EVENT, 3377 .type = RSSI_EVENT,
@@ -3407,10 +3398,11 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
3407 if (bss_conf->cqm_rssi_thold && 3398 if (bss_conf->cqm_rssi_thold &&
3408 ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT && 3399 ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT &&
3409 !(sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI)) { 3400 !(sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_CQM_RSSI)) {
3410 int sig = ifmgd->ave_beacon_signal / 16; 3401 int sig = -ewma_beacon_signal_read(&ifmgd->ave_beacon_signal);
3411 int last_event = ifmgd->last_cqm_event_signal; 3402 int last_event = ifmgd->last_cqm_event_signal;
3412 int thold = bss_conf->cqm_rssi_thold; 3403 int thold = bss_conf->cqm_rssi_thold;
3413 int hyst = bss_conf->cqm_rssi_hyst; 3404 int hyst = bss_conf->cqm_rssi_hyst;
3405
3414 if (sig < thold && 3406 if (sig < thold &&
3415 (last_event == 0 || sig < last_event - hyst)) { 3407 (last_event == 0 || sig < last_event - hyst)) {
3416 ifmgd->last_cqm_event_signal = sig; 3408 ifmgd->last_cqm_event_signal = sig;