Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[firefly-linux-kernel-4.4.55.git] / net / mac80211 / rc80211_minstrel.h
index 5ecf757817f289f76eee112093fae345c7f4cc0f..85ebf42cb46de4e11a032a496025c9f0ea7be375 100644 (file)
@@ -9,6 +9,28 @@
 #ifndef __RC_MINSTREL_H
 #define __RC_MINSTREL_H
 
+#define EWMA_LEVEL     75      /* ewma weighting factor [%] */
+#define SAMPLE_COLUMNS 10      /* number of columns in sample table */
+
+
+/* scaled fraction values */
+#define MINSTREL_SCALE  16
+#define MINSTREL_FRAC(val, div) (((val) << MINSTREL_SCALE) / div)
+#define MINSTREL_TRUNC(val) ((val) >> MINSTREL_SCALE)
+
+/* number of highest throughput rates to consider*/
+#define MAX_THR_RATES 4
+
+/*
+ * 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;
@@ -26,6 +48,7 @@ struct minstrel_rate {
        u32 attempts;
        u32 last_attempts;
        u32 last_success;
+       u8 sample_skipped;
 
        /* parts per thousand */
        u32 cur_prob;
@@ -45,14 +68,13 @@ struct minstrel_sta_info {
 
        unsigned int lowest_rix;
 
-       unsigned int max_tp_rate;
-       unsigned int max_tp_rate2;
-       unsigned int max_prob_rate;
+       u8 max_tp_rate[MAX_THR_RATES];
+       u8 max_prob_rate;
        unsigned int packet_count;
        unsigned int sample_count;
        int sample_deferred;
 
-       unsigned int sample_idx;
+       unsigned int sample_row;
        unsigned int sample_column;
 
        int n_rates;
@@ -73,7 +95,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;