Skip to content

Commit 4fe40b8

Browse files
nbd168jmberg-intel
authored andcommitted
mac80211: minstrel: remove deferred sampling code
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]>
1 parent 1d18288 commit 4fe40b8

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
@@ -287,12 +287,6 @@ minstrel_tx_status(void *priv, struct ieee80211_supported_band *sband,
287287
mi->r[ndx].stats.success += success;
288288
}
289289

290-
if ((info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) && (i >= 0))
291-
mi->sample_packets++;
292-
293-
if (mi->sample_deferred > 0)
294-
mi->sample_deferred--;
295-
296290
if (time_after(jiffies, mi->last_stats_update +
297291
mp->update_interval / (mp->new_avg ? 2 : 1)))
298292
minstrel_update_stats(mp, mi);
@@ -367,7 +361,7 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
367361
return;
368362

369363
delta = (mi->total_packets * sampling_ratio / 100) -
370-
(mi->sample_packets + mi->sample_deferred / 2);
364+
mi->sample_packets;
371365

372366
/* delta < 0: no sampling required */
373367
prev_sample = mi->prev_sample;
@@ -376,7 +370,6 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
376370
return;
377371

378372
if (mi->total_packets >= 10000) {
379-
mi->sample_deferred = 0;
380373
mi->sample_packets = 0;
381374
mi->total_packets = 0;
382375
} else if (delta > mi->n_rates * 2) {
@@ -401,19 +394,8 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
401394
* rate sampling method should be used.
402395
* Respect such rates that are not sampled for 20 interations.
403396
*/
404-
if (mrr_capable &&
405-
msr->perfect_tx_time > mr->perfect_tx_time &&
406-
msr->stats.sample_skipped < 20) {
407-
/* Only use IEEE80211_TX_CTL_RATE_CTRL_PROBE to mark
408-
* packets that have the sampling rate deferred to the
409-
* second MRR stage. Increase the sample counter only
410-
* if the deferred sample rate was actually used.
411-
* Use the sample_deferred counter to make sure that
412-
* the sampling is not done in large bursts */
413-
info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
414-
rate++;
415-
mi->sample_deferred++;
416-
} else {
397+
if (msr->perfect_tx_time < mr->perfect_tx_time ||
398+
msr->stats.sample_skipped >= 20) {
417399
if (!msr->sample_limit)
418400
return;
419401

@@ -433,6 +415,7 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
433415

434416
rate->idx = mi->r[ndx].rix;
435417
rate->count = minstrel_get_retry_count(&mi->r[ndx], info);
418+
info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
436419
}
437420

438421

net/mac80211/rc80211_minstrel.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ struct minstrel_sta_info {
126126
u8 max_prob_rate;
127127
unsigned int total_packets;
128128
unsigned int sample_packets;
129-
int sample_deferred;
130129

131130
unsigned int sample_row;
132131
unsigned int sample_column;

0 commit comments

Comments
 (0)