diff options
-rw-r--r-- | include/linux/nl80211.h | 2 | ||||
-rw-r--r-- | include/net/cfg80211.h | 4 | ||||
-rw-r--r-- | net/mac80211/Kconfig | 1 | ||||
-rw-r--r-- | net/mac80211/cfg.c | 3 | ||||
-rw-r--r-- | net/mac80211/rx.c | 1 | ||||
-rw-r--r-- | net/mac80211/sta_info.c | 2 | ||||
-rw-r--r-- | net/mac80211/sta_info.h | 3 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 3 |
8 files changed, 18 insertions, 1 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 410a06ea551b..8e28053ea423 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -1191,6 +1191,7 @@ enum nl80211_rate_info { | |||
1191 | * station) | 1191 | * station) |
1192 | * @NL80211_STA_INFO_TX_RETRIES: total retries (u32, to this station) | 1192 | * @NL80211_STA_INFO_TX_RETRIES: total retries (u32, to this station) |
1193 | * @NL80211_STA_INFO_TX_FAILED: total failed packets (u32, to this station) | 1193 | * @NL80211_STA_INFO_TX_FAILED: total failed packets (u32, to this station) |
1194 | * @NL80211_STA_INFO_SIGNAL_AVG: signal strength average (u8, dBm) | ||
1194 | */ | 1195 | */ |
1195 | enum nl80211_sta_info { | 1196 | enum nl80211_sta_info { |
1196 | __NL80211_STA_INFO_INVALID, | 1197 | __NL80211_STA_INFO_INVALID, |
@@ -1206,6 +1207,7 @@ enum nl80211_sta_info { | |||
1206 | NL80211_STA_INFO_TX_PACKETS, | 1207 | NL80211_STA_INFO_TX_PACKETS, |
1207 | NL80211_STA_INFO_TX_RETRIES, | 1208 | NL80211_STA_INFO_TX_RETRIES, |
1208 | NL80211_STA_INFO_TX_FAILED, | 1209 | NL80211_STA_INFO_TX_FAILED, |
1210 | NL80211_STA_INFO_SIGNAL_AVG, | ||
1209 | 1211 | ||
1210 | /* keep last */ | 1212 | /* keep last */ |
1211 | __NL80211_STA_INFO_AFTER_LAST, | 1213 | __NL80211_STA_INFO_AFTER_LAST, |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 788c3989a9e8..8764c9a5bab7 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -420,6 +420,7 @@ struct station_parameters { | |||
420 | * @STATION_INFO_TX_RETRIES: @tx_retries filled | 420 | * @STATION_INFO_TX_RETRIES: @tx_retries filled |
421 | * @STATION_INFO_TX_FAILED: @tx_failed filled | 421 | * @STATION_INFO_TX_FAILED: @tx_failed filled |
422 | * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled | 422 | * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled |
423 | * @STATION_INFO_SIGNAL_AVG: @signal_avg filled | ||
423 | */ | 424 | */ |
424 | enum station_info_flags { | 425 | enum station_info_flags { |
425 | STATION_INFO_INACTIVE_TIME = 1<<0, | 426 | STATION_INFO_INACTIVE_TIME = 1<<0, |
@@ -435,6 +436,7 @@ enum station_info_flags { | |||
435 | STATION_INFO_TX_RETRIES = 1<<10, | 436 | STATION_INFO_TX_RETRIES = 1<<10, |
436 | STATION_INFO_TX_FAILED = 1<<11, | 437 | STATION_INFO_TX_FAILED = 1<<11, |
437 | STATION_INFO_RX_DROP_MISC = 1<<12, | 438 | STATION_INFO_RX_DROP_MISC = 1<<12, |
439 | STATION_INFO_SIGNAL_AVG = 1<<13, | ||
438 | }; | 440 | }; |
439 | 441 | ||
440 | /** | 442 | /** |
@@ -481,6 +483,7 @@ struct rate_info { | |||
481 | * @plid: mesh peer link id | 483 | * @plid: mesh peer link id |
482 | * @plink_state: mesh peer link state | 484 | * @plink_state: mesh peer link state |
483 | * @signal: signal strength of last received packet in dBm | 485 | * @signal: signal strength of last received packet in dBm |
486 | * @signal_avg: signal strength average in dBm | ||
484 | * @txrate: current unicast bitrate to this station | 487 | * @txrate: current unicast bitrate to this station |
485 | * @rx_packets: packets received from this station | 488 | * @rx_packets: packets received from this station |
486 | * @tx_packets: packets transmitted to this station | 489 | * @tx_packets: packets transmitted to this station |
@@ -501,6 +504,7 @@ struct station_info { | |||
501 | u16 plid; | 504 | u16 plid; |
502 | u8 plink_state; | 505 | u8 plink_state; |
503 | s8 signal; | 506 | s8 signal; |
507 | s8 signal_avg; | ||
504 | struct rate_info txrate; | 508 | struct rate_info txrate; |
505 | u32 rx_packets; | 509 | u32 rx_packets; |
506 | u32 tx_packets; | 510 | u32 tx_packets; |
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig index 4d6f8653ec88..798d9b9462e2 100644 --- a/net/mac80211/Kconfig +++ b/net/mac80211/Kconfig | |||
@@ -6,6 +6,7 @@ config MAC80211 | |||
6 | select CRYPTO_ARC4 | 6 | select CRYPTO_ARC4 |
7 | select CRYPTO_AES | 7 | select CRYPTO_AES |
8 | select CRC32 | 8 | select CRC32 |
9 | select AVERAGE | ||
9 | ---help--- | 10 | ---help--- |
10 | This option enables the hardware independent IEEE 802.11 | 11 | This option enables the hardware independent IEEE 802.11 |
11 | networking stack. | 12 | networking stack. |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 68329d713c02..af9620406321 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -342,8 +342,9 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) | |||
342 | 342 | ||
343 | if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) || | 343 | if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) || |
344 | (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) { | 344 | (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) { |
345 | sinfo->filled |= STATION_INFO_SIGNAL; | 345 | sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG; |
346 | sinfo->signal = (s8)sta->last_signal; | 346 | sinfo->signal = (s8)sta->last_signal; |
347 | sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal); | ||
347 | } | 348 | } |
348 | 349 | ||
349 | sinfo->txrate.flags = 0; | 350 | sinfo->txrate.flags = 0; |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 6289525c0998..2fe8f5f86499 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -1163,6 +1163,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) | |||
1163 | sta->rx_fragments++; | 1163 | sta->rx_fragments++; |
1164 | sta->rx_bytes += rx->skb->len; | 1164 | sta->rx_bytes += rx->skb->len; |
1165 | sta->last_signal = status->signal; | 1165 | sta->last_signal = status->signal; |
1166 | ewma_add(&sta->avg_signal, -status->signal); | ||
1166 | 1167 | ||
1167 | /* | 1168 | /* |
1168 | * Change STA power saving mode only at the end of a frame | 1169 | * Change STA power saving mode only at the end of a frame |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index eff58571fd7e..c426504ed1cf 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -244,6 +244,8 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, | |||
244 | sta->local = local; | 244 | sta->local = local; |
245 | sta->sdata = sdata; | 245 | sta->sdata = sdata; |
246 | 246 | ||
247 | ewma_init(&sta->avg_signal, 1024, 8); | ||
248 | |||
247 | if (sta_prepare_rate_control(local, sta, gfp)) { | 249 | if (sta_prepare_rate_control(local, sta, gfp)) { |
248 | kfree(sta); | 250 | kfree(sta); |
249 | return NULL; | 251 | return NULL; |
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index 05f11302443b..fdca52cf88de 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/types.h> | 13 | #include <linux/types.h> |
14 | #include <linux/if_ether.h> | 14 | #include <linux/if_ether.h> |
15 | #include <linux/workqueue.h> | 15 | #include <linux/workqueue.h> |
16 | #include <linux/average.h> | ||
16 | #include "key.h" | 17 | #include "key.h" |
17 | 18 | ||
18 | /** | 19 | /** |
@@ -223,6 +224,7 @@ enum plink_state { | |||
223 | * @rx_fragments: number of received MPDUs | 224 | * @rx_fragments: number of received MPDUs |
224 | * @rx_dropped: number of dropped MPDUs from this STA | 225 | * @rx_dropped: number of dropped MPDUs from this STA |
225 | * @last_signal: signal of last received frame from this STA | 226 | * @last_signal: signal of last received frame from this STA |
227 | * @avg_signal: moving average of signal of received frames from this STA | ||
226 | * @last_seq_ctrl: last received seq/frag number from this STA (per RX queue) | 228 | * @last_seq_ctrl: last received seq/frag number from this STA (per RX queue) |
227 | * @tx_filtered_count: number of frames the hardware filtered for this STA | 229 | * @tx_filtered_count: number of frames the hardware filtered for this STA |
228 | * @tx_retry_failed: number of frames that failed retry | 230 | * @tx_retry_failed: number of frames that failed retry |
@@ -291,6 +293,7 @@ struct sta_info { | |||
291 | unsigned long rx_fragments; | 293 | unsigned long rx_fragments; |
292 | unsigned long rx_dropped; | 294 | unsigned long rx_dropped; |
293 | int last_signal; | 295 | int last_signal; |
296 | struct ewma avg_signal; | ||
294 | __le16 last_seq_ctrl[NUM_RX_DATA_QUEUES]; | 297 | __le16 last_seq_ctrl[NUM_RX_DATA_QUEUES]; |
295 | 298 | ||
296 | /* Updated from TX status path only, no locking requirements */ | 299 | /* Updated from TX status path only, no locking requirements */ |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 56508d40c740..2cf03331d4a2 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -1896,6 +1896,9 @@ static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq, | |||
1896 | if (sinfo->filled & STATION_INFO_SIGNAL) | 1896 | if (sinfo->filled & STATION_INFO_SIGNAL) |
1897 | NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL, | 1897 | NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL, |
1898 | sinfo->signal); | 1898 | sinfo->signal); |
1899 | if (sinfo->filled & STATION_INFO_SIGNAL_AVG) | ||
1900 | NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL_AVG, | ||
1901 | sinfo->signal_avg); | ||
1899 | if (sinfo->filled & STATION_INFO_TX_BITRATE) { | 1902 | if (sinfo->filled & STATION_INFO_TX_BITRATE) { |
1900 | txrate = nla_nest_start(msg, NL80211_STA_INFO_TX_BITRATE); | 1903 | txrate = nla_nest_start(msg, NL80211_STA_INFO_TX_BITRATE); |
1901 | if (!txrate) | 1904 | if (!txrate) |