- 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 <n.rottga...@gmail.com>
---
 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;
 
-- 
2.39.5


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to