91fb92f1b2b75ef76261888bbae3908151cd0968
[openwrt/staging/stintel.git] /
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Sat, 28 Sep 2019 15:44:06 +0200
3 Subject: [PATCH] mac80211: minstrel: remove divisions in tx status path
4
5 Use a slightly different threshold for downgrading spatial streams to
6 make it easier to calculate without divisions.
7 Slightly reduces CPU overhead.
8
9 Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 ---
11
12 --- a/net/mac80211/rc80211_minstrel.c
13 +++ b/net/mac80211/rc80211_minstrel.c
14 @@ -289,8 +289,7 @@ minstrel_tx_status(void *priv, struct ie
15 if (mi->sample_deferred > 0)
16 mi->sample_deferred--;
17
18 - if (time_after(jiffies, mi->last_stats_update +
19 - (mp->update_interval * HZ) / 1000))
20 + if (time_after(jiffies, mi->last_stats_update + mp->update_interval))
21 minstrel_update_stats(mp, mi);
22 }
23
24 --- a/net/mac80211/rc80211_minstrel_ht.c
25 +++ b/net/mac80211/rc80211_minstrel_ht.c
26 @@ -970,23 +970,21 @@ minstrel_ht_tx_status(void *priv, struct
27 */
28 rate = minstrel_get_ratestats(mi, mi->max_tp_rate[0]);
29 if (rate->attempts > 30 &&
30 - MINSTREL_FRAC(rate->success, rate->attempts) <
31 - MINSTREL_FRAC(20, 100)) {
32 + rate->success < rate->attempts / 4) {
33 minstrel_downgrade_rate(mi, &mi->max_tp_rate[0], true);
34 update = true;
35 }
36
37 rate2 = minstrel_get_ratestats(mi, mi->max_tp_rate[1]);
38 if (rate2->attempts > 30 &&
39 - MINSTREL_FRAC(rate2->success, rate2->attempts) <
40 - MINSTREL_FRAC(20, 100)) {
41 + rate2->success < rate2->attempts / 4) {
42 minstrel_downgrade_rate(mi, &mi->max_tp_rate[1], false);
43 update = true;
44 }
45 }
46
47 if (time_after(jiffies, mi->last_stats_update +
48 - (mp->update_interval / 2 * HZ) / 1000)) {
49 + mp->update_interval / 2)) {
50 update = true;
51 minstrel_ht_update_stats(mp, mi, true);
52 }
53 @@ -1666,7 +1664,7 @@ minstrel_ht_alloc(struct ieee80211_hw *h
54 mp->has_mrr = true;
55
56 mp->hw = hw;
57 - mp->update_interval = 100;
58 + mp->update_interval = HZ / 10;
59
60 minstrel_ht_init_cck_rates(mp);
61