From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH v4 3/8] netdev: store signal threshold in netdev object, not globally
Date: Fri, 23 Aug 2024 15:23:34 -0700 [thread overview]
Message-ID: <20240823222339.328006-3-prestwoj@gmail.com> (raw)
In-Reply-To: <20240823222339.328006-1-prestwoj@gmail.com>
This prepares for the ability to toggle between two signal
thresholds in netdev. Since each netdev may not need/want the
same threshold store it in the netdev object rather than globally.
---
src/netdev.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/netdev.c b/src/netdev.c
index e0121095..1f1b9400 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -172,6 +172,9 @@ struct netdev {
struct netdev_ext_key_info *ext_key_info;
+ int low_signal_threshold;
+ int low_signal_threshold_5ghz;
+
bool connected : 1;
bool associated : 1;
bool operational : 1;
@@ -206,6 +209,9 @@ static struct l_genl_family *nl80211;
static struct l_queue *netdev_list;
static struct watchlist netdev_watches;
static bool mac_per_ssid;
+/* Threshold RSSI for roaming to trigger, configurable in main.conf */
+static int LOW_SIGNAL_THRESHOLD;
+static int LOW_SIGNAL_THRESHOLD_5GHZ;
static unsigned int iov_ie_append(struct iovec *iov,
unsigned int n_iov, unsigned int c,
@@ -1058,10 +1064,6 @@ struct netdev *netdev_find(int ifindex)
return l_queue_find(netdev_list, netdev_match, L_UINT_TO_PTR(ifindex));
}
-/* Threshold RSSI for roaming to trigger, configurable in main.conf */
-static int LOW_SIGNAL_THRESHOLD;
-static int LOW_SIGNAL_THRESHOLD_5GHZ;
-
static void netdev_cqm_event_rssi_threshold(struct netdev *netdev,
uint32_t rssi_event)
{
@@ -1089,8 +1091,9 @@ static void netdev_cqm_event_rssi_value(struct netdev *netdev, int rssi_val)
{
bool new_rssi_low;
uint8_t prev_rssi_level_idx = netdev->cur_rssi_level_idx;
- int threshold = netdev->frequency > 4000 ? LOW_SIGNAL_THRESHOLD_5GHZ :
- LOW_SIGNAL_THRESHOLD;
+ int threshold = netdev->frequency > 4000 ?
+ netdev->low_signal_threshold_5ghz :
+ netdev->low_signal_threshold;
if (!netdev->connected)
return;
@@ -3585,8 +3588,9 @@ static struct l_genl_msg *netdev_build_cmd_cqm_rssi_update(
uint32_t hyst = 5;
int thold_count;
int32_t thold_list[levels_num + 2];
- int threshold = netdev->frequency > 4000 ? LOW_SIGNAL_THRESHOLD_5GHZ :
- LOW_SIGNAL_THRESHOLD;
+ int threshold = netdev->frequency > 4000 ?
+ netdev->low_signal_threshold_5ghz :
+ netdev->low_signal_threshold;
if (levels_num == 0) {
thold_list[0] = threshold;
@@ -6163,6 +6167,8 @@ struct netdev *netdev_create_from_genl(struct l_genl_msg *msg,
l_strlcpy(netdev->name, ifname, IFNAMSIZ);
netdev->wiphy = wiphy;
netdev->pae_over_nl80211 = pae_io == NULL;
+ netdev->low_signal_threshold = LOW_SIGNAL_THRESHOLD;
+ netdev->low_signal_threshold_5ghz = LOW_SIGNAL_THRESHOLD_5GHZ;
if (set_mac)
memcpy(netdev->set_mac_once, set_mac, 6);
--
2.34.1
next prev 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 ` James Prestwood [this message]
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 ` [PATCH v4 6/8] station: Use Affinities property to change roaming threshold James Prestwood
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-3-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