aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rc80211_minstrel_ht.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/rc80211_minstrel_ht.c')
-rw-r--r--net/mac80211/rc80211_minstrel_ht.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
index 4096ff6cc24f..d2ed18d82fe1 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -135,7 +135,7 @@ minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi);
135static int 135static int
136minstrel_ht_get_group_idx(struct ieee80211_tx_rate *rate) 136minstrel_ht_get_group_idx(struct ieee80211_tx_rate *rate)
137{ 137{
138 return GROUP_IDX((rate->idx / MCS_GROUP_RATES) + 1, 138 return GROUP_IDX((rate->idx / 8) + 1,
139 !!(rate->flags & IEEE80211_TX_RC_SHORT_GI), 139 !!(rate->flags & IEEE80211_TX_RC_SHORT_GI),
140 !!(rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)); 140 !!(rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH));
141} 141}
@@ -148,7 +148,7 @@ minstrel_ht_get_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
148 148
149 if (rate->flags & IEEE80211_TX_RC_MCS) { 149 if (rate->flags & IEEE80211_TX_RC_MCS) {
150 group = minstrel_ht_get_group_idx(rate); 150 group = minstrel_ht_get_group_idx(rate);
151 idx = rate->idx % MCS_GROUP_RATES; 151 idx = rate->idx % 8;
152 } else { 152 } else {
153 group = MINSTREL_CCK_GROUP; 153 group = MINSTREL_CCK_GROUP;
154 154
@@ -637,8 +637,7 @@ minstrel_ht_set_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
637 idx = mp->cck_rates[index % ARRAY_SIZE(mp->cck_rates)]; 637 idx = mp->cck_rates[index % ARRAY_SIZE(mp->cck_rates)];
638 flags = 0; 638 flags = 0;
639 } else { 639 } else {
640 idx = index % MCS_GROUP_RATES + 640 idx = index % MCS_GROUP_RATES + (group->streams - 1) * 8;
641 (group->streams - 1) * MCS_GROUP_RATES;
642 flags = IEEE80211_TX_RC_MCS | group->flags; 641 flags = IEEE80211_TX_RC_MCS | group->flags;
643 } 642 }
644 643
@@ -702,12 +701,16 @@ minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
702 if (!mi->sample_tries) 701 if (!mi->sample_tries)
703 return -1; 702 return -1;
704 703
705 mg = &mi->groups[mi->sample_group]; 704 sample_group = mi->sample_group;
705 mg = &mi->groups[sample_group];
706 sample_idx = sample_table[mg->column][mg->index]; 706 sample_idx = sample_table[mg->column][mg->index];
707 minstrel_next_sample_idx(mi);
708
709 if (!(mg->supported & BIT(sample_idx)))
710 return -1;
711
707 mr = &mg->rates[sample_idx]; 712 mr = &mg->rates[sample_idx];
708 sample_group = mi->sample_group;
709 sample_idx += sample_group * MCS_GROUP_RATES; 713 sample_idx += sample_group * MCS_GROUP_RATES;
710 minstrel_next_sample_idx(mi);
711 714
712 /* 715 /*
713 * Sampling might add some overhead (RTS, no aggregation) 716 * Sampling might add some overhead (RTS, no aggregation)
@@ -818,7 +821,7 @@ minstrel_ht_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
818 } 821 }
819 822
820 rate->idx = sample_idx % MCS_GROUP_RATES + 823 rate->idx = sample_idx % MCS_GROUP_RATES +
821 (sample_group->streams - 1) * MCS_GROUP_RATES; 824 (sample_group->streams - 1) * 8;
822 rate->flags = IEEE80211_TX_RC_MCS | sample_group->flags; 825 rate->flags = IEEE80211_TX_RC_MCS | sample_group->flags;
823} 826}
824 827
@@ -1053,10 +1056,9 @@ init_sample_table(void)
1053 1056
1054 memset(sample_table, 0xff, sizeof(sample_table)); 1057 memset(sample_table, 0xff, sizeof(sample_table));
1055 for (col = 0; col < SAMPLE_COLUMNS; col++) { 1058 for (col = 0; col < SAMPLE_COLUMNS; col++) {
1059 prandom_bytes(rnd, sizeof(rnd));
1056 for (i = 0; i < MCS_GROUP_RATES; i++) { 1060 for (i = 0; i < MCS_GROUP_RATES; i++) {
1057 get_random_bytes(rnd, sizeof(rnd));
1058 new_idx = (i + rnd[i]) % MCS_GROUP_RATES; 1061 new_idx = (i + rnd[i]) % MCS_GROUP_RATES;
1059
1060 while (sample_table[col][new_idx] != 0xff) 1062 while (sample_table[col][new_idx] != 0xff)
1061 new_idx = (new_idx + 1) % MCS_GROUP_RATES; 1063 new_idx = (new_idx + 1) % MCS_GROUP_RATES;
1062 1064