aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rc80211_minstrel.c
diff options
context:
space:
mode:
authorThomas Huehn <thomas@net.t-labs.tu-berlin.de>2013-03-04 17:30:05 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-03-06 10:36:09 -0500
commitf744bf81f7501d03f45ba23f9cf947abc3b422c9 (patch)
tree365aa54da77095cc1e31fdf63a6d51669633f0c0 /net/mac80211/rc80211_minstrel.c
parent1e9c27df7b4a59f2269b9c88a5cef1e9018e77f6 (diff)
mac80211: add lowest rate into minstrel's random rate sampling table
While minstrel bootstraps and fills the success probabilities of each rate the lowest rate has typically a very high success probability (often 100% in our tests). Its statistics are never updated but considered to setup the mrr chain. In our tests we see that especially the 3rd mrr stage (which is that rate providing highest success probability) is filled with the lowest rate because its initial high sucess probability is never updated. By design the 4th mrr stage is filled with the lowest rate so often 3rd and 4th mrr stage are equal. This patch follows minstrels general approach of assuming as little as possible about rate dependencies. Consequently we include the lowest rate into the random sampling table to get balanced up-to-date statistics of all rates and therefore balanced decisions. Acked-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Thomas Huehn <thomas@net.t-labs.tu-berlin.de> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/rc80211_minstrel.c')
-rw-r--r--net/mac80211/rc80211_minstrel.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index aa59f2962c38..5c0f5327c77f 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -55,7 +55,6 @@
55#include "rate.h" 55#include "rate.h"
56#include "rc80211_minstrel.h" 56#include "rc80211_minstrel.h"
57 57
58#define SAMPLE_COLUMNS 10
59#define SAMPLE_TBL(_mi, _idx, _col) \ 58#define SAMPLE_TBL(_mi, _idx, _col) \
60 _mi->sample_table[(_idx * SAMPLE_COLUMNS) + _col] 59 _mi->sample_table[(_idx * SAMPLE_COLUMNS) + _col]
61 60
@@ -210,7 +209,7 @@ minstrel_get_next_sample(struct minstrel_sta_info *mi)
210 unsigned int sample_ndx; 209 unsigned int sample_ndx;
211 sample_ndx = SAMPLE_TBL(mi, mi->sample_row, mi->sample_column); 210 sample_ndx = SAMPLE_TBL(mi, mi->sample_row, mi->sample_column);
212 mi->sample_row++; 211 mi->sample_row++;
213 if ((int) mi->sample_row > (mi->n_rates - 2)) { 212 if ((int) mi->sample_row >= mi->n_rates) {
214 mi->sample_row = 0; 213 mi->sample_row = 0;
215 mi->sample_column++; 214 mi->sample_column++;
216 if (mi->sample_column >= SAMPLE_COLUMNS) 215 if (mi->sample_column >= SAMPLE_COLUMNS)
@@ -370,26 +369,21 @@ static void
370init_sample_table(struct minstrel_sta_info *mi) 369init_sample_table(struct minstrel_sta_info *mi)
371{ 370{
372 unsigned int i, col, new_idx; 371 unsigned int i, col, new_idx;
373 unsigned int n_srates = mi->n_rates - 1;
374 u8 rnd[8]; 372 u8 rnd[8];
375 373
376 mi->sample_column = 0; 374 mi->sample_column = 0;
377 mi->sample_row = 0; 375 mi->sample_row = 0;
378 memset(mi->sample_table, 0, SAMPLE_COLUMNS * mi->n_rates); 376 memset(mi->sample_table, 0xff, SAMPLE_COLUMNS * mi->n_rates);
379 377
380 for (col = 0; col < SAMPLE_COLUMNS; col++) { 378 for (col = 0; col < SAMPLE_COLUMNS; col++) {
381 for (i = 0; i < n_srates; i++) { 379 for (i = 0; i < mi->n_rates; i++) {
382 get_random_bytes(rnd, sizeof(rnd)); 380 get_random_bytes(rnd, sizeof(rnd));
383 new_idx = (i + rnd[i & 7]) % n_srates; 381 new_idx = (i + rnd[i & 7]) % mi->n_rates;
384 382
385 while (SAMPLE_TBL(mi, new_idx, col) != 0) 383 while (SAMPLE_TBL(mi, new_idx, col) != 0xff)
386 new_idx = (new_idx + 1) % n_srates; 384 new_idx = (new_idx + 1) % mi->n_rates;
387 385
388 /* Don't sample the slowest rate (i.e. slowest base 386 SAMPLE_TBL(mi, new_idx, col) = i;
389 * rate). We must presume that the slowest rate works
390 * fine, or else other management frames will also be
391 * failing and the link will break */
392 SAMPLE_TBL(mi, new_idx, col) = i + 1;
393 } 387 }
394 } 388 }
395} 389}