Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH v2 11/13] station: adapt roam scan logic to look at the bss group
Date: Mon, 24 Mar 2025 07:15:36 -0700	[thread overview]
Message-ID: <20250324141538.144578-12-prestwoj@gmail.com> (raw)
In-Reply-To: <20250324141538.144578-1-prestwoj@gmail.com>

In station_roam_scan_notify BSS candidates were being ignored if
their rank was not better than the current AP. This check needed
to be changed to first check the BSS group, then the rank (only
if the groups were equal). This takes into account the current BSS
roam blacklisting status rather than only rank.
---
 src/station.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/station.c b/src/station.c
index 066ca337..092d0b4d 100644
--- a/src/station.c
+++ b/src/station.c
@@ -2801,6 +2801,7 @@ static bool station_roam_scan_notify(int err, struct l_queue *bss_list,
 	struct handshake_state *hs = netdev_get_handshake(station->netdev);
 	struct scan_bss *current_bss = station->connected_bss;
 	struct scan_bss *bss;
+	enum scan_bss_group cur_bss_group = SCAN_BSS_GROUP_BLACKLISTED;
 	double cur_bss_rank = 0.0;
 	static const double RANK_FT_FACTOR = 1.3;
 	uint16_t mdid;
@@ -2831,6 +2832,9 @@ static bool station_roam_scan_notify(int err, struct l_queue *bss_list,
 	bss = l_queue_find(bss_list, bss_match_bssid, current_bss->addr);
 	if (bss && !station->ap_directed_roaming) {
 		cur_bss_rank = bss->rank;
+		cur_bss_group = scan_bss_evaluate_group(
+						current_bss->addr,
+						current_bss->signal_strength);
 
 		if (hs->mde && bss->mde_present && l_get_le16(bss->mde) == mdid)
 			cur_bss_rank *= RANK_FT_FACTOR;
@@ -2855,6 +2859,9 @@ static bool station_roam_scan_notify(int err, struct l_queue *bss_list,
 	while ((bss = l_queue_pop_head(bss_list))) {
 		double rank;
 		struct roam_bss *rbss;
+		enum scan_bss_group group = scan_bss_evaluate_group(
+							bss->addr,
+							bss->signal_strength);
 
 		station_print_scan_bss(bss);
 
@@ -2876,8 +2883,7 @@ static bool station_roam_scan_notify(int err, struct l_queue *bss_list,
 		if (network_can_connect_bss(network, bss) < 0)
 			goto next;
 
-		if (blacklist_contains_bss(bss->addr,
-					BLACKLIST_REASON_CONNECT_FAILED))
+		if (group == SCAN_BSS_GROUP_BLACKLISTED)
 			goto next;
 
 		rank = bss->rank;
@@ -2885,7 +2891,15 @@ static bool station_roam_scan_notify(int err, struct l_queue *bss_list,
 		if (hs->mde && bss->mde_present && l_get_le16(bss->mde) == mdid)
 			rank *= RANK_FT_FACTOR;
 
-		if (rank <= cur_bss_rank)
+		/*
+		 * First check the group:
+		 *   - If worse, disregard BSS candidate
+		 *   - If better, keep BSS candidate
+		 *   - If equal, compare based on rank
+		 */
+		if (group < cur_bss_group)
+			goto next;
+		else if (group == cur_bss_group && rank <= cur_bss_rank)
 			goto next;
 
 		/*
-- 
2.34.1


  parent reply	other threads:[~2025-03-24 14:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-24 14:15 [PATCH v2 00/13] Roam blacklisting and scan BSS groups James Prestwood
2025-03-24 14:15 ` [PATCH v2 01/13] station: always network (temp) blacklist on failure James Prestwood
2025-03-24 14:15 ` [PATCH v2 02/13] auto-t: add test for disabling the timeout blacklist James Prestwood
2025-03-24 14:15 ` [PATCH v2 03/13] blacklist: include a blacklist reason when adding/finding James Prestwood
2025-03-24 14:15 ` [PATCH v2 04/13] blacklist: fix pruning to remove the entry if its expired James Prestwood
2025-03-24 14:15 ` [PATCH v2 05/13] blacklist: add BLACKLIST_REASON_TRANSIENT_ERROR James Prestwood
2025-03-24 14:15 ` [PATCH v2 06/13] network: update to use blacklist's new temporary type James Prestwood
2025-03-24 14:15 ` [PATCH v2 07/13] blacklist: add new blacklist reason, ROAM_REQUESTED James Prestwood
2025-03-24 14:15 ` [PATCH v2 08/13] scan: Introduce higher level scan BSS groups James Prestwood
2025-03-24 14:15 ` [PATCH v2 09/13] station: roam blacklist BSS when a roam is requested James Prestwood
2025-03-24 14:15 ` [PATCH v2 10/13] station: roam blacklist AP even mid-roam James Prestwood
2025-03-24 14:15 ` James Prestwood [this message]
2025-03-24 14:15 ` [PATCH v2 12/13] auto-t: add tests for AP roam blacklisting James Prestwood
2025-03-24 14:15 ` [PATCH v2 13/13] doc: document OptimalSignalThreshold and InitialRoamRequestedTimeout James Prestwood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250324141538.144578-12-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox