Skip to content

Commit 886c4f0

Browse files
committed
mac80211: fix division by zero in expected throughput estimation
Fixes: openwrt/openwrt#19729 Fixes: f10732f ("mac80211: estimate expected throughput if not provided by driver/rc") Signed-off-by: Felix Fietkau <[email protected]>
1 parent 7df4f7d commit 886c4f0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

package/kernel/mac80211/patches/subsys/361-mac80211-estimate-expected-throughput-if-not-provide.patch

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Signed-off-by: Felix Fietkau <[email protected]>
1212

1313
--- a/net/mac80211/sta_info.c
1414
+++ b/net/mac80211/sta_info.c
15-
@@ -2621,6 +2621,27 @@ static inline u64 sta_get_stats_bytes(st
15+
@@ -2621,6 +2621,29 @@ static inline u64 sta_get_stats_bytes(st
1616
return value;
1717
}
1818

@@ -33,14 +33,16 @@ Signed-off-by: Felix Fietkau <[email protected]>
3333
+
3434
+ duration = ieee80211_rate_expected_tx_airtime(hw, NULL, ri, band, true, 1024);
3535
+ duration += duration >> 4; /* add assumed packet error rate of ~6% */
36+
+ if (!duration)
37+
+ return 0;
3638
+
3739
+ return ((1024 * USEC_PER_SEC) / duration) * 8;
3840
+}
3941
+
4042
void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo,
4143
bool tidstats)
4244
{
43-
@@ -2865,6 +2886,8 @@ void sta_set_sinfo(struct sta_info *sta,
45+
@@ -2865,6 +2888,8 @@ void sta_set_sinfo(struct sta_info *sta,
4446
sinfo->sta_flags.set |= BIT(NL80211_STA_FLAG_TDLS_PEER);
4547

4648
thr = sta_get_expected_throughput(sta);

0 commit comments

Comments
 (0)