diff options
author | Johannes Berg <johannes.berg@intel.com> | 2015-07-13 06:26:46 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2015-08-14 11:49:53 -0400 |
commit | 40d9a38ad3b7029be9c278738b67cbdb6349ce85 (patch) | |
tree | e71dd40eb0afb147df45a91d36cb69faa3630880 /net/mac80211 | |
parent | 2377799c084d86d22074cd4acd20edc32024d669 (diff) |
mac80211: use DECLARE_EWMA
Instead of using the out-of-line average calculation, use the new
DECLARE_EWMA() macro to declare a signal EWMA, and use that.
This actually *reduces* the code size slightly (on x86-64) while
also reducing the station info size by 80 bytes.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/Kconfig | 1 | ||||
-rw-r--r-- | net/mac80211/mesh_plink.c | 2 | ||||
-rw-r--r-- | net/mac80211/rx.c | 4 | ||||
-rw-r--r-- | net/mac80211/sta_info.c | 9 | ||||
-rw-r--r-- | net/mac80211/sta_info.h | 6 |
5 files changed, 12 insertions, 10 deletions
diff --git a/net/mac80211/Kconfig b/net/mac80211/Kconfig index 086de496a4c1..3891cbd2adea 100644 --- a/net/mac80211/Kconfig +++ b/net/mac80211/Kconfig | |||
@@ -7,7 +7,6 @@ config MAC80211 | |||
7 | select CRYPTO_CCM | 7 | select CRYPTO_CCM |
8 | select CRYPTO_GCM | 8 | select CRYPTO_GCM |
9 | select CRC32 | 9 | select CRC32 |
10 | select AVERAGE | ||
11 | ---help--- | 10 | ---help--- |
12 | This option enables the hardware independent IEEE 802.11 | 11 | This option enables the hardware independent IEEE 802.11 |
13 | networking stack. | 12 | networking stack. |
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index e12be2e4e8df..58384642e03c 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c | |||
@@ -60,7 +60,7 @@ static bool rssi_threshold_check(struct ieee80211_sub_if_data *sdata, | |||
60 | { | 60 | { |
61 | s32 rssi_threshold = sdata->u.mesh.mshcfg.rssi_threshold; | 61 | s32 rssi_threshold = sdata->u.mesh.mshcfg.rssi_threshold; |
62 | return rssi_threshold == 0 || | 62 | return rssi_threshold == 0 || |
63 | (sta && (s8) -ewma_read(&sta->avg_signal) > rssi_threshold); | 63 | (sta && (s8) -ewma_signal_read(&sta->avg_signal) > rssi_threshold); |
64 | } | 64 | } |
65 | 65 | ||
66 | /** | 66 | /** |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 4d217d3265f4..5bc0b88d9eb1 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -1428,7 +1428,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) | |||
1428 | sta->rx_bytes += rx->skb->len; | 1428 | sta->rx_bytes += rx->skb->len; |
1429 | if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) { | 1429 | if (!(status->flag & RX_FLAG_NO_SIGNAL_VAL)) { |
1430 | sta->last_signal = status->signal; | 1430 | sta->last_signal = status->signal; |
1431 | ewma_add(&sta->avg_signal, -status->signal); | 1431 | ewma_signal_add(&sta->avg_signal, -status->signal); |
1432 | } | 1432 | } |
1433 | 1433 | ||
1434 | if (status->chains) { | 1434 | if (status->chains) { |
@@ -1440,7 +1440,7 @@ ieee80211_rx_h_sta_process(struct ieee80211_rx_data *rx) | |||
1440 | continue; | 1440 | continue; |
1441 | 1441 | ||
1442 | sta->chain_signal_last[i] = signal; | 1442 | sta->chain_signal_last[i] = signal; |
1443 | ewma_add(&sta->chain_signal_avg[i], -signal); | 1443 | ewma_signal_add(&sta->chain_signal_avg[i], -signal); |
1444 | } | 1444 | } |
1445 | } | 1445 | } |
1446 | 1446 | ||
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 70cd9fa57424..64f1936350c6 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -341,9 +341,9 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata, | |||
341 | 341 | ||
342 | ktime_get_ts(&uptime); | 342 | ktime_get_ts(&uptime); |
343 | sta->last_connected = uptime.tv_sec; | 343 | sta->last_connected = uptime.tv_sec; |
344 | ewma_init(&sta->avg_signal, 1024, 8); | 344 | ewma_signal_init(&sta->avg_signal); |
345 | for (i = 0; i < ARRAY_SIZE(sta->chain_signal_avg); i++) | 345 | for (i = 0; i < ARRAY_SIZE(sta->chain_signal_avg); i++) |
346 | ewma_init(&sta->chain_signal_avg[i], 1024, 8); | 346 | ewma_signal_init(&sta->chain_signal_avg[i]); |
347 | 347 | ||
348 | if (local->ops->wake_tx_queue) { | 348 | if (local->ops->wake_tx_queue) { |
349 | void *txq_data; | 349 | void *txq_data; |
@@ -1896,7 +1896,8 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) | |||
1896 | } | 1896 | } |
1897 | 1897 | ||
1898 | if (!(sinfo->filled & BIT(NL80211_STA_INFO_SIGNAL_AVG))) { | 1898 | if (!(sinfo->filled & BIT(NL80211_STA_INFO_SIGNAL_AVG))) { |
1899 | sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal); | 1899 | sinfo->signal_avg = |
1900 | (s8) -ewma_signal_read(&sta->avg_signal); | ||
1900 | sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL_AVG); | 1901 | sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL_AVG); |
1901 | } | 1902 | } |
1902 | } | 1903 | } |
@@ -1911,7 +1912,7 @@ void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) | |||
1911 | for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) { | 1912 | for (i = 0; i < ARRAY_SIZE(sinfo->chain_signal); i++) { |
1912 | sinfo->chain_signal[i] = sta->chain_signal_last[i]; | 1913 | sinfo->chain_signal[i] = sta->chain_signal_last[i]; |
1913 | sinfo->chain_signal_avg[i] = | 1914 | sinfo->chain_signal_avg[i] = |
1914 | (s8) -ewma_read(&sta->chain_signal_avg[i]); | 1915 | (s8) -ewma_signal_read(&sta->chain_signal_avg[i]); |
1915 | } | 1916 | } |
1916 | } | 1917 | } |
1917 | 1918 | ||
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index 1d2805c598c0..b087c71ff7fe 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
@@ -320,6 +320,8 @@ struct mesh_sta { | |||
320 | unsigned int fail_avg; | 320 | unsigned int fail_avg; |
321 | }; | 321 | }; |
322 | 322 | ||
323 | DECLARE_EWMA(signal, 1024, 8) | ||
324 | |||
323 | /** | 325 | /** |
324 | * struct sta_info - STA information | 326 | * struct sta_info - STA information |
325 | * | 327 | * |
@@ -462,12 +464,12 @@ struct sta_info { | |||
462 | unsigned long rx_fragments; | 464 | unsigned long rx_fragments; |
463 | unsigned long rx_dropped; | 465 | unsigned long rx_dropped; |
464 | int last_signal; | 466 | int last_signal; |
465 | struct ewma avg_signal; | 467 | struct ewma_signal avg_signal; |
466 | int last_ack_signal; | 468 | int last_ack_signal; |
467 | 469 | ||
468 | u8 chains; | 470 | u8 chains; |
469 | s8 chain_signal_last[IEEE80211_MAX_CHAINS]; | 471 | s8 chain_signal_last[IEEE80211_MAX_CHAINS]; |
470 | struct ewma chain_signal_avg[IEEE80211_MAX_CHAINS]; | 472 | struct ewma_signal chain_signal_avg[IEEE80211_MAX_CHAINS]; |
471 | 473 | ||
472 | /* Plus 1 for non-QoS frames */ | 474 | /* Plus 1 for non-QoS frames */ |
473 | __le16 last_seq_ctrl[IEEE80211_NUM_TIDS + 1]; | 475 | __le16 last_seq_ctrl[IEEE80211_NUM_TIDS + 1]; |