]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/mac80211/rc80211_minstrel.h
mac80211: add documentation and verbose variable names in
[karo-tx-linux.git] / net / mac80211 / rc80211_minstrel.h
index 5ecf757817f289f76eee112093fae345c7f4cc0f..5fb5cb81d0dabc2bb7cfb7c4dcd247e70b9e80cc 100644 (file)
@@ -9,6 +9,23 @@
 #ifndef __RC_MINSTREL_H
 #define __RC_MINSTREL_H
 
+#define EWMA_LEVEL 75  /* ewma weighting factor [%] */
+
+/* scaled fraction values */
+#define MINSTREL_SCALE  16
+#define MINSTREL_FRAC(val, div) (((val) << MINSTREL_SCALE) / div)
+#define MINSTREL_TRUNC(val) ((val) >> MINSTREL_SCALE)
+
+/*
+ * 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;
@@ -52,7 +69,7 @@ struct minstrel_sta_info {
        unsigned int sample_count;
        int sample_deferred;
 
-       unsigned int sample_idx;
+       unsigned int sample_row;
        unsigned int sample_column;
 
        int n_rates;
@@ -73,7 +90,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;