From eea85999eca4d7f3528010cd8277392cd56ba713 Mon Sep 17 00:00:00 2001 From: Karl Beldan Date: Wed, 17 Apr 2013 13:43:22 +0200 Subject: 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 Acked-by: Felix Fietkau Signed-off-by: Johannes Berg --- net/mac80211/rc80211_minstrel.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'net/mac80211') diff --git a/net/mac80211/rc80211_minstrel.h b/net/mac80211/rc80211_minstrel.h index 85ebf42cb46..b9f8535fa15 100644 --- a/net/mac80211/rc80211_minstrel.h +++ b/net/mac80211/rc80211_minstrel.h @@ -9,7 +9,8 @@ #ifndef __RC_MINSTREL_H #define __RC_MINSTREL_H -#define EWMA_LEVEL 75 /* ewma weighting factor [%] */ +#define EWMA_LEVEL 96 /* ewma weighting factor [/EWMA_DIV] */ +#define EWMA_DIV 128 #define SAMPLE_COLUMNS 10 /* number of columns in sample table */ @@ -27,7 +28,7 @@ static inline int minstrel_ewma(int old, int new, int weight) { - return (new * (100 - weight) + old * weight) / 100; + return (new * (EWMA_DIV - weight) + old * weight) / EWMA_DIV; } -- cgit v1.2.3