mvebu: espressobin: drop COMPHY removement patch
[openwrt/staging/wigyori.git] / package / kernel / mac80211 / patches / subsys / 334-mac80211-minstrel-remove-deferred-sampling-code.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Wed, 11 Nov 2020 19:17:44 +0100
3 Subject: [PATCH] mac80211: minstrel: remove deferred sampling code
4
5 Deferring sampling attempts to the second stage has some bad interactions
6 with drivers that process the rate table in hardware and use the probe flag
7 to indicate probing packets (e.g. most mt76 drivers). On affected drivers
8 it can lead to probing not working at all.
9
10 If the link conditions turn worse, it might not be such a good idea to
11 do a lot of sampling for lower rates in this case.
12
13 Fix this by simply skipping the sample attempt instead of deferring it,
14 but keep the checks that would allow it to be sampled if it was skipped
15 too often, but only if it has less than 95% success probability.
16
17 Also ensure that IEEE80211_TX_CTL_RATE_CTRL_PROBE is set for all probing
18 packets.
19
20 Cc: stable@vger.kernel.org
21 Fixes: cccf129f820e ("mac80211: add the 'minstrel' rate control algorithm")
22 Signed-off-by: Felix Fietkau <nbd@nbd.name>
23 ---
24
25 --- a/net/mac80211/rc80211_minstrel.c
26 +++ b/net/mac80211/rc80211_minstrel.c
27 @@ -287,12 +287,6 @@ minstrel_tx_status(void *priv, struct ie
28 mi->r[ndx].stats.success += success;
29 }
30
31 - if ((info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) && (i >= 0))
32 - mi->sample_packets++;
33 -
34 - if (mi->sample_deferred > 0)
35 - mi->sample_deferred--;
36 -
37 if (time_after(jiffies, mi->last_stats_update +
38 mp->update_interval / (mp->new_avg ? 2 : 1)))
39 minstrel_update_stats(mp, mi);
40 @@ -367,7 +361,7 @@ minstrel_get_rate(void *priv, struct iee
41 return;
42
43 delta = (mi->total_packets * sampling_ratio / 100) -
44 - (mi->sample_packets + mi->sample_deferred / 2);
45 + mi->sample_packets;
46
47 /* delta < 0: no sampling required */
48 prev_sample = mi->prev_sample;
49 @@ -376,7 +370,6 @@ minstrel_get_rate(void *priv, struct iee
50 return;
51
52 if (mi->total_packets >= 10000) {
53 - mi->sample_deferred = 0;
54 mi->sample_packets = 0;
55 mi->total_packets = 0;
56 } else if (delta > mi->n_rates * 2) {
57 @@ -401,19 +394,8 @@ minstrel_get_rate(void *priv, struct iee
58 * rate sampling method should be used.
59 * Respect such rates that are not sampled for 20 interations.
60 */
61 - if (mrr_capable &&
62 - msr->perfect_tx_time > mr->perfect_tx_time &&
63 - msr->stats.sample_skipped < 20) {
64 - /* Only use IEEE80211_TX_CTL_RATE_CTRL_PROBE to mark
65 - * packets that have the sampling rate deferred to the
66 - * second MRR stage. Increase the sample counter only
67 - * if the deferred sample rate was actually used.
68 - * Use the sample_deferred counter to make sure that
69 - * the sampling is not done in large bursts */
70 - info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
71 - rate++;
72 - mi->sample_deferred++;
73 - } else {
74 + if (msr->perfect_tx_time < mr->perfect_tx_time ||
75 + msr->stats.sample_skipped >= 20) {
76 if (!msr->sample_limit)
77 return;
78
79 @@ -433,6 +415,7 @@ minstrel_get_rate(void *priv, struct iee
80
81 rate->idx = mi->r[ndx].rix;
82 rate->count = minstrel_get_retry_count(&mi->r[ndx], info);
83 + info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
84 }
85
86
87 --- a/net/mac80211/rc80211_minstrel.h
88 +++ b/net/mac80211/rc80211_minstrel.h
89 @@ -126,7 +126,6 @@ struct minstrel_sta_info {
90 u8 max_prob_rate;
91 unsigned int total_packets;
92 unsigned int sample_packets;
93 - int sample_deferred;
94
95 unsigned int sample_row;
96 unsigned int sample_column;