Skip to content

Commit

Permalink
mac80211: optimize minstrel_ewma
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Karl Beldan authored and Johannes Berg committed Apr 17, 2013
1 parent e1c3b15 commit eea8599
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/mac80211/rc80211_minstrel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */


Expand All @@ -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;
}


Expand Down

0 comments on commit eea8599

Please sign in to comment.