From patchwork Tue Oct 29 20:08:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nils Hendrik Rottgardt X-Patchwork-Id: 2003887 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=fJ2WEcn4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XdLxg2wLwz1xws for ; Wed, 30 Oct 2024 07:11:32 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LhAzo2WFbtkFXARIydjuXkF728slUwQVUTtpAULitWE=; b=fJ2WEcn4CVwP91 wmHce79GGtN2Ia/Rj6KfzPy67P8BdpIOJcIiwUO3m6BdEkCtfIZQK4+DnKAUnct+Y8wRCzanGjFTh 2iUoxiN8yizWwQb5ksNvQqYpWqRfo6M23OZFkq+q1XBejnCDduG562Nrws1rZWV6q+9vHGSnLgiET j/nhZu4KHSEKN4FIGS8QKUMBoKsB2uDvK5TiY1i1saIUBzkAFiGIc3g809vhU0Ozq90cYwOfo8C3V LljVjBWKVl/Pxf46lKbPimXaut8zr8BqWJcWDmX51CbeJx+fz2Wby1cxOzCMWXoVmFbEpSA4myZtA 57uzVMrGNG0nqkI/EiEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t5sXO-0000000Fj7O-0Kbw; Tue, 29 Oct 2024 20:09:58 +0000 Received: from mail-smtp-out-01-pmx.wtnet.de ([84.46.103.117]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t5sVz-0000000Fiwj-0B2E for openwrt-devel@lists.openwrt.org; Tue, 29 Oct 2024 20:08:32 +0000 Received: from mail-cust-in-02-pmx.wtnet.de (mail-cust-in-02-pmx.wtnet.de [84.46.103.102]) by mail-smtp-out-01-pmx.wtnet.de (8.15.2/8.15.2/Debian-15~mysql) with ESMTP id 49TK8Nab018867; Tue, 29 Oct 2024 21:08:23 +0100 X-WT-Originating-IP: 37.122.141.164 X-WT-Authenticated-As: ellerau@wtnet.de Received: from viserver1.ham.lan (37.122.141.164.dynamic-pppoe.dt.ipv4.wtnet.de [37.122.141.164]) (authenticated bits=0) by mail-cust-in-02-pmx.wtnet.de (8.15.2/8.15.2/Debian-15~mysql) with ESMTPA id 49TK8Nn5020721; Tue, 29 Oct 2024 21:08:23 +0100 Received: from Dell-7706.muc.lan (unknown [192.168.177.109]) by viserver1.ham.lan (Postfix) with ESMTP id EB03461DCD; Tue, 29 Oct 2024 21:08:22 +0100 (CET) From: Nils Hendrik Rottgardt To: openwrt-devel@lists.openwrt.org Cc: Nils Hendrik Rottgardt Subject: [PATCH usteer v2 2/3] New aggressive roaming - optimizations Date: Tue, 29 Oct 2024 21:08:09 +0100 Message-Id: <20241029200809.21560-1-n.rottgardt@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241020184732.17031-1-n.rottgardt@gmail.com> References: <20241020184732.17031-1-n.rottgardt@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241029_130831_496767_7063A446 X-CRM114-Status: GOOD ( 19.76 ) X-Spam-Score: -0.4 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Optimized handling of aggressive roaming - Take care of correct disassociation_timer corresponding to kick_time - Added some messages (verbose and debug) - Corrected assisted roaming as disassociation_imminent has to be false as no kick is p [...] Content analysis details: (-0.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [84.46.103.117 listed in list.dnswl.org] 0.0 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [84.46.103.117 listed in sa-trusted.bondedsender.org] 0.0 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [84.46.103.117 listed in sa-accredit.habeas.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 DKIM_ADSP_CUSTOM_MED No valid author signature, adsp_override is CUSTOM_MED -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 1.0 FORGED_GMAIL_RCVD 'From' gmail.com does not match 'Received' headers 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [n.rottgardt(at)gmail.com] 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [84.46.103.117 listed in bl.score.senderscore.com] 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different 0.9 NML_ADSP_CUSTOM_MED ADSP custom_med hit, and not from a mailing list X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Optimized handling of aggressive roaming - Take care of correct disassociation_timer corresponding to kick_time - Added some messages (verbose and debug) - Corrected assisted roaming as disassociation_imminent has to be false as no kick is planned Signed-off-by: Nils Hendrik Rottgardt --- band_steering.c | 16 ++++++++++++---- local_node.c | 3 ++- main.c | 1 - openwrt/usteer/files/etc/config/usteer | 9 ++++----- openwrt/usteer/files/etc/init.d/usteer | 2 +- policy.c | 21 +++++++++++---------- ubus.c | 8 ++++---- usteer.h | 1 - 8 files changed, 34 insertions(+), 27 deletions(-) diff --git a/band_steering.c b/band_steering.c index d7ff8cf..d680d02 100644 --- a/band_steering.c +++ b/band_steering.c @@ -60,6 +60,8 @@ void usteer_band_steering_perform_steer(struct usteer_local_node *ln) { unsigned int min_count = DIV_ROUND_UP(config.band_steering_interval, config.local_sta_update); struct sta_info *si; + uint32_t disassoc_timer; + uint32_t validity_period; if (!config.band_steering_interval) return; @@ -94,10 +96,16 @@ void usteer_band_steering_perform_steer(struct usteer_local_node *ln) } if (si->bss_transition) { - if (si->sta->aggressive) - usteer_ubus_band_steering_request(si, 0, true, config.aggressive_disassoc_timer, true, config.aggressive_disassoc_timer); - else - usteer_ubus_band_steering_request(si, 0, false, 0, true, 100); + if (!si->kick_time && si->sta->aggressive) { + si->kick_time = current_time + config.roam_kick_delay; + validity_period = 10000 / usteer_local_node_get_beacon_interval(ln); /* ~ 10 seconds */ + disassoc_timer = (si->kick_time - current_time) / usteer_local_node_get_beacon_interval(ln); + + if (si->sta->aggressive) + usteer_ubus_band_steering_request(si, 0, true, disassoc_timer, true, validity_period); + else + usteer_ubus_band_steering_request(si, 0, false, 0, true, validity_period); + } } si->band_steering.below_snr = false; diff --git a/local_node.c b/local_node.c index 6aa7008..89490d7 100644 --- a/local_node.c +++ b/local_node.c @@ -183,6 +183,7 @@ usteer_handle_bss_tm_response(struct usteer_local_node *ln, struct blob_attr *ms if (si->bss_transition_response.status_code) { /* Cancel imminent kick in case BSS transition was rejected */ si->kick_time = 0; + MSG(VERBOSE, "Kick canceled because transition was rejected by sta=" MAC_ADDR_FMT "\n", MAC_ADDR_DATA(si->sta->addr)); } return 0; @@ -748,7 +749,7 @@ usteer_local_node_process_bss_tm_queries(struct uloop_timeout *timeout) if (!si) continue; - usteer_ubus_bss_transition_request(si, query->dialog_token, config.aggressive_all, validity_period, true, validity_period, NULL); + usteer_ubus_bss_transition_request(si, query->dialog_token, false, 0, true, validity_period, NULL); } /* Free pending queries we can not handle */ diff --git a/main.c b/main.c index b07b624..c796c3c 100644 --- a/main.c +++ b/main.c @@ -97,7 +97,6 @@ void usteer_init_defaults(void) config.initial_connect_delay = 0; config.remote_node_timeout = 10; config.aggressive_all = false; - config.aggressive_disassoc_timer = 100; config.steer_reject_timeout = 60000; diff --git a/openwrt/usteer/files/etc/config/usteer b/openwrt/usteer/files/etc/config/usteer index 2fe47f3..7ef365c 100644 --- a/openwrt/usteer/files/etc/config/usteer +++ b/openwrt/usteer/files/etc/config/usteer @@ -1,4 +1,6 @@ config usteer + # OpenWRT guide: https://openwrt.org/docs/guide-user/network/wifi/usteer + # The network interface for inter-AP communication option 'network' 'lan' @@ -71,15 +73,12 @@ config usteer # Timeout (ms) for which a client will not be steered after rejecting a BSS-transition-request #option steer_reject_timeout 60000 - # Use aggressvice roaming to push clients to another AP + # Use aggressive roaming to push clients to another AP for all stations (0/1) #option aggressive_all 0 - # List of MACs to enable aggressive roaming on. If not set all macs will handled aggressive + # List of MACs (lower case) to enable aggressive roaming on. If not set all stations will handled aggressive #list aggressive_mac_list '' - # Disassociation imminent tuner - in aggresive mode the time a client has to roam away before disconnected hardly - #option aggressive_disassoc_timer 100 - # Timeout (in ms) after which a association following a disassociation is not seen # as a roam #option roam_process_timeout 5000 diff --git a/openwrt/usteer/files/etc/init.d/usteer b/openwrt/usteer/files/etc/init.d/usteer index fdc8211..d517f93 100755 --- a/openwrt/usteer/files/etc/init.d/usteer +++ b/openwrt/usteer/files/etc/init.d/usteer @@ -86,7 +86,7 @@ uci_usteer() { 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 aggressive_disassoc_timer\ + roam_trigger_snr roam_trigger_interval\ band_steering_interval band_steering_min_snr link_measurement_interval \ load_kick_threshold load_kick_delay load_kick_min_clients \ load_kick_reason_code diff --git a/policy.c b/policy.c index e66f2d4..b3af22b 100644 --- a/policy.c +++ b/policy.c @@ -48,6 +48,7 @@ better_signal_strength(int signal_cur, int signal_new) const bool is_better = signal_new - signal_cur > (int) config.signal_diff_threshold; + //hier das Band noch berücksichtigen wegen höherer Bandbreite bei 5Ghz if (!config.signal_diff_threshold) return false; @@ -322,6 +323,8 @@ static bool usteer_roam_trigger_sm(struct usteer_local_node *ln, struct sta_info *si) { struct sta_info *candidate; + uint32_t disassoc_timer; + uint32_t validity_period; struct uevent ev = { .si_cur = si, }; @@ -370,13 +373,15 @@ usteer_roam_trigger_sm(struct usteer_local_node *ln, struct sta_info *si) break; } + if (!si->kick_time && si->sta->aggressive) + si->kick_time = current_time + config.roam_kick_delay; + + validity_period = 10000 / usteer_local_node_get_beacon_interval(ln); /* ~ 10 seconds */ if (si->sta->aggressive) { - // TODO: Disaccociation Timer noch konfigurierbar machen - usteer_ubus_bss_transition_request(si, 1, true, config.aggressive_disassoc_timer, true, config.aggressive_disassoc_timer, candidate->node); - si->roam_disassoc_time = current_time + (100 * 100); + disassoc_timer = (si->kick_time - current_time) / usteer_local_node_get_beacon_interval(ln); + usteer_ubus_bss_transition_request(si, 1, true, disassoc_timer, true, validity_period, candidate->node); } else { - usteer_ubus_bss_transition_request(si, 1, false, 0, true, 100, candidate->node); - si->kick_time = current_time + config.roam_kick_delay; + usteer_ubus_bss_transition_request(si, 1, false, 0, true, validity_period, candidate->node); } usteer_roam_set_state(si, ROAM_TRIGGER_IDLE, &ev); @@ -393,7 +398,7 @@ bool usteer_policy_can_perform_roam(struct sta_info *si) return false; /* Skip on pending kick */ - if (si->kick_time) + if (si->kick_time && si->kick_time <= current_time) return false; /* Skip on rejected transition */ @@ -408,10 +413,6 @@ bool usteer_policy_can_perform_roam(struct sta_info *si) if (current_time - si->connected_since < config.roam_trigger_interval) return false; - /* Skip on aggressive roaming in progress - wait 10s after disassociation event*/ - if (current_time - si->roam_disassoc_time < 10000) - return false; - return true; } diff --git a/ubus.c b/ubus.c index fd6e224..57b7d29 100644 --- a/ubus.c +++ b/ubus.c @@ -691,10 +691,10 @@ int usteer_ubus_bss_transition_request(struct sta_info *si, blobmsg_add_u32(&b, "validity_period", validity_period); if (!target_node) { // Add all known neighbors if no specific target set - MSG(DEBUG, "ROAMING requested for sta=" MAC_ADDR_FMT " without target\n", MAC_ADDR_DATA(si->sta->addr)); + MSG(VERBOSE, "ROAMING requested for sta=" MAC_ADDR_FMT " without target\n", MAC_ADDR_DATA(si->sta->addr)); usteer_ubus_disassoc_add_neighbors(si); } else { - MSG(DEBUG, "ROAMING requested for sta=" MAC_ADDR_FMT " to %s with disassociation timer %i\n", MAC_ADDR_DATA(si->sta->addr), usteer_node_name(target_node), disassoc_timer); + MSG(VERBOSE, "ROAMING requested for sta=" MAC_ADDR_FMT " to %s with disassociation timer %i\n", MAC_ADDR_DATA(si->sta->addr), usteer_node_name(target_node), disassoc_timer); usteer_ubus_disassoc_add_neighbor(si, target_node); } return ubus_invoke(ubus_ctx, ln->obj_id, "bss_transition_request", b.head, NULL, 0, 100); @@ -730,10 +730,10 @@ int usteer_ubus_band_steering_request(struct sta_info *si, } blobmsg_close_array(&b, c); if (sizeof(si->node) > 0) { - MSG(DEBUG, "BAND STEERING requested for sta=" MAC_ADDR_FMT " with disassociation timer %i\n", MAC_ADDR_DATA(si->sta->addr), disassoc_timer); + MSG(VERBOSE, "BAND STEERING requested for sta=" MAC_ADDR_FMT " with disassociation timer %i\n", MAC_ADDR_DATA(si->sta->addr), disassoc_timer); return ubus_invoke(ubus_ctx, ln->obj_id, "bss_transition_request", b.head, NULL, 0, 100); } else - MSG(DEBUG, "BAND STEERING no targets found for sta=" MAC_ADDR_FMT "\n", MAC_ADDR_DATA(si->sta->addr)); + MSG(VERBOSE, "BAND STEERING no targets found for sta=" MAC_ADDR_FMT "\n", MAC_ADDR_DATA(si->sta->addr)); } int usteer_ubus_trigger_link_measurement(struct sta_info *si) diff --git a/usteer.h b/usteer.h index f771c37..7a399db 100644 --- a/usteer.h +++ b/usteer.h @@ -259,7 +259,6 @@ struct sta_info { uint8_t roam_tries; uint64_t roam_event; uint64_t roam_kick; - uint64_t roam_disassoc_time; uint64_t roam_scan_start; uint64_t roam_scan_timeout_start;