Skip to content

Commit

Permalink
mac80211: add new minstrel_ht patches to improve probing on mt76x2
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Fietkau <[email protected]>
  • Loading branch information
nbd168 committed Aug 12, 2019
1 parent 98b654d commit 9861050
Show file tree
Hide file tree
Showing 4 changed files with 591 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
From: Felix Fietkau <[email protected]>
Date: Fri, 14 Jun 2019 21:12:04 +0200
Subject: [PATCH] mac80211: minstrel_ht: fix per-group max throughput rate
initialization

The group number needs to be multiplied by the number of rates per group
to get the full rate index

Signed-off-by: Felix Fietkau <[email protected]>
---

--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -576,7 +576,7 @@ minstrel_ht_update_stats(struct minstrel

/* (re)Initialize group rate indexes */
for(j = 0; j < MAX_THR_RATES; j++)
- tmp_group_tp_rate[j] = group;
+ tmp_group_tp_rate[j] = MCS_GROUP_RATES * group;

for (i = 0; i < MCS_GROUP_RATES; i++) {
if (!(mi->supported[group] & BIT(i)))
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
From: Felix Fietkau <[email protected]>
Date: Wed, 5 Jun 2019 20:42:49 +0200
Subject: [PATCH] mac80211: minstrel_ht: reduce unnecessary rate probing
attempts

On hardware with static fallback tables (e.g. mt76x2), rate probing attempts
can be very expensive.
On such devices, avoid sampling rates slower than the per-group max throughput
rate, based on the assumption that the fallback table will take care of probing
lower rates within that group if the higher rates fail.
To make this work, this also fixes a wrong initialization in the previously
unused per-group sorted rate array.
To further reduce unnecessary probing attempts, skip duplicate attempts on
rates slower than the max throughput rate.

Signed-off-by: Felix Fietkau <[email protected]>
---

--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -1062,6 +1062,21 @@ minstrel_get_sample_rate(struct minstrel
minstrel_get_duration(mi->max_prob_rate) * 3 < sample_dur)
return -1;

+
+ /*
+ * For devices with no configurable multi-rate retry, skip sampling
+ * below the per-group max throughput rate, and only use one sampling
+ * attempt per rate
+ */
+ if (mp->hw->max_rates == 1 &&
+ (minstrel_get_duration(mg->max_group_tp_rate[0]) < sample_dur ||
+ mrs->attempts))
+ return -1;
+
+ /* Skip already sampled slow rates */
+ if (sample_dur >= minstrel_get_duration(tp_rate1) && mrs->attempts)
+ return -1;
+
/*
* Make sure that lower rates get sampled only occasionally,
* if the link is working perfectly.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
From: Felix Fietkau <[email protected]>
Date: Fri, 14 Jun 2019 21:14:22 +0200
Subject: [PATCH] mac80211: minstrel_ht: fix default max throughput rate
indexes

Use the first supported rate instead of 0 (which can be invalid)

Signed-off-by: Felix Fietkau <[email protected]>
---

--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -487,7 +487,7 @@ minstrel_ht_assign_best_tp_rates(struct
tmp_prob = mi->groups[tmp_group].rates[tmp_idx].prob_ewma;
tmp_mcs_tp = minstrel_ht_get_tp_avg(mi, tmp_group, tmp_idx, tmp_prob);

- if (tmp_cck_tp > tmp_mcs_tp) {
+ if (tmp_cck_tp_rate && tmp_cck_tp > tmp_mcs_tp) {
for(i = 0; i < MAX_THR_RATES; i++) {
minstrel_ht_sort_best_tp_rates(mi, tmp_cck_tp_rate[i],
tmp_mcs_tp_rate);
@@ -559,11 +559,19 @@ minstrel_ht_update_stats(struct minstrel
mi->sample_slow = 0;
mi->sample_count = 0;

- /* Initialize global rate indexes */
- for(j = 0; j < MAX_THR_RATES; j++){
- tmp_mcs_tp_rate[j] = 0;
- tmp_cck_tp_rate[j] = 0;
- }
+ memset(tmp_mcs_tp_rate, 0, sizeof(tmp_mcs_tp_rate));
+ memset(tmp_cck_tp_rate, 0, sizeof(tmp_cck_tp_rate));
+ if (mi->supported[MINSTREL_CCK_GROUP])
+ for (j = 0; j < ARRAY_SIZE(tmp_cck_tp_rate); j++)
+ tmp_cck_tp_rate[j] = MINSTREL_CCK_GROUP * MCS_GROUP_RATES;
+
+ if (mi->supported[MINSTREL_VHT_GROUP_0])
+ index = MINSTREL_VHT_GROUP_0 * MCS_GROUP_RATES;
+ else
+ index = MINSTREL_HT_GROUP_0 * MCS_GROUP_RATES;
+
+ for (j = 0; j < ARRAY_SIZE(tmp_mcs_tp_rate); j++)
+ tmp_mcs_tp_rate[j] = index;

/* Find best rate sets within all MCS groups*/
for (group = 0; group < ARRAY_SIZE(minstrel_mcs_groups); group++) {
Loading

0 comments on commit 9861050

Please sign in to comment.