Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH v1] wifi: mac80211: Initialize EWMA fail avg to 1
@ 2023-04-17 10:02 Karthik M
  2023-04-18 13:04 ` Johannes Berg
  0 siblings, 1 reply; 15+ messages in thread
From: Karthik M @ 2023-04-17 10:02 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Karthik M, Tamizh Chelvam Raja

If the average value in mesh metrics calculation
has been rounded to 0 (success), this resets it to
the smallest nonzero value (similarly to the initialization)
to avoid a case where a single failure would result in
an average value that goes beyond the value
of 95 (Link Failure Threshold).

Signed-off-by: Tamizh Chelvam Raja <quic_tamizhr@quicinc.com>
Signed-off-by: Karthik M <quic_karm@quicinc.com>
---
Changes since v1:
 - Altered the comment to mention "mesh" and thershold value.
 - Checkpatch done
---
 net/mac80211/mesh_hwmp.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index 9b1ce7c3925a..f89cbcf212d5 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -298,10 +298,23 @@ void ieee80211s_update_metric(struct ieee80211_local *local,
 {
 	struct ieee80211_tx_info *txinfo = st->info;
 	int failed;
+	u32 fail_avg;
 	struct rate_info rinfo;
 
 	failed = !(txinfo->flags & IEEE80211_TX_STAT_ACK);
 
+	fail_avg = ewma_mesh_fail_avg_read(&sta->mesh->fail_avg);
+	if (!fail_avg) {
+		/* If the average value in mesh metrics calculation
+		 * has been rounded to 0 (success), this resets it to
+		 * the smallest nonzero value (similarly to the initialization)
+		 * to avoid a case where a single failure would result in
+		 * an average value that goes beyond the value
+		 * of 95 (Link Failure Threshold)
+		 */
+		ewma_mesh_fail_avg_add(&sta->mesh->fail_avg, 1);
+	}
+
 	/* moving average, scaled to 100.
 	 * feed failure as 100 and success as 0
 	 */
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-04-21 12:01 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-17 10:02 [PATCH v1] wifi: mac80211: Initialize EWMA fail avg to 1 Karthik M
2023-04-18 13:04 ` Johannes Berg
2023-04-20  9:30   ` Benjamin Beichler
2023-04-20 10:27     ` Johannes Berg
2023-04-20 11:12       ` Benjamin Beichler
2023-04-20 12:22       ` Felix Fietkau
2023-04-20 13:00         ` Benjamin Beichler
2023-04-20 13:15           ` Felix Fietkau
2023-04-21  9:35             ` Johannes Berg
2023-04-21  9:53               ` Felix Fietkau
2023-04-21 10:34                 ` Benjamin Beichler
2023-04-21 11:13                   ` Johannes Berg
2023-04-21 11:51                     ` Benjamin Beichler
2023-04-21 12:00                     ` Felix Fietkau
2023-04-21 10:23             ` Benjamin Beichler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox