[PATCH usteer] Add band-steering signal threshold with adaption
Nils Hendrik Rottgardt
n.rottgardt at gmail.com
Mon Nov 11 13:48:30 PST 2024
Avoid ping-pong between bands by adding a dynamic signal threshold.
If 5Ghz band is below roaming threshold (e.g. -70) and 2,4Ghz over
band-steering threshold (e.g. -50) this adds a dynamic threshold
depends on the signal level when station has connected. It adapts to
worser signal slowly.
- band_steering: added dynamic signal threshold
- main: added config option
Signed-off-by: Nils Hendrik Rottgardt <n.rottgardt at gmail.com>
---
band_steering.c | 19 ++++++++++++++++++-
main.c | 1 +
openwrt/usteer/files/etc/config/usteer | 4 ++++
openwrt/usteer/files/etc/init.d/usteer | 6 +++---
usteer.h | 2 ++
5 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/band_steering.c b/band_steering.c
index 7fce1df..8577caf 100644
--- a/band_steering.c
+++ b/band_steering.c
@@ -20,7 +20,24 @@
void usteer_band_steering_sta_update(struct sta_info *si)
{
- if (si->signal < usteer_snr_to_signal(si->node, config.band_steering_min_snr))
+ if (si->connected == STA_NOT_CONNECTED) {
+ if (si->band_steering.signal_threshold != NO_SIGNAL) {
+ si->band_steering.signal_threshold = NO_SIGNAL;
+ }
+ return;
+ }
+ if (si->connected != STA_NOT_CONNECTED && si->band_steering.signal_threshold == NO_SIGNAL) {
+ si->band_steering.signal_threshold = si->signal;
+ MSG(DEBUG, "band steering station " MAC_ADDR_FMT " (%s) set threshold (signal threshold %u)\n", MAC_ADDR_DATA(si->sta->addr), usteer_node_name(si->node), si->band_steering.signal_threshold);
+ return;
+ }
+
+ /* Adapt signal threshold to actual signal quality */
+ if (si->signal < si->band_steering.signal_threshold) {
+ si->band_steering.signal_threshold--;
+ MSG(DEBUG, "band steering station " MAC_ADDR_FMT " (%s) reduce threshold (signal: %d, signal threshold: %u)\n", MAC_ADDR_DATA(si->sta->addr), usteer_node_name(si->node), si->signal, si->band_steering.signal_threshold);
+ }
+ if (si->signal < usteer_snr_to_signal(si->node, config.band_steering_min_snr) || si->signal < si->band_steering.signal_threshold + config.band_steering_signal_threshold)
si->band_steering.below_snr = true;
}
diff --git a/main.c b/main.c
index 99aa6ad..4a9253c 100644
--- a/main.c
+++ b/main.c
@@ -101,6 +101,7 @@ void usteer_init_defaults(void)
config.band_steering_interval = 120000;
config.band_steering_min_snr = -60;
+ config.band_steering_signal_threshold = 5;
config.link_measurement_interval = 30000;
diff --git a/openwrt/usteer/files/etc/config/usteer b/openwrt/usteer/files/etc/config/usteer
index f53c338..58d1f44 100644
--- a/openwrt/usteer/files/etc/config/usteer
+++ b/openwrt/usteer/files/etc/config/usteer
@@ -128,6 +128,10 @@ config usteer
# steered to a higher frequency band
#option band_steering_min_snr -60
+ # Difference that the signal must be better compared to signal was on connection to node.
+ # Avoids conflicts between roaming and band-steering policies.
+ # option band_steering_signal_threshold 5
+
# Interval (ms) the device is sent a link-measurement request to help assess
# the bi-directional link quality. Setting the interval to 0 disables link-measurements.
#option link_measurement_interval 30000
diff --git a/openwrt/usteer/files/etc/init.d/usteer b/openwrt/usteer/files/etc/init.d/usteer
index 07fd99e..965aa0a 100755
--- a/openwrt/usteer/files/etc/init.d/usteer
+++ b/openwrt/usteer/files/etc/init.d/usteer
@@ -83,9 +83,9 @@ uci_usteer() {
min_connect_snr min_snr min_snr_kick_delay signal_diff_threshold \
initial_connect_delay steer_reject_timeout roam_process_timeout\
roam_kick_delay roam_scan_tries roam_scan_timeout \
- roam_scan_snr roam_scan_interval \
- roam_trigger_snr roam_trigger_interval \
- band_steering_interval band_steering_min_snr link_measurement_interval \
+ roam_scan_snr roam_scan_interval roam_trigger_snr roam_trigger_interval \
+ link_measurement_interval \
+ band_steering_interval band_steering_min_snr band_steering_signal_threshold \
load_kick_threshold load_kick_delay load_kick_min_clients \
load_kick_reason_code
do
diff --git a/usteer.h b/usteer.h
index f692fb8..f354282 100644
--- a/usteer.h
+++ b/usteer.h
@@ -191,6 +191,7 @@ struct usteer_config {
uint32_t band_steering_interval;
int32_t band_steering_min_snr;
+ uint32_t band_steering_signal_threshold;
uint32_t link_measurement_interval;
@@ -265,6 +266,7 @@ struct sta_info {
struct {
bool below_snr;
+ int signal_threshold;
} band_steering;
uint64_t kick_time;
--
2.39.5
More information about the openwrt-devel
mailing list