summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorstsp <stsp@openbsd.org>2020-03-29 08:14:05 +0000
committerstsp <stsp@openbsd.org>2020-03-29 08:14:05 +0000
commitdbca38dca5dcba6ed3149d306399f60b07b9304c (patch)
tree494e4bec696a5b7cd7c5ead6acdc8668c3990590 /sys
parentBe concise: do not say that void functions return no values, that's obvious. (diff)
downloadwireguard-openbsd-dbca38dca5dcba6ed3149d306399f60b07b9304c.tar.xz
wireguard-openbsd-dbca38dca5dcba6ed3149d306399f60b07b9304c.zip
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@
Diffstat (limited to 'sys')
-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