9855c35a5da8fa7ece490ba962abf142e65dfebf
[openwrt/staging/ansuel.git] /
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Fri, 14 Jun 2019 21:14:22 +0200
3 Subject: [PATCH] mac80211: minstrel_ht: fix default max throughput rate
4 indexes
5
6 Use the first supported rate instead of 0 (which can be invalid)
7
8 Signed-off-by: Felix Fietkau <nbd@nbd.name>
9 ---
10
11 --- a/net/mac80211/rc80211_minstrel_ht.c
12 +++ b/net/mac80211/rc80211_minstrel_ht.c
13 @@ -486,7 +486,7 @@ minstrel_ht_assign_best_tp_rates(struct
14 tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_ewma;
15 tmp_mcs_tp = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, tmp_prob);
16
17 - if (tmp_cck_tp > tmp_mcs_tp) {
18 + if (tmp_cck_tp_rate && tmp_cck_tp > tmp_mcs_tp) {
19 for(i = 0; i < MAX_THR_RATES; i++) {
20 minstrel_ht_sort_best_tp_rates(mi, tmp_cck_tp_rate[i],
21 tmp_mcs_tp_rate);
22 @@ -558,11 +558,19 @@ minstrel_ht_update_stats(struct minstrel
23 mi->sample_slow = 0;
24 mi->sample_count = 0;
25
26 - /* Initialize global rate indexes */
27 - for(j = 0; j < MAX_THR_RATES; j++){
28 - tmp_mcs_tp_rate[j] = 0;
29 - tmp_cck_tp_rate[j] = 0;
30 - }
31 + memset(tmp_mcs_tp_rate, 0, sizeof(tmp_mcs_tp_rate));
32 + memset(tmp_cck_tp_rate, 0, sizeof(tmp_cck_tp_rate));
33 + if (mi->supported[MINSTREL_CCK_GROUP])
34 + for (j = 0; j < ARRAY_SIZE(tmp_cck_tp_rate); j++)
35 + tmp_cck_tp_rate[j] = MINSTREL_CCK_GROUP * MCS_GROUP_RATES;
36 +
37 + if (mi->supported[MINSTREL_VHT_GROUP_0])
38 + index = MINSTREL_VHT_GROUP_0 * MCS_GROUP_RATES;
39 + else
40 + index = MINSTREL_HT_GROUP_0 * MCS_GROUP_RATES;
41 +
42 + for (j = 0; j < ARRAY_SIZE(tmp_mcs_tp_rate); j++)
43 + tmp_mcs_tp_rate[j] = index;
44
45 /* Find best rate sets within all MCS groups*/
46 for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) {