for (i = 0; supported; supported >>= 1, i++) {
if (!(supported & 1))
continue;
-@@ -856,22 +856,26 @@ minstrel_ht_update_stats(struct minstrel
+@@ -854,24 +854,27 @@ minstrel_ht_update_stats(struct minstrel
+ mi->sample_slow = 0;
+ mi->sample_count = 0;
- memset(tmp_mcs_tp_rate, 0, sizeof(tmp_mcs_tp_rate));
- memset(tmp_legacy_tp_rate, 0, sizeof(tmp_legacy_tp_rate));
-+
+- memset(tmp_mcs_tp_rate, 0, sizeof(tmp_mcs_tp_rate));
+- memset(tmp_legacy_tp_rate, 0, sizeof(tmp_legacy_tp_rate));
if (mi->supported[MINSTREL_CCK_GROUP])
- for (j = 0; j < ARRAY_SIZE(tmp_legacy_tp_rate); j++)
- tmp_legacy_tp_rate[j] = MINSTREL_CCK_GROUP * MCS_GROUP_RATES;
- for (j = 0; j < ARRAY_SIZE(tmp_legacy_tp_rate); j++)
- tmp_legacy_tp_rate[j] = MINSTREL_OFDM_GROUP * MCS_GROUP_RATES;
+ group = MINSTREL_OFDM_GROUP;
++ else
++ group = 0;
+
+ index = MI_RATE(group, 0);
+ for (j = 0; j < ARRAY_SIZE(tmp_legacy_tp_rate); j++)
tmp_max_prob_rate = index;
for (j = 0; j < ARRAY_SIZE(tmp_mcs_tp_rate); j++)
tmp_mcs_tp_rate[j] = index;
-@@ -888,7 +892,7 @@ minstrel_ht_update_stats(struct minstrel
+@@ -888,7 +891,7 @@ minstrel_ht_update_stats(struct minstrel
/* (re)Initialize group rate indexes */
for(j = 0; j < MAX_THR_RATES; j++)
if (group == MINSTREL_CCK_GROUP && ht_supported)
tp_rate = tmp_legacy_tp_rate;
-@@ -897,7 +901,7 @@ minstrel_ht_update_stats(struct minstrel
+@@ -897,7 +900,7 @@ minstrel_ht_update_stats(struct minstrel
if (!(mi->supported[group] & BIT(i)))
continue;
mrs = &mg->rates[i];
mrs->retry_updated = false;
-@@ -929,13 +933,13 @@ minstrel_ht_update_stats(struct minstrel
+@@ -929,13 +932,13 @@ minstrel_ht_update_stats(struct minstrel
continue;
mg = &mi->groups[group];
/* Find max probability rate per group and global */
minstrel_ht_set_best_prob_rate(mi, &tmp_max_prob_rate,
-@@ -1022,7 +1026,7 @@ minstrel_downgrade_rate(struct minstrel_
+@@ -1022,7 +1025,7 @@ minstrel_downgrade_rate(struct minstrel_
{
int group, orig_group;
while (group > 0) {
group--;
-@@ -1206,7 +1210,7 @@ minstrel_calc_retransmit(struct minstrel
+@@ -1206,7 +1209,7 @@ minstrel_calc_retransmit(struct minstrel
ctime += (t_slot * cw) >> 1;
cw = min((cw << 1) | 1, mp->cw_max);
overhead = mi->overhead_legacy;
overhead_rtscts = mi->overhead_legacy_rtscts;
} else {
-@@ -1239,7 +1243,7 @@ static void
+@@ -1239,7 +1242,7 @@ static void
minstrel_ht_set_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi,
struct ieee80211_sta_rates *ratetbl, int offset, int index)
{
const struct mcs_group *group = &minstrel_mcs_groups[group_idx];
struct minstrel_rate_stats *mrs;
u8 idx;
-@@ -1259,7 +1263,7 @@ minstrel_ht_set_rate(struct minstrel_pri
+@@ -1259,7 +1262,7 @@ minstrel_ht_set_rate(struct minstrel_pri
ratetbl->rate[offset].count_rts = mrs->retry_count_rtscts;
}
if (group_idx == MINSTREL_CCK_GROUP)
idx = mp->cck_rates[index % ARRAY_SIZE(mp->cck_rates)];
else if (group_idx == MINSTREL_OFDM_GROUP)
-@@ -1289,17 +1293,17 @@ minstrel_ht_set_rate(struct minstrel_pri
+@@ -1289,17 +1292,17 @@ minstrel_ht_set_rate(struct minstrel_pri
static inline int
minstrel_ht_get_prob_avg(struct minstrel_ht_sta *mi, int rate)
{
unsigned int duration;
/* Disable A-MSDU if max_prob_rate is bad */
-@@ -1405,7 +1409,7 @@ minstrel_get_sample_rate(struct minstrel
+@@ -1405,7 +1408,7 @@ minstrel_get_sample_rate(struct minstrel
return -1;
mrs = &mg->rates[sample_idx];
tp_rate1 = mi->max_tp_rate[0];
-@@ -1455,8 +1459,7 @@ minstrel_get_sample_rate(struct minstrel
+@@ -1455,8 +1458,7 @@ minstrel_get_sample_rate(struct minstrel
* if the link is working perfectly.
*/
if (sample_dur >= minstrel_get_duration(tp_rate2) &&
(cur_max_tp_streams - 1 <
minstrel_mcs_groups[sample_group].streams ||
-@@ -1484,7 +1487,7 @@ minstrel_ht_get_rate(void *priv, struct
+@@ -1484,7 +1486,7 @@ minstrel_ht_get_rate(void *priv, struct
int sample_idx;
if (!(info->flags & IEEE80211_TX_CTL_AMPDU) &&
minstrel_aggr_check(sta, txrc->skb);
info->flags |= mi->tx_flags;
-@@ -1512,8 +1515,8 @@ minstrel_ht_get_rate(void *priv, struct
+@@ -1512,8 +1514,8 @@ minstrel_ht_get_rate(void *priv, struct
if (sample_idx < 0)
return;
if (sample_group == &minstrel_mcs_groups[MINSTREL_CCK_GROUP] &&
(sample_idx >= 4) != txrc->short_preamble)
-@@ -1529,7 +1532,7 @@ minstrel_ht_get_rate(void *priv, struct
+@@ -1529,7 +1531,7 @@ minstrel_ht_get_rate(void *priv, struct
int idx = sample_idx % ARRAY_SIZE(mp->ofdm_rates[0]);
rate->idx = mp->ofdm_rates[mi->band][idx];
} else if (sample_group->flags & IEEE80211_TX_RC_VHT_MCS) {
sample_group->streams);
} else {
rate->idx = sample_idx + (sample_group->streams - 1) * 8;
-@@ -1898,8 +1901,8 @@ static u32 minstrel_ht_get_expected_thro
+@@ -1898,8 +1900,8 @@ static u32 minstrel_ht_get_expected_thro
struct minstrel_ht_sta *mi = priv_sta;
int i, j, prob, tp_avg;
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
-@@ -1093,6 +1093,16 @@ minstrel_ht_tx_status(void *priv, struct
+@@ -1092,6 +1092,16 @@ minstrel_ht_tx_status(void *priv, struct
info->status.ampdu_len = 1;
}
mi->ampdu_packets++;
mi->ampdu_len += info->status.ampdu_len;
-@@ -1104,9 +1114,6 @@ minstrel_ht_tx_status(void *priv, struct
+@@ -1103,9 +1113,6 @@ minstrel_ht_tx_status(void *priv, struct
mi->sample_count--;
}
if (mi->sample_mode != MINSTREL_SAMPLE_IDLE)
rate_sample = minstrel_get_ratestats(mi, mi->sample_rate);
-@@ -1504,14 +1511,6 @@ minstrel_ht_get_rate(void *priv, struct
+@@ -1503,14 +1510,6 @@ minstrel_ht_get_rate(void *priv, struct
else
sample_idx = minstrel_get_sample_rate(mp, mi);
- mi->sample_slow = 0;
mi->sample_count = 0;
- memset(tmp_mcs_tp_rate, 0, sizeof(tmp_mcs_tp_rate));
-@@ -883,6 +879,7 @@ minstrel_ht_update_stats(struct minstrel
+ if (mi->supported[MINSTREL_CCK_GROUP])
+@@ -882,6 +878,7 @@ minstrel_ht_update_stats(struct minstrel
/* Find best rate sets within all MCS groups*/
for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) {
u16 *tp_rate = tmp_mcs_tp_rate;
mg = &mi->groups[group];
if (!mi->supported[group])
-@@ -897,7 +894,7 @@ minstrel_ht_update_stats(struct minstrel
+@@ -896,7 +893,7 @@ minstrel_ht_update_stats(struct minstrel
if (group == MINSTREL_CCK_GROUP && ht_supported)
tp_rate = tmp_legacy_tp_rate;
if (!(mi->supported[group] & BIT(i)))
continue;
-@@ -906,6 +903,11 @@ minstrel_ht_update_stats(struct minstrel
+@@ -905,6 +902,11 @@ minstrel_ht_update_stats(struct minstrel
mrs = &mg->rates[i];
mrs->retry_updated = false;
minstrel_ht_calc_rate_stats(mp, mrs);
cur_prob = mrs->prob_avg;
if (minstrel_ht_get_tp_avg(mi, group, i, cur_prob) == 0)
-@@ -1470,13 +1472,9 @@ minstrel_get_sample_rate(struct minstrel
+@@ -1469,13 +1471,9 @@ minstrel_get_sample_rate(struct minstrel
if (sample_dur >= minstrel_get_duration(tp_rate2) &&
(cur_max_tp_streams - 1 <
minstrel_mcs_groups[sample_group].streams ||
- mi->sample_count = 0;
-
- memset(tmp_mcs_tp_rate, 0, sizeof(tmp_mcs_tp_rate));
- memset(tmp_legacy_tp_rate, 0, sizeof(tmp_legacy_tp_rate));
-
-@@ -885,8 +1081,6 @@ minstrel_ht_update_stats(struct minstrel
+ if (mi->supported[MINSTREL_CCK_GROUP])
+ group = MINSTREL_CCK_GROUP;
+ else if (mi->supported[MINSTREL_OFDM_GROUP])
+@@ -884,8 +1080,6 @@ minstrel_ht_update_stats(struct minstrel
if (!mi->supported[group])
continue;
/* (re)Initialize group rate indexes */
for(j = 0; j < MAX_THR_RATES; j++)
tmp_group_tp_rate[j] = MI_RATE(group, 0);
-@@ -953,9 +1147,7 @@ minstrel_ht_update_stats(struct minstrel
+@@ -952,9 +1146,7 @@ minstrel_ht_update_stats(struct minstrel
/* Try to increase robustness of max_prob_rate*/
minstrel_ht_prob_rate_reduce_streams(mi);
if (sample)
minstrel_ht_rate_sample_switch(mp, mi);
-@@ -972,6 +1164,7 @@ minstrel_ht_update_stats(struct minstrel
+@@ -971,6 +1163,7 @@ minstrel_ht_update_stats(struct minstrel
/* Reset update timer */
mi->last_stats_update = jiffies;
}
static bool
-@@ -1002,28 +1195,6 @@ minstrel_ht_txstat_valid(struct minstrel
+@@ -1001,28 +1194,6 @@ minstrel_ht_txstat_valid(struct minstrel
}
static void
minstrel_downgrade_rate(struct minstrel_ht_sta *mi, u16 *idx, bool primary)
{
int group, orig_group;
-@@ -1108,14 +1279,6 @@ minstrel_ht_tx_status(void *priv, struct
+@@ -1107,14 +1278,6 @@ minstrel_ht_tx_status(void *priv, struct
mi->ampdu_packets++;
mi->ampdu_len += info->status.ampdu_len;
if (mi->sample_mode != MINSTREL_SAMPLE_IDLE)
rate_sample = minstrel_get_ratestats(mi, mi->sample_rate);
-@@ -1387,97 +1550,20 @@ minstrel_ht_update_rates(struct minstrel
+@@ -1386,97 +1549,20 @@ minstrel_ht_update_rates(struct minstrel
rate_control_set_rates(mp->hw, mi->sta, rates);
}
}
static void
-@@ -1489,7 +1575,7 @@ minstrel_ht_get_rate(void *priv, struct
+@@ -1488,7 +1574,7 @@ minstrel_ht_get_rate(void *priv, struct
struct ieee80211_tx_rate *rate = &info->status.rates[0];
struct minstrel_ht_sta *mi = priv_sta;
struct minstrel_priv *mp = priv;
if (!(info->flags & IEEE80211_TX_CTL_AMPDU) &&
!minstrel_ht_is_legacy_group(MI_RATE_GROUP(mi->max_prob_rate)))
-@@ -1505,11 +1591,19 @@ minstrel_ht_get_rate(void *priv, struct
+@@ -1504,11 +1590,19 @@ minstrel_ht_get_rate(void *priv, struct
/* Don't use EAPOL frames for sampling on non-mrr hw */
if (mp->hw->max_rates == 1 &&
(info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO))
return;
sample_group = &minstrel_mcs_groups[MI_RATE_GROUP(sample_idx)];
-@@ -1630,16 +1724,6 @@ minstrel_ht_update_caps(void *priv, stru
+@@ -1629,16 +1723,6 @@ minstrel_ht_update_caps(void *priv, stru
mi->avg_ampdu_len = MINSTREL_FRAC(1, 1);
if (mi->ampdu_packets > 0) {
if (!ieee80211_hw_check(mp->hw, TX_STATUS_NO_AMPDU_LEN))
mi->avg_ampdu_len = minstrel_ewma(mi->avg_ampdu_len,
-@@ -1149,16 +1115,12 @@ minstrel_ht_update_stats(struct minstrel
+@@ -1148,16 +1114,12 @@ minstrel_ht_update_stats(struct minstrel
minstrel_ht_prob_rate_reduce_streams(mi);
minstrel_ht_refill_sample_rates(mi);
}
#endif
-@@ -1248,11 +1210,10 @@ minstrel_ht_tx_status(void *priv, struct
+@@ -1247,11 +1209,10 @@ minstrel_ht_tx_status(void *priv, struct
struct ieee80211_tx_info *info = st->info;
struct minstrel_ht_sta *mi = priv_sta;
struct ieee80211_tx_rate *ar = info->status.rates;
int i;
/* This packet was aggregated but doesn't carry status info */
-@@ -1279,49 +1240,18 @@ minstrel_ht_tx_status(void *priv, struct
+@@ -1278,49 +1239,18 @@ minstrel_ht_tx_status(void *priv, struct
mi->ampdu_packets++;
mi->ampdu_len += info->status.ampdu_len;
if (mp->hw->max_rates > 1) {
/*
* check for sudden death of spatial multiplexing,
-@@ -1344,7 +1274,7 @@ minstrel_ht_tx_status(void *priv, struct
+@@ -1343,7 +1273,7 @@ minstrel_ht_tx_status(void *priv, struct
if (time_after(jiffies, mi->last_stats_update + update_interval)) {
update = true;
}
if (update)
-@@ -1523,18 +1453,14 @@ static void
+@@ -1522,18 +1452,14 @@ static void
minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
{
struct ieee80211_sta_rates *rates;
if (mp->hw->max_rates >= 3) {
/* At least 3 tx rates supported, use max_tp_rate[1] next */
-@@ -1593,11 +1519,6 @@ minstrel_ht_get_rate(void *priv, struct
+@@ -1592,11 +1518,6 @@ minstrel_ht_get_rate(void *priv, struct
(info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO))
return;
if (time_is_before_jiffies(mi->sample_time))
return;
-@@ -1811,7 +1732,7 @@ minstrel_ht_update_caps(void *priv, stru
+@@ -1810,7 +1731,7 @@ minstrel_ht_update_caps(void *priv, stru
minstrel_ht_update_ofdm(mp, mi, sband, sta);
/* create an initial rate table with the lowest supported rates */
minstrel_ht_update_rates(mp, mi);
}
-@@ -1927,8 +1848,6 @@ minstrel_ht_alloc(struct ieee80211_hw *h
+@@ -1926,8 +1847,6 @@ minstrel_ht_alloc(struct ieee80211_hw *h
if (!mp)
return NULL;
/* contention window settings
* Just an approximation. Using the per-queue values would complicate
* the calculations and is probably unnecessary */
-@@ -1948,7 +1867,7 @@ minstrel_ht_alloc(struct ieee80211_hw *h
+@@ -1947,7 +1866,7 @@ minstrel_ht_alloc(struct ieee80211_hw *h
mp->has_mrr = true;
mp->hw = hw;
minstrel_ht_init_cck_rates(mp);
for (i = 0; i < ARRAY_SIZE(mp->hw->wiphy->bands); i++)
-@@ -1966,8 +1885,6 @@ static void minstrel_ht_add_debugfs(stru
+@@ -1965,8 +1884,6 @@ static void minstrel_ht_add_debugfs(stru
mp->fixed_rate_idx = (u32) -1;
debugfs_create_u32("fixed_rate_idx", S_IRUGO | S_IWUGO, debugfsdir,
&mp->fixed_rate_idx);