summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2020-03-29 08:14:06 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2020-03-29 08:14:06 +0000
commit6e71a5850c3f8da6ab4e59e1008fee0a4fb45f3a (patch)
tree4483fa87ff49f9e550ad082b5225f74d8c43a2ac
parent04628bccbebc02797912514f5252fa9ff9d964f6 (diff)
Compute MiRA's moving average and standard deviation after computing the
current measurement, not before. The MiRA paper mentions these calculations in the order we implemented them. But the moving average and standard deviation depend on the value of the goodput measurement, not the other way around. ok tb@
-rw-r--r--sys/net80211/ieee80211_mira.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sys/net80211/ieee80211_mira.c b/sys/net80211/ieee80211_mira.c
index f55320b927c..55ba68c75e1 100644
--- a/sys/net80211/ieee80211_mira.c
+++ b/sys/net80211/ieee80211_mira.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_mira.c,v 1.23 2020/03/05 11:52:18 stsp Exp $ */
+/* $OpenBSD: ieee80211_mira.c,v 1.24 2020/03/29 08:14:05 stsp Exp $ */
/*
* Copyright (c) 2016 Stefan Sperling <stsp@openbsd.org>
@@ -454,6 +454,15 @@ ieee80211_mira_update_stats(struct ieee80211_mira_node *mn,
* is tuned towards our fixed-point number format.
*/
+ g->average_agg = MIRA_FP_MUL(MIRA_FP_1 - alpha, g->average_agg);
+ g->average_agg += MIRA_FP_MUL(alpha, agglen);
+
+ toverhead = ieee80211_mira_toverhead(mn, ic, ni);
+ toverhead = MIRA_FP_MUL(toverhead, rate);
+ g->measured = MIRA_FP_DIV(MIRA_FP_1 - sfer, MIRA_FP_1 +
+ MIRA_FP_DIV(toverhead, MIRA_FP_MUL(ampdu_size, g->average_agg)));
+ g->measured = MIRA_FP_MUL(g->measured, rate);
+
g->average = MIRA_FP_MUL(MIRA_FP_1 - alpha, g->average);
g->average += MIRA_FP_MUL(alpha, g->measured);
@@ -463,15 +472,6 @@ ieee80211_mira_update_stats(struct ieee80211_mira_node *mn,
else
delta = g->measured - g->average;
g->stddeviation += MIRA_FP_MUL(beta, delta);
-
- g->average_agg = MIRA_FP_MUL(MIRA_FP_1 - alpha, g->average_agg);
- g->average_agg += MIRA_FP_MUL(alpha, agglen);
-
- toverhead = ieee80211_mira_toverhead(mn, ic, ni);
- toverhead = MIRA_FP_MUL(toverhead, rate);
- g->measured = MIRA_FP_DIV(MIRA_FP_1 - sfer, MIRA_FP_1 +
- MIRA_FP_DIV(toverhead, MIRA_FP_MUL(ampdu_size, g->average_agg)));
- g->measured = MIRA_FP_MUL(g->measured, rate);
}
void