2022-06-01 20:39:06

by Aditya Kumar Singh

[permalink] [raw]
Subject: [PATCH] mac80211: fix mesh airtime link metric estimating

ieee80211s_update_metric function uses sta_set_rate_info_tx
function to get struct rate_info data from ieee80211_tx_rate
struct, present in ieee80211_sta->tx_stats. However, drivers
can skip tx rate calculation by setting rate idx as -1. Such
drivers provides rate_info directly and hence ieee80211s
metric is updated incorrectly since ieee80211_tx_rate has
inconsistent data.

Add fix to use rate_info directly if present instead of
sta_set_rate_info_tx for updating ieee80211s metric.

Signed-off-by: Aditya Kumar Singh <[email protected]>
---
net/mac80211/mesh_hwmp.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 44a6fdb6efbd..3c80e7b68298 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -310,7 +310,12 @@ void ieee80211s_update_metric(struct ieee80211_local *local,
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));
}
--
2.17.1



2022-07-01 09:35:39

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] mac80211: fix mesh airtime link metric estimating

On Wed, 2022-06-01 at 12:31 +0530, Aditya Kumar Singh wrote:
>
> + /* use rate info set by the driver directly if present */
> + if (st->rate)
> + rinfo = sta->tx_stats.last_rate_info;
>

This doesn't apply anymore due to 44fa75f207d8 ("mac80211: extend
current rate control tx status API") and the MLO work.

johannes

2022-07-01 13:44:35

by Aditya Kumar Singh

[permalink] [raw]
Subject: Re: [PATCH] mac80211: fix mesh airtime link metric estimating

On 7/1/2022 15:01, Johannes Berg wrote:
> On Wed, 2022-06-01 at 12:31 +0530, Aditya Kumar Singh wrote:
>>
>> + /* use rate info set by the driver directly if present */
>> + if (st->rate)
>> + rinfo = sta->tx_stats.last_rate_info;
>>
>
> This doesn't apply anymore due to 44fa75f207d8 ("mac80211: extend
> current rate control tx status API") and the MLO work.
>
> johannes
Yes correct. Sure, I will re-base to latest HEAD and resend v2.

- Aditya Kumar Singh