diff options
author | Bruno Randolf <br1@einfach.org> | 2010-03-25 01:49:25 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-03-31 14:39:09 -0400 |
commit | b4ea449df90684035985a77763fd1d2ff0eb9dad (patch) | |
tree | 4b156d174efda2a11ca7fba59a59617ab3b7de14 /drivers/net/wireless/ath/ath5k/base.c | |
parent | 6a8a3f6b2ac02fb8542f2b36b0ecd9c48f7d9a7e (diff) |
ath5k: keep beacon RSSI average
Keep an exponentially weighted moving average of the beacon RSSI in our BSS.
It will be used by the ANI implementation.
The averaging algorithm is copied from rt2x00, Thanks :)
Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/base.c')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/base.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index f60d84f9c55f..ba2fad23a7a5 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -1803,6 +1803,25 @@ ath5k_check_ibss_tsf(struct ath5k_softc *sc, struct sk_buff *skb, | |||
1803 | } | 1803 | } |
1804 | } | 1804 | } |
1805 | 1805 | ||
1806 | static void | ||
1807 | ath5k_update_beacon_rssi(struct ath5k_softc *sc, struct sk_buff *skb, int rssi) | ||
1808 | { | ||
1809 | struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)skb->data; | ||
1810 | struct ath5k_hw *ah = sc->ah; | ||
1811 | struct ath_common *common = ath5k_hw_common(ah); | ||
1812 | |||
1813 | /* only beacons from our BSSID */ | ||
1814 | if (!ieee80211_is_beacon(mgmt->frame_control) || | ||
1815 | memcmp(mgmt->bssid, common->curbssid, ETH_ALEN) != 0) | ||
1816 | return; | ||
1817 | |||
1818 | ah->ah_beacon_rssi_avg = ath5k_moving_average(ah->ah_beacon_rssi_avg, | ||
1819 | rssi); | ||
1820 | |||
1821 | /* in IBSS mode we should keep RSSI statistics per neighbour */ | ||
1822 | /* le16_to_cpu(mgmt->u.beacon.capab_info) & WLAN_CAPABILITY_IBSS */ | ||
1823 | } | ||
1824 | |||
1806 | /* | 1825 | /* |
1807 | * Compute padding position. skb must contains an IEEE 802.11 frame | 1826 | * Compute padding position. skb must contains an IEEE 802.11 frame |
1808 | */ | 1827 | */ |
@@ -2022,6 +2041,8 @@ accept: | |||
2022 | 2041 | ||
2023 | ath5k_debug_dump_skb(sc, skb, "RX ", 0); | 2042 | ath5k_debug_dump_skb(sc, skb, "RX ", 0); |
2024 | 2043 | ||
2044 | ath5k_update_beacon_rssi(sc, skb, rs.rs_rssi); | ||
2045 | |||
2025 | /* check beacons in IBSS mode */ | 2046 | /* check beacons in IBSS mode */ |
2026 | if (sc->opmode == NL80211_IFTYPE_ADHOC) | 2047 | if (sc->opmode == NL80211_IFTYPE_ADHOC) |
2027 | ath5k_check_ibss_tsf(sc, skb, rxs); | 2048 | ath5k_check_ibss_tsf(sc, skb, rxs); |