From: David Bauer Date: Tue, 21 Dec 2021 13:09:15 +0000 (+0100) Subject: policy: don't select better candidate with bad signal X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=7e999e0874c5ef832921dfc393a3bc72879a4ec4;p=project%2Fusteer.git policy: don't select better candidate with bad signal Don't select a node as a better candidate where a STA has insufficient signal to. This is the case when the roam_trigger_snr is greater than the projected signal of the client. This stops clients from being selected to roam to a node where the signal is not sufficient to maintain the connection. A selection might otherwise happen e.g. due to better channel load on the remote node. Signed-off-by: David Bauer --- diff --git a/policy.c b/policy.c index 2b94d87..445abde 100644 --- a/policy.c +++ b/policy.c @@ -72,6 +72,18 @@ below_max_assoc(struct sta_info *si) return !node->max_assoc || node->n_assoc < node->max_assoc; } +static bool +over_min_signal(struct sta_info *si) +{ + if (config.min_snr && si->signal < usteer_snr_to_signal(si->node, config.min_snr)) + return false; + + if (config.roam_trigger_snr && si->signal < usteer_snr_to_signal(si->node, config.roam_trigger_snr)) + return false; + + return true; +} + static uint32_t is_better_candidate(struct sta_info *si_cur, struct sta_info *si_new) { @@ -80,6 +92,9 @@ is_better_candidate(struct sta_info *si_cur, struct sta_info *si_new) if (!below_max_assoc(si_new)) return 0; + if (!over_min_signal(si_new)) + return 0; + if (below_assoc_threshold(si_cur, si_new) && !below_assoc_threshold(si_new, si_cur)) reasons |= (1 << UEV_SELECT_REASON_NUM_ASSOC);