All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] mac80211: fix mesh moving average stuck
@ 2017-01-28  0:01 Rajkumar Manoharan
  2017-01-28  0:01 ` [PATCH 2/3] mac80211: Make mesh failure moving average configurable Rajkumar Manoharan
  2017-01-28  0:01 ` [PATCH 3/3] mac80211: clear failure average upon mesh path deactivation Rajkumar Manoharan
  0 siblings, 2 replies; 7+ messages in thread
From: Rajkumar Manoharan @ 2017-01-28  0:01 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, rmanohar, Rajkumar Manoharan

As moving average is not considering fractional part after
certain ratio, it will stuck at the same state. For example
with current values, moving average stuck at 96 and it will
not move forward. Fortunately current threshold is matching
against 95%. If thresold is increased more than 96, mesh path
never be deactivated under worst case. Fix failure average
movement by bumping up average at stuck state.

Signed-off-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>
---
 net/mac80211/mesh_hwmp.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index b747c9645e43..f0aa1da15bd0 100644
--- a/net/mac80211/mesh_hwmp.c
+++ b/net/mac80211/mesh_hwmp.c
@@ -300,6 +300,7 @@ void ieee80211s_update_metric(struct ieee80211_local *local,
 {
 	struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb);
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+	u32 fail_avg = sta->mesh->fail_avg;
 	int failed;
 
 	if (!ieee80211_is_data(hdr->frame_control))
@@ -308,8 +309,17 @@ void ieee80211s_update_metric(struct ieee80211_local *local,
 	failed = !(txinfo->flags & IEEE80211_TX_STAT_ACK);
 
 	/* moving average, scaled to 100 */
-	sta->mesh->fail_avg =
-		((80 * sta->mesh->fail_avg + 5) / 100 + 20 * failed);
+	fail_avg = ((80 * fail_avg + 5) / 100 + 20 * failed);
+
+	/* bump up fail average since fractional part of average is ignored.
+	 * Otherwise fail average always stuck at the same level and
+	 * never moves forward.
+	 */
+	if (fail_avg && fail_avg == sta->mesh->fail_avg)
+		fail_avg++;
+
+	sta->mesh->fail_avg = fail_avg;
+
 	if (sta->mesh->fail_avg > 95)
 		mesh_plink_broken(sta);
 }
-- 
1.9.1

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

end of thread, other threads:[~2017-01-31 19:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-28  0:01 [PATCH 1/3] mac80211: fix mesh moving average stuck Rajkumar Manoharan
2017-01-28  0:01 ` [PATCH 2/3] mac80211: Make mesh failure moving average configurable Rajkumar Manoharan
2017-01-28  0:01 ` [PATCH 3/3] mac80211: clear failure average upon mesh path deactivation Rajkumar Manoharan
2017-01-31 17:51   ` Thomas Pedersen
2017-01-31 19:33     ` Rajkumar Manoharan
2017-01-31 19:46       ` Thomas Pedersen
2017-01-31 19:53         ` Rajkumar Manoharan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.