Commit 343a26d1 authored by Jukka Rissanen's avatar Jukka Rissanen Committed by Anas Nashif
Browse files

net: mgmt: Use proper coop thread priority value



If user sets CONFIG_NUM_PREEMPT_PRIORITIES=0, then the priority
of the net_mgmt thread will be -1 which is the same as idle thread.
This will trigger assert in kernel as then the minimum coop priority
is -2 in this case. Remove the net_mgmt thread priority setting from
Kconfig file as it is low value and set the coop thread priority
the same way as other network threads are doing it.

Fixes #32375

Signed-off-by: default avatarJukka Rissanen <jukka.rissanen@linux.intel.com>
parent 7179e1d6
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -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
+8 −1
Original line number Diff line number Diff line
@@ -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",
+0 −1
Original line number Diff line number Diff line
@@ -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
+0 −1
Original line number Diff line number Diff line
@@ -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