aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKarl Beldan <karl.beldan@rivierawaves.com>2013-04-17 07:43:22 -0400
committerJohannes Berg <johannes.berg@intel.com>2013-04-17 11:08:49 -0400
commiteea85999eca4d7f3528010cd8277392cd56ba713 (patch)
treeca7ab112a1767ce31a3d6ea5ac9e7c82a4db9343 /net
parente1c3b15dd33a7d990188fa5b4731c78f8ba416a4 (diff)
mac80211: optimize minstrel_ewma
Use powers of two in ewma of minstrel. This changes : - EWMA_DIV from 100 to 2^7 - EWMA_LEVEL from 75 (/EWMA_DIV=100) to 2^6 + 2^5 (/EWMA_DIV=128) Note that this changes EWMA_DIV - EWMA_LEVEL from 25 to 2^5 and keeps EWMA_LEVEL / EWMA_DIV == 0.75. Signed-off-by: Karl Beldan <karl.beldan@rivierawaves.com> Acked-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/rc80211_minstrel.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/mac80211/rc80211_minstrel.h b/net/mac80211/rc80211_minstrel.h
index 85ebf42cb46d..b9f8535fa15c 100644
--- a/net/mac80211/rc80211_minstrel.h
+++ b/net/mac80211/rc80211_minstrel.h
@@ -9,7 +9,8 @@
9#ifndef __RC_MINSTREL_H 9#ifndef __RC_MINSTREL_H
10#define __RC_MINSTREL_H 10#define __RC_MINSTREL_H
11 11
12#define EWMA_LEVEL 75 /* ewma weighting factor [%] */ 12#define EWMA_LEVEL 96 /* ewma weighting factor [/EWMA_DIV] */
13#define EWMA_DIV 128
13#define SAMPLE_COLUMNS 10 /* number of columns in sample table */ 14#define SAMPLE_COLUMNS 10 /* number of columns in sample table */
14 15
15 16
@@ -27,7 +28,7 @@
27static inline int 28static inline int
28minstrel_ewma(int old, int new, int weight) 29minstrel_ewma(int old, int new, int weight)
29{ 30{
30 return (new * (100 - weight) + old * weight) / 100; 31 return (new * (EWMA_DIV - weight) + old * weight) / EWMA_DIV;
31} 32}
32 33
33 34