public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH v4 6/8] station: Use Affinities property to change roaming threshold
Date: Fri, 23 Aug 2024 15:23:37 -0700	[thread overview]
Message-ID: <20240823222339.328006-6-prestwoj@gmail.com> (raw)
In-Reply-To: <20240823222339.328006-1-prestwoj@gmail.com>

When the affinity is set to the current BSS lower the roaming
threshold to loosly lock IWD to the current BSS. The lower
threshold is automatically removed upon roaming/disconnection
since the affinity array is also cleared out.
---
 src/station.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/station.c b/src/station.c
index c72d42ae..ca0b5329 100644
--- a/src/station.c
+++ b/src/station.c
@@ -4580,6 +4580,9 @@ static void station_affinity_disconnected_cb(struct l_dbus *dbus,
 	station->affinity_watch = 0;
 
 	l_debug("client that set affinity has disconnected");
+
+	/* The client who set the affinity disconnected, raise the threshold */
+	netdev_raise_signal_threshold(station->netdev);
 }
 
 static void station_affinity_watch_destroy(void *user_data)
@@ -4609,6 +4612,7 @@ static struct l_dbus_message *station_property_set_affinities(
 	const char *sender = l_dbus_message_get_sender(message);
 	const char *path;
 	struct l_queue *new_affinities;
+	bool lower_threshold = false;
 
 	if (!station->connected_network)
 		return dbus_error_not_connected(message);
@@ -4645,6 +4649,8 @@ static struct l_dbus_message *station_property_set_affinities(
 			return dbus_error_invalid_args(message);
 		}
 
+		lower_threshold = true;
+
 		l_queue_push_head(new_affinities, l_strdup(path));
 	}
 
@@ -4654,6 +4660,17 @@ static struct l_dbus_message *station_property_set_affinities(
 	l_dbus_property_changed(dbus, netdev_get_path(station->netdev),
 				IWD_STATION_INTERFACE, "Affinities");
 
+	/*
+	 * If affinity was set to the current BSS, lower the roam threshold. If
+	 * the connected BSS was not in the list raise the signal threshold.
+	 * The threshold may already be raised, in which case netdev will detect
+	 * this and do nothing.
+	 */
+	if (lower_threshold)
+		netdev_lower_signal_threshold(station->netdev);
+	else
+		netdev_raise_signal_threshold(station->netdev);
+
 	complete(dbus, message, NULL);
 
 	return NULL;
-- 
2.34.1


  parent reply	other threads:[~2024-08-23 22:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-23 22:23 [PATCH v4 1/8] doc: Document station Affinities property James Prestwood
2024-08-23 22:23 ` [PATCH v4 2/8] netdev: define netdev settings in netdev.h James Prestwood
2024-08-28  2:44   ` Denis Kenzior
2024-08-23 22:23 ` [PATCH v4 3/8] netdev: store signal threshold in netdev object, not globally James Prestwood
2024-08-23 22:23 ` [PATCH v4 4/8] netdev: add critical signal threshold level James Prestwood
2024-08-23 22:23 ` [PATCH v4 5/8] station: add Affinities DBus property James Prestwood
2024-08-28  2:57   ` Denis Kenzior
2024-08-23 22:23 ` James Prestwood [this message]
2024-08-23 22:23 ` [PATCH v4 7/8] auto-t: add affinities property for station, and extended_service_set James Prestwood
2024-08-23 22:23 ` [PATCH v4 8/8] auto-t: add tests for Affinities behavior James Prestwood
2024-08-28  2:39 ` [PATCH v4 1/8] doc: Document station Affinities property Denis Kenzior

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=20240823222339.328006-6-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