mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 01:21:58 +00:00
mac80211: reduce calculation costs of EWMA
This patch reduces the calculation costs of the EWMA macro from "2x multiplication and 1 addition" down to "1x multiplication and 2x additions". This slightly improves performance depending on the CPU architecture. Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de> Acked-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
50e55a8ea7
commit
ade6d4a2ec
1 changed files with 6 additions and 1 deletions
|
@ -27,7 +27,12 @@
|
||||||
static inline int
|
static inline int
|
||||||
minstrel_ewma(int old, int new, int weight)
|
minstrel_ewma(int old, int new, int weight)
|
||||||
{
|
{
|
||||||
return (new * (EWMA_DIV - weight) + old * weight) / EWMA_DIV;
|
int diff, incr;
|
||||||
|
|
||||||
|
diff = new - old;
|
||||||
|
incr = (EWMA_DIV - weight) * diff / EWMA_DIV;
|
||||||
|
|
||||||
|
return old + incr;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct minstrel_rate_stats {
|
struct minstrel_rate_stats {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue