Skip to content

Commit 50e3609

Browse files
nipandey-01kartben
authored andcommitted
driver: wifi: siwx91x: Add roaming configuration
- Defined Kconfig macros for Roam config - Added set roam configuration API call after BGSCAN Signed-off-by: Nitin Pandey <[email protected]>
1 parent bf22b61 commit 50e3609

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

drivers/wifi/siwx91x/Kconfig.siwx91x

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,44 @@ config NET_MGMT_EVENT_STACK_SIZE
4545
config NET_MGMT_EVENT_QUEUE_SIZE
4646
default 10
4747

48+
config WIFI_SILABS_SIWX91X_ENABLE_ROAMING
49+
bool "WiFi roaming support"
50+
help
51+
Enable this option to configure roaming parameters.
52+
Roaming will be enabled automatically when the
53+
background scan is active, improving connectivity
54+
and performance during transitions between access points.
55+
56+
config WIFI_SILABS_SIWX91X_ROAMING_USE_DEAUTH
57+
bool "Use deauth frames for roaming"
58+
depends on WIFI_SILABS_SIWX91X_ENABLE_ROAMING
59+
help
60+
Enable this option to allow roaming using
61+
deauthentication frames. By default, roaming
62+
is performed using Null data packets.
63+
64+
config WIFI_SILABS_SIWX91X_ROAMING_TRIGGER_LEVEL
65+
int "Default value of roam trigger level (in dBm)"
66+
default -70
67+
range -10 -100
68+
depends on WIFI_SILABS_SIWX91X_ENABLE_ROAMING
69+
help
70+
Sets the default roam trigger level. Higher values trigger
71+
earlier roaming; lower values delay it. It determines
72+
when to start searching for a new AP.
73+
74+
config WIFI_SILABS_SIWX91X_ROAMING_TRIGGER_LEVEL_CHANGE
75+
int "Default value of roam trigger level change (in dBm)"
76+
default 5
77+
range 0 90
78+
depends on WIFI_SILABS_SIWX91X_ENABLE_ROAMING
79+
help
80+
Configure the default trigger level change for WiFi roaming.
81+
This value determines the change in signal strength (in dBm)
82+
required to initiate a roaming event. A smaller value may result
83+
in more sensitive roaming behavior, while a larger value can
84+
reduce the frequency of roaming events. It determines
85+
the signal difference needed to switch to a new AP.
4886

4987
config WIFI_SILABS_SIWX91X_ADV_SCAN_THRESHOLD
5088
int "Advanced scan threshold (in dBm)"

drivers/wifi/siwx91x/siwx91x_wifi.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "sl_net_default_values.h"
2121
#include "sl_wifi.h"
2222
#include "sl_net.h"
23+
#include "sl_wifi_constants.h"
2324

2425
#define SIWX91X_DRIVER_VERSION KERNEL_VERSION_STRING
2526

@@ -537,6 +538,15 @@ static int siwx91x_scan(const struct device *dev, struct wifi_scan_params *z_sca
537538
.enable_multi_probe = CONFIG_WIFI_SILABS_SIWX91X_ADV_MULTIPROBE,
538539
.enable_instant_scan = CONFIG_WIFI_SILABS_SIWX91X_ENABLE_INSTANT_SCAN,
539540
};
541+
sl_wifi_roam_configuration_t roam_configuration = {
542+
#ifdef CONFIG_WIFI_SILABS_SIWX91X_ENABLE_ROAMING
543+
.trigger_level = CONFIG_WIFI_SILABS_SIWX91X_ROAMING_TRIGGER_LEVEL,
544+
.trigger_level_change = CONFIG_WIFI_SILABS_SIWX91X_ROAMING_TRIGGER_LEVEL_CHANGE,
545+
#else
546+
.trigger_level = SL_WIFI_NEVER_ROAM,
547+
.trigger_level_change = 0,
548+
#endif
549+
};
540550
struct siwx91x_dev *sidev = dev->data;
541551
sl_wifi_interface_t interface;
542552
sl_wifi_ssid_t ssid = { };
@@ -573,6 +583,12 @@ static int siwx91x_scan(const struct device *dev, struct wifi_scan_params *z_sca
573583
return -EINVAL;
574584
}
575585

586+
ret = sl_wifi_set_roam_configuration(interface, &roam_configuration);
587+
if (ret != SL_STATUS_OK) {
588+
LOG_ERR("roaming configuration failed with status %x", ret);
589+
return -EINVAL;
590+
}
591+
576592
sl_scan_config.type = SL_WIFI_SCAN_TYPE_ADV_SCAN;
577593
sl_scan_config.periodic_scan_interval =
578594
CONFIG_WIFI_SILABS_SIWX91X_ADV_SCAN_PERIODICITY;

soc/silabs/silabs_siwx91x/siwg917/nwp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ int siwg91x_get_nwp_config(int wifi_oper_mode, sl_wifi_device_configuration_t *g
4545
if (wifi_oper_mode == SL_SI91X_CLIENT_MODE) {
4646
boot_config->oper_mode = SL_SI91X_CLIENT_MODE;
4747

48+
if (IS_ENABLED(CONFIG_WIFI_SILABS_SIWX91X_ROAMING_USE_DEAUTH)) {
49+
boot_config->custom_feature_bit_map |=
50+
SL_SI91X_CUSTOM_FEAT_ROAM_WITH_DEAUTH_OR_NULL_DATA;
51+
}
52+
4853
if (IS_ENABLED(CONFIG_WIFI_SILABS_SIWX91X) &&
4954
IS_ENABLED(CONFIG_BT_SILABS_SIWX91X)) {
5055
boot_config->coex_mode = SL_SI91X_WLAN_BLE_MODE;

0 commit comments

Comments
 (0)