diff mbox series

[4/9] netdev: add netdev_get_critical_signal_threshold

Message ID 20240813155638.74987-4-prestwoj@gmail.com (mailing list archive)
State New
Headers show
Series [1/9] doc: Document station Affinities property | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

James Prestwood Aug. 13, 2024, 3:56 p.m. UTC
This is set via a main.conf option but to avoid duplicated settings
parsing in station add a getter API.
---
 src/netdev.c | 6 ++++++
 src/netdev.h | 1 +
 2 files changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/src/netdev.c b/src/netdev.c
index 94766552..c7d0d880 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -3713,6 +3713,12 @@  int netdev_raise_signal_threshold(struct netdev *netdev)
 						LOW_SIGNAL_THRESHOLD_5GHZ);
 }
 
+int netdev_get_critical_signal_threshold(struct netdev *netdev)
+{
+	return netdev->frequency > 4000 ? CRITICAL_SIGNAL_THRESHOLD_5GHZ :
+					CRITICAL_SIGNAL_THRESHOLD;
+}
+
 static bool netdev_connection_work_ready(struct wiphy_radio_work_item *item)
 {
 	struct netdev *netdev = l_container_of(item, struct netdev, work);
diff --git a/src/netdev.h b/src/netdev.h
index 3a772256..f89aa572 100644
--- a/src/netdev.h
+++ b/src/netdev.h
@@ -199,6 +199,7 @@  int netdev_set_rssi_report_levels(struct netdev *netdev, const int8_t *levels,
 					size_t levels_num);
 int netdev_lower_signal_threshold(struct netdev *netdev);
 int netdev_raise_signal_threshold(struct netdev *netdev);
+int netdev_get_critical_signal_threshold(struct netdev *netdev);
 
 int netdev_get_station(struct netdev *netdev, const uint8_t *mac,
 			netdev_get_station_cb_t cb, void *user_data,