]> git.baikalelectronics.ru Git - kernel.git/commit
mac80211: minstrel_ht: fix rounding error in throughput calculation
authorFelix Fietkau <nbd@nbd.name>
Fri, 15 Jan 2021 12:02:42 +0000 (13:02 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 22 Jan 2021 08:11:37 +0000 (09:11 +0100)
commit375b6e1b43cab2f40d77548fc66c7c515d77d68a
tree12e46040a239db3c9867e1530942922b6547676c
parentf141a4c3761f2aafe15299255967a389089411d2
mac80211: minstrel_ht: fix rounding error in throughput calculation

On lower data rates, the throughput calculation has a significant rounding
error, causing rates like 48M and 54M OFDM to share the same throughput
value with >= 90% success probablity.

This is because the result of the division (prob_avg * 1000) / nsecs
is really small (8 in this example).

Improve accuracy by moving over some zeroes, making better use of the full
range of u32 before the division.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Link: https://lore.kernel.org/r/20210115120242.89616-10-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/rc80211_minstrel_ht.c