mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-02-06 11:04:05 +01:00
netdev: store signal threshold in netdev object, not globally
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.
This commit is contained in:
parent
54b6330845
commit
7ba5b0f924
22
src/netdev.c
22
src/netdev.c
@ -172,6 +172,9 @@ struct netdev {
|
|||||||
|
|
||||||
struct netdev_ext_key_info *ext_key_info;
|
struct netdev_ext_key_info *ext_key_info;
|
||||||
|
|
||||||
|
int low_signal_threshold;
|
||||||
|
int low_signal_threshold_5ghz;
|
||||||
|
|
||||||
bool connected : 1;
|
bool connected : 1;
|
||||||
bool associated : 1;
|
bool associated : 1;
|
||||||
bool operational : 1;
|
bool operational : 1;
|
||||||
@ -206,6 +209,9 @@ static struct l_genl_family *nl80211;
|
|||||||
static struct l_queue *netdev_list;
|
static struct l_queue *netdev_list;
|
||||||
static struct watchlist netdev_watches;
|
static struct watchlist netdev_watches;
|
||||||
static bool mac_per_ssid;
|
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,
|
static unsigned int iov_ie_append(struct iovec *iov,
|
||||||
unsigned int n_iov, unsigned int c,
|
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));
|
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,
|
static void netdev_cqm_event_rssi_threshold(struct netdev *netdev,
|
||||||
uint32_t rssi_event)
|
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;
|
bool new_rssi_low;
|
||||||
uint8_t prev_rssi_level_idx = netdev->cur_rssi_level_idx;
|
uint8_t prev_rssi_level_idx = netdev->cur_rssi_level_idx;
|
||||||
int threshold = netdev->frequency > 4000 ? LOW_SIGNAL_THRESHOLD_5GHZ :
|
int threshold = netdev->frequency > 4000 ?
|
||||||
LOW_SIGNAL_THRESHOLD;
|
netdev->low_signal_threshold_5ghz :
|
||||||
|
netdev->low_signal_threshold;
|
||||||
|
|
||||||
if (!netdev->connected)
|
if (!netdev->connected)
|
||||||
return;
|
return;
|
||||||
@ -3585,8 +3588,9 @@ static struct l_genl_msg *netdev_build_cmd_cqm_rssi_update(
|
|||||||
uint32_t hyst = 5;
|
uint32_t hyst = 5;
|
||||||
int thold_count;
|
int thold_count;
|
||||||
int32_t thold_list[levels_num + 2];
|
int32_t thold_list[levels_num + 2];
|
||||||
int threshold = netdev->frequency > 4000 ? LOW_SIGNAL_THRESHOLD_5GHZ :
|
int threshold = netdev->frequency > 4000 ?
|
||||||
LOW_SIGNAL_THRESHOLD;
|
netdev->low_signal_threshold_5ghz :
|
||||||
|
netdev->low_signal_threshold;
|
||||||
|
|
||||||
if (levels_num == 0) {
|
if (levels_num == 0) {
|
||||||
thold_list[0] = threshold;
|
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);
|
l_strlcpy(netdev->name, ifname, IFNAMSIZ);
|
||||||
netdev->wiphy = wiphy;
|
netdev->wiphy = wiphy;
|
||||||
netdev->pae_over_nl80211 = pae_io == NULL;
|
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)
|
if (set_mac)
|
||||||
memcpy(netdev->set_mac_once, set_mac, 6);
|
memcpy(netdev->set_mac_once, set_mac, 6);
|
||||||
|
Loading…
Reference in New Issue
Block a user