Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions modules/openthread/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ macro(kconfig_to_ot_option kconfig_option ot_config description)
endif()
endmacro()

macro(kconfig_to_ot_option_value kconfig_option ot_config description)
set(${ot_config} ${${kconfig_option}} CACHE STRING "${description}" FORCE)
endmacro()

# OpenThread options
set(OT_BUILD_EXECUTABLES OFF CACHE BOOL "Disable OpenThread samples")
set(OT_BUILTIN_MBEDTLS_MANAGEMENT OFF CACHE BOOL "Use Zephyr's mbedTLS heap")
Expand Down Expand Up @@ -130,6 +134,7 @@ kconfig_to_ot_option(CONFIG_OPENTHREAD_UPTIME OT_UPTIME "Enable support for trac
kconfig_to_ot_option(CONFIG_OPENTHREAD_VERHOEFF_CHECKSUM OT_VERHOEFF_CHECKSUM "Verhoeff checksum")
kconfig_to_ot_option(CONFIG_OPENTHREAD_WAKEUP_COORDINATOR OT_WAKEUP_COORDINATOR "Enable Wake-up Coordinator role")
kconfig_to_ot_option(CONFIG_OPENTHREAD_WAKEUP_END_DEVICE OT_WAKEUP_END_DEVICE "Enable Wake-up End Device role")
kconfig_to_ot_option_value(CONFIG_OPENTHREAD_RCP_RESTORATION_MAX_COUNT OT_RCP_RESTORATION_MAX_COUNT "Set the maximum number of RCP restoration attempts")

if(CONFIG_OPENTHREAD_COPROCESSOR_VENDOR_HOOK_SOURCE)
set(OT_NCP_VENDOR_HOOK_SOURCE ${CONFIG_OPENTHREAD_COPROCESSOR_VENDOR_HOOK_SOURCE} CACHE STRING "NCP vendor hook source file name" FORCE)
Expand Down
15 changes: 15 additions & 0 deletions modules/openthread/Kconfig.thread
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,18 @@ config OPENTHREAD_MLE_CHILD_TIMEOUT
default 240
help
The value of MLE child timeout in seconds.

config OPENTHREAD_RCP_RESTORATION_MAX_COUNT
int "Openthread RCP restoration maximum count"
default 2
help
The maximum number of attempts to restore the RCP connection.

config OPENTHREAD_ROUTER_SELECTION_JITTER_OVERRIDE
bool "Override default router selection jitter"
depends on OPENTHREAD_FTD

config OPENTHREAD_ROUTER_SELECTION_JITTER
int "OpenThread router selection jitter in seconds"
depends on OPENTHREAD_ROUTER_SELECTION_JITTER_OVERRIDE
default 120
11 changes: 11 additions & 0 deletions modules/openthread/openthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ LOG_MODULE_REGISTER(net_openthread_platform, CONFIG_OPENTHREAD_PLATFORM_LOG_LEVE
#include <openthread/platform/diag.h>
#include <openthread/tasklet.h>
#include <openthread/thread.h>
#include <openthread/thread_ftd.h>
#include <openthread/dataset.h>
#include <openthread/joiner.h>
#include <openthread-system.h>
Expand Down Expand Up @@ -98,6 +99,12 @@ LOG_MODULE_REGISTER(net_openthread_platform, CONFIG_OPENTHREAD_PLATFORM_LOG_LEVE
#define OT_POLL_PERIOD 0
#endif

#if defined(CONFIG_OPENTHREAD_ROUTER_SELECTION_JITTER)
#define OT_ROUTER_SELECTION_JITTER CONFIG_OPENTHREAD_ROUTER_SELECTION_JITTER
#else
#define OT_ROUTER_SELECTION_JITTER 0
#endif

#define ZEPHYR_PACKAGE_NAME "Zephyr"
#define PACKAGE_VERSION KERNEL_VERSION_STRING

Expand Down Expand Up @@ -340,6 +347,10 @@ int openthread_init(void)
}
}

if (IS_ENABLED(CONFIG_OPENTHREAD_ROUTER_SELECTION_JITTER_OVERRIDE)) {
otThreadSetRouterSelectionJitter(openthread_instance, OT_ROUTER_SELECTION_JITTER);
}

openthread_mutex_unlock();

/* Start work queue for the OpenThread module */
Expand Down