Skip to content

Commit 5382487

Browse files
Damian-Nordicnordicjm
authored andcommitted
[nrf fromlist] modules: openthread: configure router selection jitter
Add CONFIG_OPENTHREAD_ROUTER_SELECTION_JITTER_OVERRIDE Kconfig option that enables setting the router selection jitter to CONFIG_OPENTHREAD_ROUTER_SELECTION_JITTER at startup. Upstream PR #: 94507 Signed-off-by: Damian Krolik <[email protected]>
1 parent e7e4f8b commit 5382487

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

modules/openthread/Kconfig.thread

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,12 @@ config OPENTHREAD_RCP_RESTORATION_MAX_COUNT
256256
default 2
257257
help
258258
The maximum number of attempts to restore the RCP connection.
259+
260+
config OPENTHREAD_ROUTER_SELECTION_JITTER_OVERRIDE
261+
bool "Override default router selection jitter"
262+
depends on OPENTHREAD_FTD
263+
264+
config OPENTHREAD_ROUTER_SELECTION_JITTER
265+
int "OpenThread router selection jitter in seconds"
266+
depends on OPENTHREAD_ROUTER_SELECTION_JITTER_OVERRIDE
267+
default 120

modules/openthread/openthread.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ LOG_MODULE_REGISTER(net_openthread_platform, CONFIG_OPENTHREAD_PLATFORM_LOG_LEVE
3333
#include <openthread/platform/diag.h>
3434
#include <openthread/tasklet.h>
3535
#include <openthread/thread.h>
36+
#include <openthread/thread_ftd.h>
3637
#include <openthread/dataset.h>
3738
#include <openthread/joiner.h>
3839
#include <openthread-system.h>
@@ -98,6 +99,12 @@ LOG_MODULE_REGISTER(net_openthread_platform, CONFIG_OPENTHREAD_PLATFORM_LOG_LEVE
9899
#define OT_POLL_PERIOD 0
99100
#endif
100101

102+
#if defined(CONFIG_OPENTHREAD_ROUTER_SELECTION_JITTER)
103+
#define OT_ROUTER_SELECTION_JITTER CONFIG_OPENTHREAD_ROUTER_SELECTION_JITTER
104+
#else
105+
#define OT_ROUTER_SELECTION_JITTER 0
106+
#endif
107+
101108
#define ZEPHYR_PACKAGE_NAME "Zephyr"
102109
#define PACKAGE_VERSION KERNEL_VERSION_STRING
103110

@@ -340,6 +347,10 @@ int openthread_init(void)
340347
}
341348
}
342349

350+
if (IS_ENABLED(CONFIG_OPENTHREAD_ROUTER_SELECTION_JITTER_OVERRIDE)) {
351+
otThreadSetRouterSelectionJitter(openthread_instance, OT_ROUTER_SELECTION_JITTER);
352+
}
353+
343354
openthread_mutex_unlock();
344355

345356
/* Start work queue for the OpenThread module */

0 commit comments

Comments
 (0)