From c1dd507b5f5b84936ceaa1961335c4a864b16038 Mon Sep 17 00:00:00 2001 From: Stefan Sperling Date: Mon, 30 Mar 2020 19:10:43 +0000 Subject: Don't let MiRA trigger event-based probing if the current measurement equals the average measurement, i.e. if the standard deviation is zero. Change comparisons of current measurement to the average measurement from >= to > in the "channel becomes good" check, and from <= to < in the "channel becomes bad" check. The paper's equations are written with <= and >= and thus so was our implementation. But checking for equality makes no sense in the context of event-triggered probing: The intention is to react to changes in channel quality, which occur for instance when a laptop moves around or when RF noise comes and goes. When the current measurement and the average measurement are equal, this means channel quality has not changed at all and starting to probe for a new rate is not necessary. We should probably even add a margin to avoid triggering probing based on small fluctuations, but this can be done later. ok tb@ --- sys/net80211/ieee80211_mira.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/net80211/ieee80211_mira.c b/sys/net80211/ieee80211_mira.c index 55ba68c75e1..15b2250fc37 100644 --- a/sys/net80211/ieee80211_mira.c +++ b/sys/net80211/ieee80211_mira.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_mira.c,v 1.24 2020/03/29 08:14:05 stsp Exp $ */ +/* $OpenBSD: ieee80211_mira.c,v 1.25 2020/03/30 19:10:42 stsp Exp $ */ /* * Copyright (c) 2016 Stefan Sperling @@ -1193,7 +1193,7 @@ ieee80211_mira_choose(struct ieee80211_mira_node *mn, struct ieee80211com *ic, } /* Check if event-based probing should be triggered. */ - if (g->measured <= g->average - 2 * g->stddeviation) { + if (g->measured < g->average - 2 * g->stddeviation) { /* Channel becomes bad. Probe downwards. */ DPRINTFN(2, ("channel becomes bad; probe downwards\n")); DPRINTFN(3, ("measured: %s Mbit/s\n", @@ -1214,7 +1214,7 @@ ieee80211_mira_choose(struct ieee80211_mira_node *mn, struct ieee80211com *ic, (1 << ieee80211_mira_next_lower_intra_rate(mn, ni)); #endif ieee80211_mira_cancel_timeouts(mn); - } else if (g->measured >= g->average + 2 * g->stddeviation) { + } else if (g->measured > g->average + 2 * g->stddeviation) { /* Channel becomes good. */ DPRINTFN(2, ("channel becomes good; probe upwards\n")); DPRINTFN(3, ("measured: %s Mbit/s\n", -- cgit v1.2.3