[PATCH usteer v2 3/3] According to IEEE specs added a countdown before kicking the station

Nils Hendrik Rottgardt n.rottgardt at gmail.com
Tue Oct 29 13:08:30 PDT 2024


- Disaccociation Timer will run a countdown before disaccociate the station
- Supporting multiple transisiton requests if validity period of neighbors is over

Signed-off-by: Nils Hendrik Rottgardt <n.rottgardt at gmail.com>
---
 band_steering.c | 20 ++++++++++----------
 policy.c        |  6 +++++-
 usteer.h        |  1 +
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/band_steering.c b/band_steering.c
index d680d02..ef92443 100644
--- a/band_steering.c
+++ b/band_steering.c
@@ -96,16 +96,16 @@ void usteer_band_steering_perform_steer(struct usteer_local_node *ln)
 		}
 
 		if (si->bss_transition) {
-			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);
-			}
+			validity_period = 10000 / usteer_local_node_get_beacon_interval(ln); /* ~ 10 seconds */
+			if (si->sta->aggressive) {
+				if (!si->kick_time)	{
+						si->kick_time = current_time + config.roam_kick_delay;
+						si->roam_transition_request_validity_end = current_time + 10000;						
+						disassoc_timer = (si->kick_time - current_time) / usteer_local_node_get_beacon_interval(ln);
+						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/policy.c b/policy.c
index b3af22b..0d9b87b 100644
--- a/policy.c
+++ b/policy.c
@@ -375,7 +375,7 @@ usteer_roam_trigger_sm(struct usteer_local_node *ln, struct sta_info *si)
 
 		if (!si->kick_time && si->sta->aggressive)
 			si->kick_time = current_time + config.roam_kick_delay;
-
+		si->roam_transition_request_validity_end = current_time + 10000;
 		validity_period = 10000 / usteer_local_node_get_beacon_interval(ln); /* ~ 10 seconds */
 		if (si->sta->aggressive) {
 			disassoc_timer = (si->kick_time - current_time) / usteer_local_node_get_beacon_interval(ln);
@@ -401,6 +401,10 @@ bool usteer_policy_can_perform_roam(struct sta_info *si)
 	if (si->kick_time && si->kick_time <= current_time)
 		return false;
 
+	/* Skip if in validity period */
+	if (current_time < si->roam_transition_request_validity_end)
+		return false;
+
 	/* Skip on rejected transition */
 	if (si->bss_transition_response.status_code && current_time - si->bss_transition_response.timestamp < config.steer_reject_timeout)
 		return false;
diff --git a/usteer.h b/usteer.h
index 7a399db..ec6e251 100644
--- a/usteer.h
+++ b/usteer.h
@@ -258,6 +258,7 @@ struct sta_info {
 	enum roam_trigger_state roam_state;
 	uint8_t roam_tries;
 	uint64_t roam_event;
+	uint64_t roam_transition_request_validity_end;
 	uint64_t roam_kick;
 	uint64_t roam_scan_start;
 	uint64_t roam_scan_timeout_start;
-- 
2.39.5




More information about the openwrt-devel mailing list