Skip to content

Commit

Permalink
mac80211: minstrel_ht: fix issue in calculating success probability
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
nbd168 committed Apr 28, 2021
1 parent 6f77ce7 commit 12cb52b
Showing 1 changed file with 21 additions and 0 deletions.
@@ -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] */

0 comments on commit 12cb52b

Please sign in to comment.