mac80211: add minstrel fixes that fix mt76 issues in legacy mode
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / subsys / 335-mac80211-minstrel-fix-tx-status-processing-corner-ca.patch
diff --git a/package/kernel/mac80211/patches/subsys/335-mac80211-minstrel-fix-tx-status-processing-corner-ca.patch b/package/kernel/mac80211/patches/subsys/335-mac80211-minstrel-fix-tx-status-processing-corner-ca.patch
new file mode 100644 (file)
index 0000000..b1c339a
--- /dev/null
@@ -0,0 +1,26 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Wed, 11 Nov 2020 19:25:39 +0100
+Subject: [PATCH] mac80211: minstrel: fix tx status processing corner case
+
+Some drivers fill the status rate list without setting the rate index after
+the final rate to -1. minstrel_ht already deals with this, but minstrel
+doesn't, which causes it to get stuck at the lowest rate on these drivers.
+
+Fix this by checking the count as well.
+
+Cc: stable@vger.kernel.org
+Fixes: cccf129f820e ("mac80211: add the 'minstrel' rate control algorithm")
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/net/mac80211/rc80211_minstrel.c
++++ b/net/mac80211/rc80211_minstrel.c
+@@ -274,7 +274,7 @@ minstrel_tx_status(void *priv, struct ie
+       success = !!(info->flags & IEEE80211_TX_STAT_ACK);
+       for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
+-              if (ar[i].idx < 0)
++              if (ar[i].idx < 0 || !ar[i].count)
+                       break;
+               ndx = rix_to_ndx(mi, ar[i].idx);