Skip to content

Commit 59e0f70

Browse files
nbd168ksacilotto
authored andcommitted
mac80211: minstrel: remove deferred sampling code
BugLink: https://bugs.launchpad.net/bugs/1908561 commit 4fe40b8 upstream. Deferring sampling attempts to the second stage has some bad interactions with drivers that process the rate table in hardware and use the probe flag to indicate probing packets (e.g. most mt76 drivers). On affected drivers it can lead to probing not working at all. If the link conditions turn worse, it might not be such a good idea to do a lot of sampling for lower rates in this case. Fix this by simply skipping the sample attempt instead of deferring it, but keep the checks that would allow it to be sampled if it was skipped too often, but only if it has less than 95% success probability. Also ensure that IEEE80211_TX_CTL_RATE_CTRL_PROBE is set for all probing packets. Cc: [email protected] Fixes: cccf129 ("mac80211: add the 'minstrel' rate control algorithm") Signed-off-by: Felix Fietkau <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Kamal Mostafa <[email protected]> Signed-off-by: Ian May <[email protected]>
1 parent dbb7d29 commit 59e0f70

File tree

2 files changed

+4
-22
lines changed

2 files changed

+4
-22
lines changed

net/mac80211/rc80211_minstrel.c

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,6 @@ minstrel_tx_status(void *priv, struct ieee80211_supported_band *sband,
283283
mi->r[ndx].stats.success += success;
284284
}
285285

286-
if ((info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) && (i >= 0))
287-
mi->sample_packets++;
288-
289-
if (mi->sample_deferred > 0)
290-
mi->sample_deferred--;
291-
292286
if (time_after(jiffies, mi->last_stats_update +
293287
(mp->update_interval * HZ) / 1000))
294288
minstrel_update_stats(mp, mi);
@@ -363,7 +357,7 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
363357
return;
364358

365359
delta = (mi->total_packets * sampling_ratio / 100) -
366-
(mi->sample_packets + mi->sample_deferred / 2);
360+
mi->sample_packets;
367361

368362
/* delta < 0: no sampling required */
369363
prev_sample = mi->prev_sample;
@@ -372,7 +366,6 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
372366
return;
373367

374368
if (mi->total_packets >= 10000) {
375-
mi->sample_deferred = 0;
376369
mi->sample_packets = 0;
377370
mi->total_packets = 0;
378371
} else if (delta > mi->n_rates * 2) {
@@ -397,19 +390,8 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
397390
* rate sampling method should be used.
398391
* Respect such rates that are not sampled for 20 interations.
399392
*/
400-
if (mrr_capable &&
401-
msr->perfect_tx_time > mr->perfect_tx_time &&
402-
msr->stats.sample_skipped < 20) {
403-
/* Only use IEEE80211_TX_CTL_RATE_CTRL_PROBE to mark
404-
* packets that have the sampling rate deferred to the
405-
* second MRR stage. Increase the sample counter only
406-
* if the deferred sample rate was actually used.
407-
* Use the sample_deferred counter to make sure that
408-
* the sampling is not done in large bursts */
409-
info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
410-
rate++;
411-
mi->sample_deferred++;
412-
} else {
393+
if (msr->perfect_tx_time < mr->perfect_tx_time ||
394+
msr->stats.sample_skipped >= 20) {
413395
if (!msr->sample_limit)
414396
return;
415397

@@ -429,6 +411,7 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
429411

430412
rate->idx = mi->r[ndx].rix;
431413
rate->count = minstrel_get_retry_count(&mi->r[ndx], info);
414+
info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
432415
}
433416

434417

net/mac80211/rc80211_minstrel.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ struct minstrel_sta_info {
7979
u8 max_prob_rate;
8080
unsigned int total_packets;
8181
unsigned int sample_packets;
82-
int sample_deferred;
8382

8483
unsigned int sample_row;
8584
unsigned int sample_column;

0 commit comments

Comments
 (0)