summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau2025-08-09 14:47:45 +0000
committerFelix Fietkau2025-08-09 14:48:33 +0000
commit886c4f054e5e34bc3de23d65da76180eea358c4a (patch)
tree62dc36f1061e372a8dadef76118a5305e5f6b780
parent7df4f7d7094e05468deb91ee43fbf0bec70a35cc (diff)
downloadopenwrt-886c4f054e5e34bc3de23d65da76180eea358c4a.tar.gz
mac80211: fix division by zero in expected throughput estimation
Fixes: https://github.com/openwrt/openwrt/issues/19729 Fixes: f10732fb5632 ("mac80211: estimate expected throughput if not provided by driver/rc") Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r--package/kernel/mac80211/patches/subsys/361-mac80211-estimate-expected-throughput-if-not-provide.patch6
1 files changed, 4 insertions, 2 deletions
diff --git a/package/kernel/mac80211/patches/subsys/361-mac80211-estimate-expected-throughput-if-not-provide.patch b/package/kernel/mac80211/patches/subsys/361-mac80211-estimate-expected-throughput-if-not-provide.patch
index 9bcaf86504..81cff9e7e8 100644
--- a/package/kernel/mac80211/patches/subsys/361-mac80211-estimate-expected-throughput-if-not-provide.patch
+++ b/package/kernel/mac80211/patches/subsys/361-mac80211-estimate-expected-throughput-if-not-provide.patch
@@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
-@@ -2621,6 +2621,27 @@ static inline u64 sta_get_stats_bytes(st
+@@ -2621,6 +2621,29 @@ static inline u64 sta_get_stats_bytes(st
return value;
}
@@ -33,6 +33,8 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
+
+ duration = ieee80211_rate_expected_tx_airtime(hw, NULL, ri, band, true, 1024);
+ duration += duration >> 4; /* add assumed packet error rate of ~6% */
++ if (!duration)
++ return 0;
+
+ return ((1024 * USEC_PER_SEC) / duration) * 8;
+}
@@ -40,7 +42,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
bool tidstats)
{
-@@ -2865,6 +2886,8 @@ void sta_set_sinfo(struct sta_info *sta,
+@@ -2865,6 +2888,8 @@ void sta_set_sinfo(struct sta_info *sta,
sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
thr = sta_get_expected_throughput(sta);