1# Copyright (c) 2016 Intel Corporation.
2# SPDX-License-Identifier: Apache-2.0
3
4menuconfig NET_MGMT
5	bool "Network Management API"
6	help
7	  Add support for NM API that enables managing different aspects
8	  of the network stack as well as receiving notification on network
9	  events (ip address change, iface up and running ...).
10
11config NET_MGMT_EVENT
12	bool "Add support for runtime network event notifications"
13	depends on NET_MGMT
14	help
15	  This adds support for the stack to notify events towards any
16	  relevant listener. This can be necessary when application
17	  (or else) needs to be notified on a specific network event
18	  (ip address change for instance) to trigger some related work.
19
20if NET_MGMT_EVENT
21
22choice NET_MGMT_EVENT_WORKER
23	prompt "Network event scheduling"
24	default NET_MGMT_EVENT_THREAD
25
26config NET_MGMT_EVENT_THREAD
27	bool "Separate network events thread"
28	help
29	  Create a dedicated thread for network event callback handlers.
30	  If NET_MGMT_EVENT_INFO is enabled the data will be copied to
31	  a message queue.
32
33config NET_MGMT_EVENT_SYSTEM_WORKQUEUE
34	bool "System work queue"
35	help
36	  Submit work to the system work queue to schedule calling network
37	  event callback handlers.
38	  If NET_MGMT_EVENT_INFO is enabled the data will be copied to
39	  a message queue.
40
41config NET_MGMT_EVENT_DIRECT
42	bool "Trigger callback on event emit"
43	help
44	  Call network event handlers when the event is emitted.
45	  If NET_MGMT_EVENT_INFO is enabled a data pointer is passed to
46	  callback handlers, no info data is copied.
47
48endchoice
49
50config NET_MGMT_EVENT_QUEUE
51	bool
52	default y
53	depends on NET_MGMT_EVENT_THREAD || NET_MGMT_EVENT_SYSTEM_WORKQUEUE
54	help
55	  Hidden option to enable the network event's queue if asynchronous
56	  callbacks are done.
57
58config NET_MGMT_EVENT_STACK_SIZE
59	int "Stack size for the inner thread handling event callbacks"
60	default 4096 if WIFI_NM_WPA_SUPPLICANT
61	default 2048 if COVERAGE_GCOV
62	default 840 if X86
63	default 800 if THREAD_LOCAL_STORAGE
64	default 768
65	depends on NET_MGMT_EVENT_THREAD
66	help
67	  Set the internal stack size for NM to run registered callbacks
68	  on events.
69
70config NET_MGMT_EVENT_QUEUE_SIZE
71	int "Size of event queue"
72	default 16 if NET_MGMT_EVENT_MONITOR
73	default 5
74	range 1 1024
75	depends on NET_MGMT_EVENT_QUEUE
76	help
77	  Numbers of events which can be queued at same time. Note that if a
78	  3rd event comes in, the first will be removed without generating any
79	  notification. Thus the size of this queue has to be tweaked depending
80	  on the load of the system, planned for the usage.
81
82config NET_MGMT_EVENT_QUEUE_TIMEOUT
83	int "Timeout for event queue"
84	default 10
85	range 1 10000
86	depends on NET_MGMT_EVENT_QUEUE
87	help
88	  Timeout in milliseconds for the event queue. This timeout is used to
89	  wait for the queue to be available.
90
91config NET_MGMT_EVENT_INFO
92	bool "Passing information along with an event"
93	help
94	  Event notifier will be able to provide information to an event,
95	  and listeners will then be able to get it. Such information depends
96	  on the type of event.
97
98config NET_MGMT_EVENT_MONITOR
99	bool "Monitor network events from net shell"
100	depends on NET_SHELL && NET_MGMT_EVENT_INFO
101	help
102	  Allow user to monitor network events from net shell using
103	  "net events [on|off]" command. The monitoring is disabled by
104	  default. Note that you should probably increase the value of
105	  NET_MGMT_EVENT_QUEUE_SIZE from the default in order not to miss
106	  any events.
107
108config NET_MGMT_EVENT_MONITOR_AUTO_START
109	bool "Start the event monitor automatically at boot"
110	depends on NET_MGMT_EVENT_MONITOR && SHELL_BACKEND_SERIAL
111	help
112	  Allow user to start monitoring network events automatically
113	  when the system starts. The auto start is disabled by default.
114	  The default UART based shell is used to print data.
115
116module = NET_MGMT_EVENT
117module-dep = NET_LOG
118module-str = Log level for network management event core
119module-help = Enable debug messages output for network management events.
120source "subsys/net/Kconfig.template.log_config.net"
121
122config NET_DEBUG_MGMT_EVENT_STACK
123	bool "Stack analysis output on Net MGMT event core"
124	select INIT_STACKS
125	depends on NET_MGMT_EVENT_THREAD
126	help
127	  Add debug messages output on how much Net MGMT event stack is used.
128
129endif # NET_MGMT_EVENT
130