aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2021-04-28 21:06:36 +0200
committerFelix Fietkau <nbd@nbd.name>2021-04-28 21:11:15 +0200
commitf066ee2ad549015d516444dfbb72669e9de56bb2 (patch)
tree61725a50cfeaa0d1394f9681e34d6b0c0e805348
parent6f053e5b4f65080a476541bb45c4781f38f9411f (diff)
downloadupstream-f066ee2ad549015d516444dfbb72669e9de56bb2.tar.gz
upstream-f066ee2ad549015d516444dfbb72669e9de56bb2.tar.bz2
upstream-f066ee2ad549015d516444dfbb72669e9de56bb2.zip
mac80211: minstrel_ht: fix issue in calculating success probability
Missing braces in a macro were leading to badly working rates sometimes getting a success probabilty of 1.0 Signed-off-by: Felix Fietkau <nbd@nbd.name> (cherry-picked from commit 12cb52bd0665da33cb5dc64697f1751a8b33fb05)
-rw-r--r--package/kernel/mac80211/patches/subsys/353-mac80211-minstrel_ht-fix-MINSTREL_FRAC-macro.patch21
1 files changed, 21 insertions, 0 deletions
diff --git a/package/kernel/mac80211/patches/subsys/353-mac80211-minstrel_ht-fix-MINSTREL_FRAC-macro.patch b/package/kernel/mac80211/patches/subsys/353-mac80211-minstrel_ht-fix-MINSTREL_FRAC-macro.patch
new file mode 100644
index 0000000000..0d475b7329
--- /dev/null
+++ b/package/kernel/mac80211/patches/subsys/353-mac80211-minstrel_ht-fix-MINSTREL_FRAC-macro.patch
@@ -0,0 +1,21 @@
+From: Felix Fietkau <nbd@nbd.name>
+Date: Wed, 28 Apr 2021 21:03:13 +0200
+Subject: [PATCH] mac80211: minstrel_ht: fix MINSTREL_FRAC macro
+
+Add missing braces to avoid issues with e.g. using additions in the
+div expression
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+---
+
+--- a/net/mac80211/rc80211_minstrel_ht.h
++++ b/net/mac80211/rc80211_minstrel_ht.h
+@@ -14,7 +14,7 @@
+
+ /* scaled fraction values */
+ #define MINSTREL_SCALE 12
+-#define MINSTREL_FRAC(val, div) (((val) << MINSTREL_SCALE) / div)
++#define MINSTREL_FRAC(val, div) (((val) << MINSTREL_SCALE) / (div))
+ #define MINSTREL_TRUNC(val) ((val) >> MINSTREL_SCALE)
+
+ #define EWMA_LEVEL 96 /* ewma weighting factor [/EWMA_DIV] */