aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-08-27 15:22:00 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-08-31 14:20:40 -0400
commit391a200a89bf85bd38f117f34898c24299e3d53d (patch)
tree9f85575e7d48ed7fb6907816f1c148002796c8d1
parent3ba06c6fbd651ed3377e584026d1c112b492cc8b (diff)
mac80211: Do not generate CQM events based on first Beacon frames
The signal strength value in a single RX frame is not that reliable, so it is better to delay start of CQM events until there is a real average signal strength from more than a single Beacon frame available. Signed-off-by: Jouni Malinen <j@w1.fi> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--net/mac80211/ieee80211_i.h7
-rw-r--r--net/mac80211/mlme.c9
2 files changed, 16 insertions, 0 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 9af50fbcd48b..16f7fb164c2d 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -369,6 +369,13 @@ struct ieee80211_if_managed {
369 int ave_beacon_signal; 369 int ave_beacon_signal;
370 370
371 /* 371 /*
372 * Number of Beacon frames used in ave_beacon_signal. This can be used
373 * to avoid generating less reliable cqm events that would be based
374 * only on couple of received frames.
375 */
376 unsigned int count_beacon_signal;
377
378 /*
372 * Last Beacon frame signal strength average (ave_beacon_signal / 16) 379 * Last Beacon frame signal strength average (ave_beacon_signal / 16)
373 * that triggered a cqm event. 0 indicates that no event has been 380 * that triggered a cqm event. 0 indicates that no event has been
374 * generated for the current association. 381 * generated for the current association.
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 7915726d791e..0cb822cc12e9 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -54,6 +54,12 @@
54 */ 54 */
55#define IEEE80211_SIGNAL_AVE_WEIGHT 3 55#define IEEE80211_SIGNAL_AVE_WEIGHT 3
56 56
57/*
58 * How many Beacon frames need to have been used in average signal strength
59 * before starting to indicate signal change events.
60 */
61#define IEEE80211_SIGNAL_AVE_MIN_COUNT 4
62
57#define TMR_RUNNING_TIMER 0 63#define TMR_RUNNING_TIMER 0
58#define TMR_RUNNING_CHANSW 1 64#define TMR_RUNNING_CHANSW 1
59 65
@@ -1555,13 +1561,16 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
1555 ifmgd->flags &= ~IEEE80211_STA_RESET_SIGNAL_AVE; 1561 ifmgd->flags &= ~IEEE80211_STA_RESET_SIGNAL_AVE;
1556 ifmgd->ave_beacon_signal = rx_status->signal * 16; 1562 ifmgd->ave_beacon_signal = rx_status->signal * 16;
1557 ifmgd->last_cqm_event_signal = 0; 1563 ifmgd->last_cqm_event_signal = 0;
1564 ifmgd->count_beacon_signal = 1;
1558 } else { 1565 } else {
1559 ifmgd->ave_beacon_signal = 1566 ifmgd->ave_beacon_signal =
1560 (IEEE80211_SIGNAL_AVE_WEIGHT * rx_status->signal * 16 + 1567 (IEEE80211_SIGNAL_AVE_WEIGHT * rx_status->signal * 16 +
1561 (16 - IEEE80211_SIGNAL_AVE_WEIGHT) * 1568 (16 - IEEE80211_SIGNAL_AVE_WEIGHT) *
1562 ifmgd->ave_beacon_signal) / 16; 1569 ifmgd->ave_beacon_signal) / 16;
1570 ifmgd->count_beacon_signal++;
1563 } 1571 }
1564 if (bss_conf->cqm_rssi_thold && 1572 if (bss_conf->cqm_rssi_thold &&
1573 ifmgd->count_beacon_signal >= IEEE80211_SIGNAL_AVE_MIN_COUNT &&
1565 !(local->hw.flags & IEEE80211_HW_SUPPORTS_CQM_RSSI)) { 1574 !(local->hw.flags & IEEE80211_HW_SUPPORTS_CQM_RSSI)) {
1566 int sig = ifmgd->ave_beacon_signal / 16; 1575 int sig = ifmgd->ave_beacon_signal / 16;
1567 int last_event = ifmgd->last_cqm_event_signal; 1576 int last_event = ifmgd->last_cqm_event_signal;