9b6a614aa8316c20141de0b8e0ee0762f6fcd34c
[openwrt/staging/robimarko.git] /
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Sat, 26 Dec 2020 14:34:30 +0100
3 Subject: [PATCH] mac80211: minstrel_ht: remove old ewma based rate average
4 code
5
6 The new noise filter has been the default for a while now with no reported
7 downside and significant improvement compared to the old code.
8
9 Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 ---
11
12 --- a/net/mac80211/rc80211_minstrel_ht.c
13 +++ b/net/mac80211/rc80211_minstrel_ht.c
14 @@ -769,17 +769,8 @@ minstrel_ht_calc_rate_stats(struct minst
15 if (unlikely(mrs->attempts > 0)) {
16 mrs->sample_skipped = 0;
17 cur_prob = MINSTREL_FRAC(mrs->success, mrs->attempts);
18 - if (mp->new_avg) {
19 - minstrel_filter_avg_add(&mrs->prob_avg,
20 - &mrs->prob_avg_1, cur_prob);
21 - } else if (unlikely(!mrs->att_hist)) {
22 - mrs->prob_avg = cur_prob;
23 - } else {
24 - /*update exponential weighted moving avarage */
25 - mrs->prob_avg = minstrel_ewma(mrs->prob_avg,
26 - cur_prob,
27 - EWMA_LEVEL);
28 - }
29 + minstrel_filter_avg_add(&mrs->prob_avg,
30 + &mrs->prob_avg_1, cur_prob);
31 mrs->att_hist += mrs->attempts;
32 mrs->succ_hist += mrs->success;
33 } else {
34 @@ -913,10 +904,8 @@ minstrel_ht_update_stats(struct minstrel
35 /* Try to increase robustness of max_prob_rate*/
36 minstrel_ht_prob_rate_reduce_streams(mi);
37
38 - /* try to sample all available rates during each interval */
39 - mi->sample_count *= 8;
40 - if (mp->new_avg)
41 - mi->sample_count /= 2;
42 + /* try to sample half of all available rates during each interval */
43 + mi->sample_count *= 4;
44
45 if (sample)
46 minstrel_ht_rate_sample_switch(mp, mi);
47 @@ -1040,7 +1029,7 @@ minstrel_ht_tx_status(void *priv, struct
48 struct ieee80211_tx_rate *ar = info->status.rates;
49 struct minstrel_rate_stats *rate, *rate2, *rate_sample = NULL;
50 struct minstrel_priv *mp = priv;
51 - u32 update_interval = mp->update_interval / 2;
52 + u32 update_interval = mp->update_interval;
53 bool last, update = false;
54 bool sample_status = false;
55 int i;
56 @@ -1090,9 +1079,8 @@ minstrel_ht_tx_status(void *priv, struct
57
58 switch (mi->sample_mode) {
59 case MINSTREL_SAMPLE_IDLE:
60 - if (mp->new_avg &&
61 - (mp->hw->max_rates > 1 ||
62 - mi->total_packets_cur < SAMPLE_SWITCH_THR))
63 + if (mp->hw->max_rates > 1 ||
64 + mi->total_packets_cur < SAMPLE_SWITCH_THR)
65 update_interval /= 2;
66 break;
67
68 @@ -1832,8 +1820,7 @@ minstrel_ht_alloc(struct ieee80211_hw *h
69 mp->has_mrr = true;
70
71 mp->hw = hw;
72 - mp->update_interval = HZ / 10;
73 - mp->new_avg = true;
74 + mp->update_interval = HZ / 20;
75
76 minstrel_ht_init_cck_rates(mp);
77 for (i = 0; i < ARRAY_SIZE(mp->hw->wiphy->bands); i++)
78 @@ -1853,8 +1840,6 @@ static void minstrel_ht_add_debugfs(stru
79 &mp->fixed_rate_idx);
80 debugfs_create_u32("sample_switch", S_IRUGO | S_IWUSR, debugfsdir,
81 &mp->sample_switch);
82 - debugfs_create_bool("new_avg", S_IRUGO | S_IWUSR, debugfsdir,
83 - &mp->new_avg);
84 }
85 #endif
86
87 --- a/net/mac80211/rc80211_minstrel_ht.h
88 +++ b/net/mac80211/rc80211_minstrel_ht.h
89 @@ -60,7 +60,6 @@
90 struct minstrel_priv {
91 struct ieee80211_hw *hw;
92 bool has_mrr;
93 - bool new_avg;
94 u32 sample_switch;
95 unsigned int cw_min;
96 unsigned int cw_max;