diff --git a/modules/openthread/Kconfig b/modules/openthread/Kconfig index b44316d31cb..ff6d1afbb86 100644 --- a/modules/openthread/Kconfig +++ b/modules/openthread/Kconfig @@ -134,6 +134,11 @@ config OPENTHREAD_RADIO_WORKQUEUE_STACK_SIZE default 608 if MPU_STACK_GUARD && FPU_SHARING && CPU_CORTEX_M default 512 +config OPENTHREAD_RADIO_WORKQUEUE_PRIORITY + int "OpenThread radio transmit workqueue priority" + default 0 if OPENTHREAD_THREAD_PREEMPTIVE + default 7 + endmenu # "Zephyr optimizations" config OPENTHREAD_SHELL diff --git a/modules/openthread/platform/radio.c b/modules/openthread/platform/radio.c index 171fce1b667..91b417b0627 100644 --- a/modules/openthread/platform/radio.c +++ b/modules/openthread/platform/radio.c @@ -58,9 +58,9 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME, CONFIG_OPENTHREAD_PLATFORM_LOG_LEVEL); #define FRAME_TYPE_ACK 0x02 #if defined(CONFIG_NET_TC_THREAD_COOPERATIVE) -#define OT_WORKER_PRIORITY K_PRIO_COOP(CONFIG_OPENTHREAD_THREAD_PRIORITY) +#define OT_WORKER_PRIORITY K_PRIO_COOP(CONFIG_OPENTHREAD_RADIO_WORKQUEUE_PRIORITY) #else -#define OT_WORKER_PRIORITY K_PRIO_PREEMPT(CONFIG_OPENTHREAD_THREAD_PRIORITY) +#define OT_WORKER_PRIORITY K_PRIO_PREEMPT(CONFIG_OPENTHREAD_RADIO_WORKQUEUE_PRIORITY) #endif #define CHANNEL_COUNT OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX - OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN + 1 @@ -622,6 +622,8 @@ static int run_tx_task(otInstance *aInstance) sState = OT_RADIO_STATE_TRANSMIT; k_work_submit_to_queue(&ot_work_q, &tx_job); + k_yield(); + return 0; } else { return -EBUSY; diff --git a/tests/subsys/openthread/radio_stub.c b/tests/subsys/openthread/radio_stub.c index e82bf76d872..2365b714c45 100644 --- a/tests/subsys/openthread/radio_stub.c +++ b/tests/subsys/openthread/radio_stub.c @@ -19,8 +19,8 @@ #define CONFIG_OPENTHREAD_PLATFORM_PKT_TXTIME 1 #endif -#define CONFIG_OPENTHREAD_THREAD_PRIORITY 5 -#define OT_WORKER_PRIORITY K_PRIO_COOP(CONFIG_OPENTHREAD_THREAD_PRIORITY) +#define CONFIG_OPENTHREAD_RADIO_WORKQUEUE_PRIORITY 5 +#define OT_WORKER_PRIORITY K_PRIO_COOP(CONFIG_OPENTHREAD_RADIO_WORKQUEUE_PRIORITY) #define CONFIG_NET_L2_OPENTHREAD 1 #define CONFIG_OPENTHREAD_RADIO_WORKQUEUE_STACK_SIZE 512 #define CONFIG_OPENTHREAD_DEFAULT_RX_SENSITIVITY -100