aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2016-03-03 17:25:42 -0500
committerJohannes Berg <johannes.berg@intel.com>2016-04-05 05:40:06 -0400
commit06171e9c0bd54bd7dde67dfb2fa4cced23cff880 (patch)
tree5231a7933947f2163e395e105f425dde6f184082 /net/mac80211
parent07310a63147164eaf44a68932fbe9dbbde0fa82b (diff)
mac80211: minstrel_ht: improve sample rate skip logic
There were a few issues that were slowing down the process of finding the optimal rate, especially on devices with multi-rate retry limitations: When max_tp_rate[0] was slower than max_tp_rate[1], the code did not sample max_tp_rate[1], which would often allow it to switch places with max_tp_rate[0] (e.g. if only the first sampling attempts were bad, but the rate is otherwise good). Also, sample attempts of rates between max_tp_rate[0] and [1] were being ignored in this case, because the code only checked if the rate was slower than [1]. Fix this by checking against the fastest / second fastest max_tp_rate instead of assuming a specific order between the two. In my tests this patch significantly reduces the time until minstrel_ht finds the optimal rate right after assoc Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/rc80211_minstrel_ht.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
index 370d677b547b..46ce08ed70b5 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -924,6 +924,7 @@ minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
924 struct minstrel_rate_stats *mrs; 924 struct minstrel_rate_stats *mrs;
925 struct minstrel_mcs_group_data *mg; 925 struct minstrel_mcs_group_data *mg;
926 unsigned int sample_dur, sample_group, cur_max_tp_streams; 926 unsigned int sample_dur, sample_group, cur_max_tp_streams;
927 int tp_rate1, tp_rate2;
927 int sample_idx = 0; 928 int sample_idx = 0;
928 929
929 if (mi->sample_wait > 0) { 930 if (mi->sample_wait > 0) {
@@ -945,14 +946,22 @@ minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
945 mrs = &mg->rates[sample_idx]; 946 mrs = &mg->rates[sample_idx];
946 sample_idx += sample_group * MCS_GROUP_RATES; 947 sample_idx += sample_group * MCS_GROUP_RATES;
947 948
949 /* Set tp_rate1, tp_rate2 to the highest / second highest max_tp_rate */
950 if (minstrel_get_duration(mi->max_tp_rate[0]) >
951 minstrel_get_duration(mi->max_tp_rate[1])) {
952 tp_rate1 = mi->max_tp_rate[1];
953 tp_rate2 = mi->max_tp_rate[0];
954 } else {
955 tp_rate1 = mi->max_tp_rate[0];
956 tp_rate2 = mi->max_tp_rate[1];
957 }
958
948 /* 959 /*
949 * Sampling might add some overhead (RTS, no aggregation) 960 * Sampling might add some overhead (RTS, no aggregation)
950 * to the frame. Hence, don't use sampling for the currently 961 * to the frame. Hence, don't use sampling for the highest currently
951 * used rates. 962 * used highest throughput or probability rate.
952 */ 963 */
953 if (sample_idx == mi->max_tp_rate[0] || 964 if (sample_idx == mi->max_tp_rate[0] || sample_idx == mi->max_prob_rate)
954 sample_idx == mi->max_tp_rate[1] ||
955 sample_idx == mi->max_prob_rate)
956 return -1; 965 return -1;
957 966
958 /* 967 /*
@@ -967,10 +976,10 @@ minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
967 * if the link is working perfectly. 976 * if the link is working perfectly.
968 */ 977 */
969 978
970 cur_max_tp_streams = minstrel_mcs_groups[mi->max_tp_rate[0] / 979 cur_max_tp_streams = minstrel_mcs_groups[tp_rate1 /
971 MCS_GROUP_RATES].streams; 980 MCS_GROUP_RATES].streams;
972 sample_dur = minstrel_get_duration(sample_idx); 981 sample_dur = minstrel_get_duration(sample_idx);
973 if (sample_dur >= minstrel_get_duration(mi->max_tp_rate[1]) && 982 if (sample_dur >= minstrel_get_duration(tp_rate2) &&
974 (cur_max_tp_streams - 1 < 983 (cur_max_tp_streams - 1 <
975 minstrel_mcs_groups[sample_group].streams || 984 minstrel_mcs_groups[sample_group].streams ||
976 sample_dur >= minstrel_get_duration(mi->max_prob_rate))) { 985 sample_dur >= minstrel_get_duration(mi->max_prob_rate))) {