aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rc80211_minstrel.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2008-10-15 13:13:59 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:00:36 -0400
commitf4a8cd94fc43829d065aae94f6d379c6f0f1301c (patch)
tree19159beeca84268804a4ea33c80d695da64087ce /net/mac80211/rc80211_minstrel.c
parent0a9542ee12fb57d408f19aac738e8abe8670be7a (diff)
minstrel: improve performance for non-MRR drivers
This patch enhances minstrel's performance for non-MRR setups, by preventing it from sampling slower rates with >95% success probability and by putting at least 1 non-sample frame between several sample frames. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/rc80211_minstrel.c')
-rw-r--r--net/mac80211/rc80211_minstrel.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index 759ddd8bf0f4..c10debc29ad6 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -126,7 +126,9 @@ minstrel_update_stats(struct minstrel_priv *mp, struct minstrel_sta_info *mi)
126 mr->adjusted_retry_count = mr->retry_count >> 1; 126 mr->adjusted_retry_count = mr->retry_count >> 1;
127 if (mr->adjusted_retry_count > 2) 127 if (mr->adjusted_retry_count > 2)
128 mr->adjusted_retry_count = 2; 128 mr->adjusted_retry_count = 2;
129 mr->sample_limit = 4;
129 } else { 130 } else {
131 mr->sample_limit = -1;
130 mr->adjusted_retry_count = mr->retry_count; 132 mr->adjusted_retry_count = mr->retry_count;
131 } 133 }
132 if (!mr->adjusted_retry_count) 134 if (!mr->adjusted_retry_count)
@@ -265,7 +267,8 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
265 (mi->sample_count + mi->sample_deferred / 2); 267 (mi->sample_count + mi->sample_deferred / 2);
266 268
267 /* delta > 0: sampling required */ 269 /* delta > 0: sampling required */
268 if (delta > 0) { 270 if ((delta > 0) && (mrr || !mi->prev_sample)) {
271 struct minstrel_rate *msr;
269 if (mi->packet_count >= 10000) { 272 if (mi->packet_count >= 10000) {
270 mi->sample_deferred = 0; 273 mi->sample_deferred = 0;
271 mi->sample_count = 0; 274 mi->sample_count = 0;
@@ -284,13 +287,20 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
284 } 287 }
285 288
286 sample_ndx = minstrel_get_next_sample(mi); 289 sample_ndx = minstrel_get_next_sample(mi);
290 msr = &mi->r[sample_ndx];
287 sample = true; 291 sample = true;
288 sample_slower = mrr && (mi->r[sample_ndx].perfect_tx_time > 292 sample_slower = mrr && (msr->perfect_tx_time >
289 mi->r[ndx].perfect_tx_time); 293 mi->r[ndx].perfect_tx_time);
290 294
291 if (!sample_slower) { 295 if (!sample_slower) {
292 ndx = sample_ndx; 296 if (msr->sample_limit != 0) {
293 mi->sample_count++; 297 ndx = sample_ndx;
298 mi->sample_count++;
299 if (msr->sample_limit > 0)
300 msr->sample_limit--;
301 } else {
302 sample = false;
303 }
294 } else { 304 } else {
295 /* Only use IEEE80211_TX_CTL_RATE_CTRL_PROBE to mark 305 /* Only use IEEE80211_TX_CTL_RATE_CTRL_PROBE to mark
296 * packets that have the sampling rate deferred to the 306 * packets that have the sampling rate deferred to the
@@ -302,10 +312,20 @@ minstrel_get_rate(void *priv, struct ieee80211_sta *sta,
302 mi->sample_deferred++; 312 mi->sample_deferred++;
303 } 313 }
304 } 314 }
315 mi->prev_sample = sample;
316
317 /* If we're not using MRR and the sampling rate already
318 * has a probability of >95%, we shouldn't be attempting
319 * to use it, as this only wastes precious airtime */
320 if (!mrr && sample && (mi->r[ndx].probability > 17100))
321 ndx = mi->max_tp_rate;
322
305 ar[0].idx = mi->r[ndx].rix; 323 ar[0].idx = mi->r[ndx].rix;
306 ar[0].count = minstrel_get_retry_count(&mi->r[ndx], info); 324 ar[0].count = minstrel_get_retry_count(&mi->r[ndx], info);
307 325
308 if (!mrr) { 326 if (!mrr) {
327 if (!sample)
328 ar[0].count = mp->max_retry;
309 ar[1].idx = mi->lowest_rix; 329 ar[1].idx = mi->lowest_rix;
310 ar[1].count = mp->max_retry; 330 ar[1].count = mp->max_retry;
311 return; 331 return;
@@ -401,6 +421,7 @@ minstrel_rate_init(void *priv, struct ieee80211_supported_band *sband,
401 421
402 /* calculate maximum number of retransmissions before 422 /* calculate maximum number of retransmissions before
403 * fallback (based on maximum segment size) */ 423 * fallback (based on maximum segment size) */
424 mr->sample_limit = -1;
404 mr->retry_count = 1; 425 mr->retry_count = 1;
405 mr->retry_count_cts = 1; 426 mr->retry_count_cts = 1;
406 mr->retry_count_rtscts = 1; 427 mr->retry_count_rtscts = 1;