summaryrefslogtreecommitdiffstats
path: root/sys/net80211
diff options
context:
space:
mode:
authorstsp <stsp@openbsd.org>2020-03-03 21:00:11 +0000
committerstsp <stsp@openbsd.org>2020-03-03 21:00:11 +0000
commit79b17e3f3acb3b8669c106ddf2c87bdba718cc41 (patch)
tree613445692a07b45cd261cfb177ec1f6010c9469e /sys/net80211
parentAllow loongson boot(8) to read from an ffs2 filesystem. ok deraadt@ visa@ (diff)
downloadwireguard-openbsd-79b17e3f3acb3b8669c106ddf2c87bdba718cc41.tar.xz
wireguard-openbsd-79b17e3f3acb3b8669c106ddf2c87bdba718cc41.zip
Fix MiRA's sub-frame error rate computation.
When describing the equation for computing a sub-frame error rate (SFER) the MiRA paper uses "hardware retries" to refer to the number of times a frame, which eventually failed entirely, was retransmitted (a situation our drivers would call "txfail"), and "nBad" to refer to frames which were "received with errors" (and this is what our drivers would call "retries"). Because of my misunderstanding of the wording used in the paper our SFER equation ended up with the "retries" and "nBad" variables swapped. Swapping them back produces more meaningful results with reasonable frame loss percentages based on the counters passed in by drivers. ok tb@
Diffstat (limited to 'sys/net80211')
-rw-r--r--sys/net80211/ieee80211_mira.c6
-rw-r--r--sys/net80211/ieee80211_mira.h6
2 files changed, 6 insertions, 6 deletions
diff --git a/sys/net80211/ieee80211_mira.c b/sys/net80211/ieee80211_mira.c
index 86e1e3ff454..d65e643ef0c 100644
--- a/sys/net80211/ieee80211_mira.c
+++ b/sys/net80211/ieee80211_mira.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_mira.c,v 1.17 2019/12/18 09:52:15 stsp Exp $ */
+/* $OpenBSD: ieee80211_mira.c,v 1.18 2020/03/03 21:00:11 stsp Exp $ */
/*
* Copyright (c) 2016 Stefan Sperling <stsp@openbsd.org>
@@ -409,7 +409,7 @@ ieee80211_mira_update_stats(struct ieee80211_mira_node *mn,
ampdu_size = ampdu_size / 1000; /* mbit */
/* Compute Sub-Frame Error Rate (see section 2.2 in MiRA paper). */
- sfer = (mn->frames * mn->retries + mn->txfail);
+ sfer = mn->frames * mn->txfail + mn->retries;
if ((sfer >> MIRA_FP_SHIFT) != 0) { /* bug in wifi driver */
if (ic->ic_if.if_flags & IFF_DEBUG) {
#ifdef DIAGNOSTIC
@@ -424,7 +424,7 @@ ieee80211_mira_update_stats(struct ieee80211_mira_node *mn,
return;
}
sfer <<= MIRA_FP_SHIFT; /* convert to fixed-point */
- sfer /= ((mn->retries + 1) * mn->frames);
+ sfer /= (mn->txfail + 1) * mn->frames;
if (sfer > MIRA_FP_1) { /* bug in wifi driver */
if (ic->ic_if.if_flags & IFF_DEBUG) {
#ifdef DIAGNOSTIC
diff --git a/sys/net80211/ieee80211_mira.h b/sys/net80211/ieee80211_mira.h
index d8061cacdff..4678966643f 100644
--- a/sys/net80211/ieee80211_mira.h
+++ b/sys/net80211/ieee80211_mira.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_mira.h,v 1.6 2019/12/18 09:52:15 stsp Exp $ */
+/* $OpenBSD: ieee80211_mira.h,v 1.7 2020/03/03 21:00:11 stsp Exp $ */
/*
* Copyright (c) 2016 Stefan Sperling <stsp@openbsd.org>
@@ -53,8 +53,8 @@ struct ieee80211_mira_node {
* Fields set by drivers before calling ieee80211_mira_choose().
*/
uint32_t frames; /* Increment per (sub-)frame transmitted. */
- uint32_t retries; /* Increment per Tx retry (frame not ACKed). */
- uint32_t txfail; /* Increment per Tx failure (also not ACKed). */
+ uint32_t retries; /* Increment per Tx retry (MiRA "nbad") */
+ uint32_t txfail; /* Increment per Tx failure (MiRA "retries") */
uint32_t ampdu_size; /* Length of last (aggregated) frame sent. */
uint32_t agglen; /* Number of subframes in last frame (1-64). */