lede/package/kernel/mac80211/patches/ath11k/351-mac80211-fix-mesh-airtime-link-metric-estimating.patch
2022-07-08 12:44:37 +08:00

36 lines
1.2 KiB
Diff

From fc9d9b3f367638505837a5815b1842bba2425993 Mon Sep 17 00:00:00 2001
From: Aditya Kumar Singh <quic_adisi@quicinc.com>
Date: Fri, 25 Mar 2022 11:04:37 +0530
Subject: [PATCH] mac80211: fix mesh airtime link metric estimating
ieee80211s_update_metric api uses sta_set_rate_info_tx api to
get struct rate_info data from struct ieee80211_tx_rate present
in ieee80211_sta->tx_stats. However, drivers can skip tx rate
calculation by setting rate idx as -1. Such drivers can provide
rate_info directly.
Add fix to use rate_info directly if present instead of
sta_set_rate_info_tx.
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
---
net/mac80211/mesh_hwmp.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -310,7 +310,12 @@ void ieee80211s_update_metric(struct iee
LINK_FAIL_THRESH)
mesh_plink_broken(sta);
- sta_set_rate_info_tx(sta, &sta->tx_stats.last_rate, &rinfo);
+ /* use rate info set by the driver directly if present */
+ if (st->rate)
+ rinfo = sta->tx_stats.last_rate_info;
+ else
+ sta_set_rate_info_tx(sta, &sta->tx_stats.last_rate, &rinfo);
+
ewma_mesh_tx_rate_avg_add(&sta->mesh->tx_rate_avg,
cfg80211_calculate_bitrate(&rinfo));
}