diff options
author | Thomas Huehn <thomas@net.t-labs.tu-berlin.de> | 2013-03-04 22:30:01 (GMT) |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-03-06 15:36:06 (GMT) |
commit | a512d4b543ea20ec84f712f90a5229ab88a9709c (patch) | |
tree | d3c3f6354f371fff701a4b365964b155873ee544 /net/mac80211/rc80211_minstrel.h | |
parent | 52c00a37a323ded691b23538ef1181155f51aef3 (diff) | |
download | linux-fsl-qoriq-a512d4b543ea20ec84f712f90a5229ab88a9709c.tar.xz |
mac80211: merge EWMA calculation of minstrel_ht and minstrel
Both rate control algorithms (minstrel and minstrel_ht) calculate
averages based on EWMA. Shift function minstrel_ewma() into
rc80211_minstrel.h and make use of it in both minstrel version.
Also shift the default EWMA level (75%) definition to the header file
and clean up variable usage.
Acked-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/rc80211_minstrel.h')
-rw-r--r-- | net/mac80211/rc80211_minstrel.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/net/mac80211/rc80211_minstrel.h b/net/mac80211/rc80211_minstrel.h index 5ecf757..98db93f 100644 --- a/net/mac80211/rc80211_minstrel.h +++ b/net/mac80211/rc80211_minstrel.h @@ -9,6 +9,18 @@ #ifndef __RC_MINSTREL_H #define __RC_MINSTREL_H +#define EWMA_LEVEL 75 /* ewma weighting factor [%] */ + +/* + * Perform EWMA (Exponentially Weighted Moving Average) calculation + */ +static inline int +minstrel_ewma(int old, int new, int weight) +{ + return (new * (100 - weight) + old * weight) / 100; +} + + struct minstrel_rate { int bitrate; int rix; @@ -73,7 +85,6 @@ struct minstrel_priv { unsigned int cw_min; unsigned int cw_max; unsigned int max_retry; - unsigned int ewma_level; unsigned int segment_size; unsigned int update_interval; unsigned int lookaround_rate; |