diff --git a/subsys/net/ip/Kconfig.mgmt b/subsys/net/ip/Kconfig.mgmt index a08220c7e91a2f..d243ea1397a1dc 100644 --- a/subsys/net/ip/Kconfig.mgmt +++ b/subsys/net/ip/Kconfig.mgmt @@ -27,14 +27,6 @@ config NET_MGMT_EVENT_STACK_SIZE Set the internal stack size for NM to run registered callbacks on events. -config NET_MGMT_EVENT_THREAD_PRIO - int "Inner thread priority (use with care)" - default -1 if NET_TC_THREAD_COOPERATIVE - default 7 - help - Set the network management event core's inner thread priority. - Do not change this unless you know what you are doing. - config NET_MGMT_EVENT_QUEUE_SIZE int "Size of event queue" default 16 if NET_MGMT_EVENT_MONITOR diff --git a/subsys/net/ip/net_mgmt.c b/subsys/net/ip/net_mgmt.c index 4947bc154b2646..ef1f09a33d4dfa 100644 --- a/subsys/net/ip/net_mgmt.c +++ b/subsys/net/ip/net_mgmt.c @@ -386,10 +386,17 @@ void net_mgmt_event_init(void) (void)memset(events, 0, CONFIG_NET_MGMT_EVENT_QUEUE_SIZE * sizeof(struct mgmt_event_entry)); +#if IS_ENABLED(CONFIG_NET_TC_THREAD_COOPERATIVE) +/* Lowest priority cooperative thread */ +#define THREAD_PRIORITY K_PRIO_COOP(CONFIG_NUM_COOP_PRIORITIES - 1) +#else +#define THREAD_PRIORITY K_PRIO_PREEMPT(CONFIG_NUM_PREEMPT_PRIORITIES - 1) +#endif + k_thread_create(&mgmt_thread_data, mgmt_stack, K_KERNEL_STACK_SIZEOF(mgmt_stack), (k_thread_entry_t)mgmt_thread, NULL, NULL, NULL, - CONFIG_NET_MGMT_EVENT_THREAD_PRIO, 0, K_NO_WAIT); + THREAD_PRIORITY, 0, K_NO_WAIT); k_thread_name_set(&mgmt_thread_data, "net_mgmt"); NET_DBG("Net MGMT initialized: queue of %u entries, stack size of %u", diff --git a/tests/net/all/prj.conf b/tests/net/all/prj.conf index 2e46cf02535162..abb9dcc79f0cc2 100644 --- a/tests/net/all/prj.conf +++ b/tests/net/all/prj.conf @@ -207,7 +207,6 @@ CONFIG_NET_CONFIG_NEED_IPV6=y CONFIG_NET_MGMT=y CONFIG_NET_MGMT_EVENT=y CONFIG_NET_MGMT_EVENT_STACK_SIZE=800 -CONFIG_NET_MGMT_EVENT_THREAD_PRIO=66 CONFIG_NET_MGMT_EVENT_QUEUE_SIZE=2 CONFIG_NET_MGMT_EVENT_LOG_LEVEL_DBG=y CONFIG_NET_DEBUG_MGMT_EVENT_STACK=y diff --git a/tests/net/lib/dns_addremove/prj.conf b/tests/net/lib/dns_addremove/prj.conf index 57136559507f28..e1e5048112e4c1 100644 --- a/tests/net/lib/dns_addremove/prj.conf +++ b/tests/net/lib/dns_addremove/prj.conf @@ -9,7 +9,6 @@ CONFIG_DNS_NUM_CONCUR_QUERIES=1 CONFIG_NET_LOG=y CONFIG_NET_MGMT=y CONFIG_NET_MGMT_EVENT=y -CONFIG_NET_MGMT_EVENT_THREAD_PRIO=7 CONFIG_NET_MGMT_EVENT_QUEUE_SIZE=2 CONFIG_NET_IPV4=y CONFIG_NET_IPV6=y