From d6ac76697dba517c516c13bed660adb61c146550 Mon Sep 17 00:00:00 2001 From: Hui Bai Date: Thu, 19 Sep 2024 10:43:59 +0800 Subject: [PATCH] net: Increase net_mgmt task priority Originally, the net_mgmt task priority is very low. Based on roaming implementation, roaming is triggered in net_mgmt task. When running UDP test while doing roaming, the net_mgmt task won't have much chance to run and roaming can't be triggered. Increase it to 3, which is same value of supplicant task. Signed-off-by: Hui Bai --- samples/net/wifi/boards/rd_rw612_bga.conf | 2 ++ subsys/net/ip/Kconfig.mgmt | 10 ++++++++++ subsys/net/ip/net_mgmt.c | 4 +++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/samples/net/wifi/boards/rd_rw612_bga.conf b/samples/net/wifi/boards/rd_rw612_bga.conf index cfc846a2f18eaa..7b4683ca43c073 100644 --- a/samples/net/wifi/boards/rd_rw612_bga.conf +++ b/samples/net/wifi/boards/rd_rw612_bga.conf @@ -73,6 +73,8 @@ CONFIG_ZPERF_WORK_Q_THREAD_PRIORITY=3 CONFIG_NET_SOCKETS_SERVICE_THREAD_PRIO=3 CONFIG_NET_TC_SKIP_FOR_HIGH_PRIO=y CONFIG_NET_CONTEXT_PRIORITY=y +CONFIG_NET_MGMT_THREAD_PRIO_CUSTOM=y +CONFIG_NET_MGMT_THREAD_PRIORITY=3 CONFIG_WIFI_NM_WPA_SUPPLICANT=y CONFIG_WIFI_NM_WPA_SUPPLICANT_CLI=y diff --git a/subsys/net/ip/Kconfig.mgmt b/subsys/net/ip/Kconfig.mgmt index 04fe2adf14e891..b6b9e8ede2f12f 100644 --- a/subsys/net/ip/Kconfig.mgmt +++ b/subsys/net/ip/Kconfig.mgmt @@ -126,4 +126,14 @@ config NET_DEBUG_MGMT_EVENT_STACK help Add debug messages output on how much Net MGMT event stack is used. +config NET_MGMT_THREAD_PRIO_CUSTOM + bool "Customize net mgmt thread priority" + +if NET_MGMT_THREAD_PRIO_CUSTOM +config NET_MGMT_THREAD_PRIORITY + int "Priority of net_mgmt thread" + default NUM_PREEMPT_PRIORITIES + +endif # NET_MGMT_THREAD_PRIO_CUSTOM + endif # NET_MGMT_EVENT diff --git a/subsys/net/ip/net_mgmt.c b/subsys/net/ip/net_mgmt.c index 3c073040f09108..4fbc1a1b599733 100644 --- a/subsys/net/ip/net_mgmt.c +++ b/subsys/net/ip/net_mgmt.c @@ -413,7 +413,9 @@ void net_mgmt_event_init(void) mgmt_rebuild_global_event_mask(); #if defined(CONFIG_NET_MGMT_EVENT_THREAD) -#if defined(CONFIG_NET_TC_THREAD_COOPERATIVE) +#if defined(CONFIG_NET_MGMT_THREAD_PRIO_CUSTOM) +#define THREAD_PRIORITY CONFIG_NET_MGMT_THREAD_PRIORITY +#elif defined(CONFIG_NET_TC_THREAD_COOPERATIVE) /* Lowest priority cooperative thread */ #define THREAD_PRIORITY K_PRIO_COOP(CONFIG_NUM_COOP_PRIORITIES - 1) #else