diff options
-rw-r--r-- | net/mac80211/rc80211_minstrel.c | 20 | ||||
-rw-r--r-- | net/mac80211/rc80211_minstrel.h | 4 | ||||
-rw-r--r-- | net/mac80211/rc80211_minstrel_ht.c | 1 |
3 files changed, 10 insertions, 15 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 | |||
370 | init_sample_table(struct minstrel_sta_info *mi) | 369 | init_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 | } |
diff --git a/net/mac80211/rc80211_minstrel.h b/net/mac80211/rc80211_minstrel.h index 200b7e3632da..a0ccc5779910 100644 --- a/net/mac80211/rc80211_minstrel.h +++ b/net/mac80211/rc80211_minstrel.h | |||
@@ -9,7 +9,9 @@ | |||
9 | #ifndef __RC_MINSTREL_H | 9 | #ifndef __RC_MINSTREL_H |
10 | #define __RC_MINSTREL_H | 10 | #define __RC_MINSTREL_H |
11 | 11 | ||
12 | #define EWMA_LEVEL 75 /* ewma weighting factor [%] */ | 12 | #define EWMA_LEVEL 75 /* ewma weighting factor [%] */ |
13 | #define SAMPLE_COLUMNS 10 /* number of columns in sample table */ | ||
14 | |||
13 | 15 | ||
14 | /* scaled fraction values */ | 16 | /* scaled fraction values */ |
15 | #define MINSTREL_SCALE 16 | 17 | #define MINSTREL_SCALE 16 |
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index 3009e457e758..749552bdcfe1 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include "rc80211_minstrel_ht.h" | 17 | #include "rc80211_minstrel_ht.h" |
18 | 18 | ||
19 | #define AVG_PKT_SIZE 1200 | 19 | #define AVG_PKT_SIZE 1200 |
20 | #define SAMPLE_COLUMNS 10 | ||
21 | 20 | ||
22 | /* Number of bits for an average sized packet */ | 21 | /* Number of bits for an average sized packet */ |
23 | #define MCS_NBITS (AVG_PKT_SIZE << 3) | 22 | #define MCS_NBITS (AVG_PKT_SIZE << 3) |