1# IP stack config
2
3# Copyright (c) 2016 Intel Corporation.
4# Copyright (c) 2021 Nordic Semiconductor
5# Copyright (c) 2023 Arm Limited (or its affiliates). All rights reserved.
6# SPDX-License-Identifier: Apache-2.0
7
8menu "IP stack"
9
10# Hidden option enabled whenever an IP stack is available.
11config NET_IP
12	bool
13	default y if NET_IPV6 || NET_IPV4
14
15# Hidden option selected by net connection based socket implementations
16# to draw in all code required for connection infrastructure.
17config NET_CONNECTION_SOCKETS
18	bool
19
20config NET_NATIVE
21	bool "Native network stack support"
22	default y
23	help
24	  Enables Zephyr native IP stack. If you disable this, then
25	  you need to enable the offloading support if you want to
26	  have IP connectivity.
27
28# Hidden options for enabling native IPv6/IPv4. Using these options
29# avoids having "defined(CONFIG_NET_IPV6) && defined(CONFIG_NET_NATIVE)"
30# in the code as we can have "defined(CONFIG_NET_NATIVE_IPV6)" instead.
31config NET_NATIVE_IPV6
32	bool
33	depends on NET_NATIVE
34	default y if NET_IPV6
35
36config NET_NATIVE_IPV4
37	bool
38	depends on NET_NATIVE
39	default y if NET_IPV4
40
41config NET_NATIVE_TCP
42	bool
43	depends on NET_NATIVE
44	default y if NET_TCP
45
46config NET_NATIVE_UDP
47	bool
48	depends on NET_NATIVE
49	default y if NET_UDP
50
51config NET_OFFLOAD
52	bool "Offload IP stack"
53	help
54	  Enables TCP/IP stack to be offload to a co-processor.
55
56config NET_OFFLOADING_SUPPORT
57	bool
58	default y if NET_OFFLOAD || NET_SOCKETS_OFFLOAD
59	help
60	  Hidden option that is set if either NET_OFFLOAD or
61	  NET_SOCKETS_OFFLOAD is set. This allows us to check
62	  only one option instead of two.
63
64if NET_OFFLOAD
65module = NET_OFFLOAD
66module-dep = NET_LOG
67module-str = Log level for offload layer
68module-help = Enables offload layer to output debug messages.
69source "subsys/net/Kconfig.template.log_config.net"
70endif # NET_OFFLOAD
71
72config NET_RAW_MODE
73	bool
74	help
75	  This is a very specific option used to built only the very minimal
76	  part of the net stack in order to get network drivers working without
77	  any net stack above: core, L2 etc... Basically this will build only
78	  net_pkt part. It is currently used only by IEEE 802.15.4 drivers,
79	  though any type of net drivers could use it.
80
81if !NET_RAW_MODE
82
83choice NET_QEMU_NETWORKING
84	prompt "Qemu networking"
85	default NET_QEMU_PPP if NET_PPP
86	default NET_QEMU_SLIP
87	depends on QEMU_TARGET
88	help
89	  Can be used to select how the network connectivity is established
90	  from inside qemu to host system. This can be done either via
91	  serial connection (SLIP) or via Qemu ethernet driver.
92
93config NET_QEMU_SLIP
94	bool "SLIP"
95	help
96	  Connect to host or to another Qemu via SLIP.
97
98config NET_QEMU_PPP
99	bool "PPP"
100	help
101	  Connect to host via PPP.
102
103config NET_QEMU_ETHERNET
104	bool "Ethernet"
105	help
106	  Connect to host system via Qemu ethernet driver support. One such
107	  driver that Zephyr supports is Intel e1000 ethernet driver.
108
109config NET_QEMU_USER
110	bool "SLIRP"
111	help
112	  Connect to host system via Qemu's built-in User Networking support. This
113	  is implemented using "slirp", which provides a full TCP/IP stack within
114	  QEMU and uses that stack to implement a virtual NAT'd network.
115
116endchoice
117
118config NET_QEMU_USER_EXTRA_ARGS
119	string "Qemu User Networking Args"
120	depends on NET_QEMU_USER
121	default ""
122	help
123	  Extra arguments passed to QEMU when User Networking is enabled. This may
124	  include host / guest port forwarding, device id, Network address
125	  information etc. This string is appended to the QEMU "-net user" option.
126
127config NET_INIT_PRIO
128	int
129	default 90
130	help
131	  Network initialization priority level. This number tells how
132	  early in the boot the network stack is initialized.
133
134config NET_IP_DSCP_ECN
135	bool "DSCP/ECN processing at IP layer"
136	depends on NET_IP
137	default y
138	help
139	  Specify whether DSCP/ECN values are processed at IP layer. The values
140	  are encoded within ToS field in IPv4 and TC field in IPv6.
141
142source "subsys/net/ip/Kconfig.ipv6"
143
144source "subsys/net/ip/Kconfig.ipv4"
145
146config NET_SHELL
147	bool "Network shell utilities"
148	select SHELL
149	help
150	  Activate shell module that provides network commands like
151	  ping to the console.
152
153config NET_SHELL_DYN_CMD_COMPLETION
154	bool "Network shell dynamic command completion"
155	depends on NET_SHELL
156	default y
157	help
158	  Enable various net-shell command to support dynamic command
159	  completion. This means that for example the nbr command can
160	  automatically complete the neighboring IPv6 address and user
161	  does not need to type it manually.
162	  Please note that this uses more memory in order to save the
163	  dynamic command strings. For example for nbr command the
164	  increase is 320 bytes (8 neighbors * 40 bytes for IPv6 address
165	  length) by default. Other dynamic completion commands in
166	  net-shell require also some smaller amount of memory.
167
168config NET_TC_TX_COUNT
169	int "How many Tx traffic classes to have for each network device"
170	default 1 if USERSPACE || USB_DEVICE_NETWORK
171	default 0
172	range 1 NET_TC_NUM_PRIORITIES if NET_TC_NUM_PRIORITIES<=8 && USERSPACE
173	range 0 NET_TC_NUM_PRIORITIES if NET_TC_NUM_PRIORITIES<=8
174	range 1 8 if USERSPACE
175	range 0 8
176	help
177	  Define how many Tx traffic classes (queues) the system should have
178	  when sending a network packet. The network packet priority can then
179	  be mapped to this traffic class so that higher prioritized packets
180	  can be processed before lower prioritized ones. Each queue is handled
181	  by a separate thread which will need RAM for stack space.
182	  Only increase the value from 1 if you really need this feature.
183	  The default value is 1 which means that all the network traffic is
184	  handled equally. In this implementation, the higher traffic class
185	  value corresponds to lower thread priority.
186	  If you select 0 here, then it means that all the network traffic
187	  is pushed to the driver directly without any queues.
188	  Note that if USERSPACE support is enabled, then currently we need to
189	  enable at least 1 TX thread.
190
191config NET_TC_RX_COUNT
192	int "How many Rx traffic classes to have for each network device"
193	default 1
194	range 1 NET_TC_NUM_PRIORITIES if NET_TC_NUM_PRIORITIES<=8 && USERSPACE
195	range 0 NET_TC_NUM_PRIORITIES if NET_TC_NUM_PRIORITIES<=8
196	range 1 8 if USERSPACE
197	range 0 8
198	help
199	  Define how many Rx traffic classes (queues) the system should have
200	  when receiving a network packet. The network packet priority can then
201	  be mapped to this traffic class so that higher prioritized packets
202	  can be processed before lower prioritized ones. Each queue is handled
203	  by a separate thread which will need RAM for stack space.
204	  Only increase the value from 1 if you really need this feature.
205	  The default value is 1 which means that all the network traffic is
206	  handled equally. In this implementation, the higher traffic class
207	  value corresponds to lower thread priority.
208	  If you select 0 here, then it means that all the network traffic
209	  is pushed from the driver to application thread without any
210	  intermediate RX queue. There is always a receive socket queue between
211	  device driver and application. Disabling RX thread means that the
212	  network device driver, that is typically running in IRQ context, will
213	  handle the packet all the way to the application. This might cause
214	  other incoming packets to be lost if the RX processing takes long
215	  time.
216	  Note that if USERSPACE support is enabled, then currently we need to
217	  enable at least 1 RX thread.
218
219config NET_TC_SKIP_FOR_HIGH_PRIO
220	bool "Push high priority packets directly to network driver"
221	help
222	  If this is set, then high priority (NET_PRIORITY_CA) net_pkt will be
223	  pushed directly to network driver and will skip the traffic class
224	  queues. This is currently not enabled by default.
225
226choice NET_TC_THREAD_TYPE
227	prompt "How the network RX/TX threads should work"
228	help
229	  Please select the RX/TX threads to be either pre-emptive or
230	  co-operative.
231
232config NET_TC_THREAD_COOPERATIVE
233	bool "Use co-operative TX/RX threads"
234	depends on COOP_ENABLED
235	help
236	  With co-operative threads, the thread cannot be pre-empted.
237
238config NET_TC_THREAD_PREEMPTIVE
239	bool "Use pre-emptive TX/RX threads [EXPERIMENTAL]"
240	depends on PREEMPT_ENABLED
241	select EXPERIMENTAL
242	help
243	  With pre-emptive threads, the thread can be pre-empted.
244
245endchoice
246
247config NET_TC_NUM_PRIORITIES
248	int
249	default NUM_COOP_PRIORITIES if NET_TC_THREAD_COOPERATIVE
250	default NUM_PREEMPT_PRIORITIES if NET_TC_THREAD_PREEMPTIVE
251
252choice
253	prompt "Priority to traffic class mapping"
254	help
255	  Select mapping to use to map network packet priorities to traffic
256	  classes.
257
258config NET_TC_MAPPING_STRICT
259	bool "Strict priority mapping"
260	help
261	  This is the recommended default priority to traffic class mapping.
262	  Use it for implementations that do not support the credit-based
263	  shaper transmission selection algorithm.
264	  See 802.1Q, chapter 8.6.6 for more information.
265
266config NET_TC_MAPPING_SR_CLASS_A_AND_B
267	bool "SR class A and class B mapping"
268	depends on NET_TC_TX_COUNT >= 2
269	depends on NET_TC_RX_COUNT >= 2
270	help
271	  This is the recommended priority to traffic class mapping for a
272	  system that supports SR (Stream Reservation) class A and SR class B.
273	  See 802.1Q, chapter 34.5 for more information.
274
275config NET_TC_MAPPING_SR_CLASS_B_ONLY
276	bool "SR class B only mapping"
277	depends on NET_TC_TX_COUNT >= 2
278	depends on NET_TC_RX_COUNT >= 2
279	help
280	  This is the recommended priority to traffic class mapping for a
281	  system that supports SR (Stream Reservation) class B only.
282	  See 802.1Q, chapter 34.5 for more information.
283endchoice
284
285config NET_TX_DEFAULT_PRIORITY
286	int "Default network TX packet priority if none have been set"
287	default 1
288	range 0 7
289	help
290	  What is the default network packet priority if user has not specified
291	  one. The value 0 means lowest priority and 7 is the highest.
292
293config NET_RX_DEFAULT_PRIORITY
294	int "Default network RX packet priority if none have been set"
295	default 0
296	range 0 7
297	help
298	  What is the default network RX packet priority if user has not set
299	  one. The value 0 means lowest priority and 7 is the highest.
300
301config NET_ALLOW_ANY_PRIORITY
302	bool "Allow any network packet priority to be used"
303	help
304	  If this is set, then any user given network packet priority can be used. Otherwise
305	  the network packet priorities are limited to 0-7 range.
306
307config NET_IP_ADDR_CHECK
308	bool "Check IP address validity before sending IP packet"
309	default y
310	help
311	  Check that either the source or destination address is
312	  correct before sending either IPv4 or IPv6 network packet.
313
314config NET_MAX_ROUTERS
315	int "How many routers are supported"
316	default 2 if NET_IPV4 && NET_IPV6
317	default 1 if NET_IPV4 && !NET_IPV6
318	default 1 if !NET_IPV4 && NET_IPV6
319	range 1 254
320	help
321	  The value depends on your network needs.
322
323# Normally the route support is enabled by RPL or similar technology
324# that needs to use the routing infrastructure.
325config NET_ROUTE
326	bool
327	depends on NET_IPV6_NBR_CACHE
328	default y if NET_IPV6_NBR_CACHE
329
330# Temporarily hide the routing option as we do not have RPL in the system
331# that used to populate the routing table.
332config NET_ROUTING
333	bool
334	depends on NET_ROUTE
335	help
336	  Allow IPv6 routing between different network interfaces and
337	  technologies. Currently this has limited use as some entity
338	  would need to populate the routing table. RPL used to do that
339	  earlier but currently there is no RPL support in Zephyr.
340
341config NET_MAX_ROUTES
342	int "Max number of routing entries stored."
343	default NET_IPV6_MAX_NEIGHBORS
344	depends on NET_ROUTE
345	help
346	  This determines how many entries can be stored in routing table.
347
348config NET_MAX_NEXTHOPS
349	int "Max number of next hop entries stored."
350	default NET_MAX_ROUTES
351	depends on NET_ROUTE
352	help
353	  This determines how many entries can be stored in nexthop table.
354
355config NET_ROUTE_MCAST
356	bool "Multicast Routing / Forwarding"
357	depends on NET_ROUTE
358	help
359	  Activates multicast routing/forwarding
360
361config NET_MAX_MCAST_ROUTES
362	int "Max number of multicast routing entries stored."
363	default 1
364	depends on NET_ROUTE_MCAST
365	help
366	  This determines how many entries can be stored in multicast
367	  routing table.
368
369config NET_TCP
370	bool "TCP"
371	depends on NET_IP
372	help
373	  The value depends on your network needs.
374
375config NET_TCP_CHECKSUM
376	bool "Check TCP checksum"
377	default y
378	depends on NET_TCP
379	help
380	  Enables TCP handler to check TCP checksum. If the checksum is invalid,
381	  then the packet is discarded.
382
383if NET_TCP
384module = NET_TCP
385module-dep = NET_LOG
386module-str = Log level for TCP
387module-help = Enables TCP handler output debug messages
388source "subsys/net/Kconfig.template.log_config.net"
389endif # NET_TCP
390
391config NET_TCP_TIME_WAIT_DELAY
392	int "How long to wait in TIME_WAIT state (in milliseconds)"
393	depends on NET_TCP
394	default 1500
395	help
396	  To avoid a (low-probability) issue when delayed packets from
397	  previous connection get delivered to next connection reusing
398	  the same local/remote ports, RFC 793 (TCP) suggests to keep
399	  an old, closed connection in a special "TIME_WAIT" state for
400	  the duration of 2*MSL (Maximum Segment Lifetime). The RFC
401	  suggests to use MSL of 2 minutes, but notes "This is an
402	  engineering choice, and may be changed if experience indicates
403	  it is desirable to do so." For low-resource systems, having
404	  large MSL may lead to quick resource exhaustion (and related
405	  DoS attacks). At the same time, the issue of packet misdelivery
406	  is largely alleviated in the modern TCP stacks by using random,
407	  non-repeating port numbers and initial sequence numbers. Due
408	  to this, Zephyr uses much lower value of 1500ms by default.
409	  Value of 0 disables TIME_WAIT state completely.
410
411config NET_TCP_ACK_TIMEOUT
412	int "How long to wait for ACK (in milliseconds)"
413	depends on NET_TCP
414	default 1000
415	range 1 2147483647
416	help
417	  This value affects the timeout when waiting ACK to arrive in
418	  various TCP states. The value is in milliseconds. Note that
419	  having a very low value here could prevent connectivity.
420
421config NET_TCP_INIT_RETRANSMISSION_TIMEOUT
422	int "Initial value of Retransmission Timeout (RTO) (in milliseconds)"
423	depends on NET_TCP
424	default 200
425	range 100 60000
426	help
427	  This value affects the timeout between initial retransmission
428	  of TCP data packets. The value is in milliseconds.
429
430config NET_TCP_RETRY_COUNT
431	int "Maximum number of TCP segment retransmissions"
432	depends on NET_TCP
433	default 9
434	help
435	  The following formula can be used to determine the time (in ms)
436	  that a segment will be be buffered awaiting retransmission:
437	  n=NET_TCP_RETRY_COUNT
438	  Sum((1<<n) * NET_TCP_INIT_RETRANSMISSION_TIMEOUT)
439	  n=0
440	  With the default value of 9, the IP stack will try to
441	  retransmit for up to 1:42 minutes.  This is as close as possible
442	  to the minimum value recommended by RFC1122 (1:40 minutes).
443	  Only 5 bits are dedicated for the retransmission count, so accepted
444	  values are in the 0-31 range.  It's highly recommended to not go
445	  below 9, though.
446	  Should a retransmission timeout occur, the receive callback is
447	  called with -ECONNRESET error code and the context is dereferenced.
448
449config NET_TCP_RANDOMIZED_RTO
450	bool "Use a randomized retransmission time"
451	default y
452	depends on NET_TCP
453	help
454	  It can happen that two similar stacks enter a retransmission cycle
455	  due to a packet collision. If the transmission timeout is the same
456	  both stacks will retry at the same moment resulting in another
457	  collision. By introducing a randomized retry timeout, the chance of
458	  a second collision is reduced and it reduces furter the more
459	  retransmissions occur.
460
461config NET_TCP_FAST_RETRANSMIT
462	bool "Fast-retry algorithm based on the number of duplicated ACKs"
463	depends on NET_TCP
464	default y
465	help
466	  When a packet is lost, the receiver will keep acknowledging the
467	  sequence number of the last correctly received byte. Upon reception
468	  of a sequence of acknowledgements for the same sequence number,
469	  this can be deduced as that the packet afterwards must have been lost.
470	  In that case a retransmission is triggerd to avoid having to wait for
471	  the retransmit timer to elapse.
472
473config NET_TCP_CONGESTION_AVOIDANCE
474	bool "Implement a congestion avoidance algorithm in TCP"
475	depends on NET_TCP
476	default y
477	help
478	  To avoid overstressing a link reduce the transmission rate as soon as
479	  packets are starting to drop.
480
481config NET_TCP_MAX_SEND_WINDOW_SIZE
482	int "Maximum sending window size to use"
483	depends on NET_TCP
484	default 0
485	range 0 65535
486	help
487	  This value affects how the TCP selects the maximum sending window
488	  size. The default value 0 lets the TCP stack select the value
489	  according to amount of network buffers configured in the system.
490
491config NET_TCP_MAX_RECV_WINDOW_SIZE
492	int "Maximum receive window size to use"
493	depends on NET_TCP
494	default 0
495	range 0 65535
496	help
497	  This value defines the maximum TCP receive window size. Increasing
498	  this value can improve connection throughput, but requires more
499	  receive buffers available in the system for efficient operation.
500	  The default value 0 lets the TCP stack select the value
501	  according to amount of network buffers configured in the system.
502
503config NET_TCP_RECV_QUEUE_TIMEOUT
504	int "How long to queue received data (in ms)"
505	depends on NET_TCP
506	default 2000
507	range 0 10000
508	help
509	  If we receive out-of-order TCP data, we queue it. This value tells
510	  how long the data is kept before it is discarded if we have not been
511	  able to pass the data to the application. If set to 0, then receive
512	  queueing is not enabled. The value is in milliseconds.
513	  Note that we only queue data sequentially in current version i.e.,
514	  there should be no holes in the queue. For example, if we receive
515	  SEQs 5,4,3,6 and are waiting SEQ 2, the data in segments 3,4,5,6 is
516	  queued (in this order), and then given to application when we receive
517	  SEQ 2. But if we receive SEQs 5,4,3,7 then the SEQ 7 is discarded
518	  because the list would not be sequential as number 6 is be missing.
519
520config NET_TCP_PKT_ALLOC_TIMEOUT
521	int "How long to wait for a TCP packet allocation (in ms)"
522	depends on NET_TCP
523	default 100
524	range 10 1000
525	help
526	  The TCP network stack allocates packets from the buffers and the
527	  allocation can take some time depending on the situation.
528	  This value indicates how long the stack should wait for the packet to
529	  be allocated, before returning an internal error and trying again.
530
531config NET_TCP_WORKQ_STACK_SIZE
532	int "TCP work queue thread stack size"
533	default 1200 if X86
534	default 1024
535	depends on NET_TCP
536	help
537	  Set the TCP work queue thread stack size in bytes.
538
539config NET_TCP_ISN_RFC6528
540	bool "Use ISN algorithm from RFC 6528"
541	default y
542	depends on NET_TCP
543	select MBEDTLS
544	select MBEDTLS_MD
545	select MBEDTLS_MAC_MD5_ENABLED
546	help
547	  Implement Initial Sequence Number calculation as described in
548	  RFC 6528 chapter 3. https://tools.ietf.org/html/rfc6528
549	  If this is not set, then sys_rand32_get() is used for ISN value.
550
551config NET_TCP_WORKER_PRIO
552	int "Priority of the TCP work queue"
553	default 2
554	depends on NET_TCP
555	help
556	  Set the priority of the the TCP worker queue, that handles all
557	  transmission and maintenance within the TCP stack.
558	  Value 0 = highest priortity.
559	  When CONFIG_NET_TC_THREAD_COOPERATIVE = y, lowest priority is
560	  CONFIG_NUM_COOP_PRIORITIES-1 else lowest priority is
561	  CONFIG_NUM_PREEMPT_PRIORITIES-1.
562	  Make sure the priority is lower than lower layer TX threads to
563	  avoid the TCP stack consume all net_bufs before transferring
564	  execution to the lower layer network stack, with a high risk of
565	  running out of net_bufs.
566
567config NET_TEST_PROTOCOL
568	bool "JSON based test protocol (UDP)"
569	help
570	  Enable JSON based test protocol (UDP).
571
572config NET_UDP
573	bool "UDP"
574	default y
575	depends on NET_IP
576	help
577	  The value depends on your network needs.
578
579config NET_UDP_CHECKSUM
580	bool "Check UDP checksum"
581	default y
582	depends on NET_UDP
583	help
584	  Enables UDP handler to check UDP checksum. If the checksum is invalid,
585	  then the packet is discarded.
586
587config NET_UDP_MISSING_CHECKSUM
588	bool "Accept missing checksum (IPv4 only)"
589	default y
590	depends on NET_UDP && NET_IPV4
591	help
592	  RFC 768 states the possibility to have a missing checksum, for
593	  debugging purposes for instance. That feature is however valid only
594	  for IPv4 and on reception only, since Zephyr will always compute the
595	  UDP checksum in transmission path.
596
597if NET_UDP
598module = NET_UDP
599module-dep = NET_LOG
600module-str = Log level for UDP
601module-help = Enables UDP handler output debug messages
602source "subsys/net/Kconfig.template.log_config.net"
603endif # NET_UDP
604
605config NET_MAX_CONN
606	int "How many network connections are supported"
607	depends on NET_UDP || NET_TCP || NET_SOCKETS_PACKET || NET_SOCKETS_CAN
608	default 8 if NET_IPV6 && NET_IPV4
609	default 4
610	help
611	  The value depends on your network needs. The value
612	  should include both UDP and TCP connections.
613
614config NET_MAX_CONTEXTS
615	int "Number of network contexts to allocate"
616	default 6
617	help
618	  Each network context is used to describe a network 5-tuple that
619	  is used when listening or sending network traffic. This is very
620	  similar as one could call a network socket in some other systems.
621
622config NET_CONTEXT_NET_PKT_POOL
623	bool "Net_buf TX pool / context"
624	default y if NET_TCP && NET_6LO
625	help
626	  If enabled, then it is possible to fine-tune network packet pool
627	  for each context when sending network data. If this setting is
628	  enabled, then you should define the context pools in your application
629	  using NET_PKT_TX_POOL_DEFINE() and NET_PKT_DATA_POOL_DEFINE()
630	  macros and tie these pools to desired context using the
631	  net_context_setup_pools() function.
632
633config NET_CONTEXT_SYNC_RECV
634	bool "Support synchronous functionality in net_context_recv() API"
635	default y
636	help
637	  You can disable sync support to save some memory if you are calling
638	  net_context_recv() in async way only when timeout is set to 0.
639
640config NET_CONTEXT_CHECK
641	bool "Check options when calling various net_context functions"
642	default y
643	help
644	  If you know that the options passed to net_context...() functions
645	  are ok, then you can disable the checks to save some memory.
646
647config NET_CONTEXT_PRIORITY
648	bool "Add priority support to net_context"
649	help
650	  It is possible to prioritize network traffic. This requires
651	  also traffic class support to work as expected.
652
653config NET_CONTEXT_TXTIME
654	bool "Add TXTIME support to net_context"
655	select NET_PKT_TXTIME
656	help
657	  It is possible to add information when the outgoing network packet
658	  should be sent. The TX time information should be placed into
659	  ancillary data field in sendmsg call.
660
661config NET_CONTEXT_RCVTIMEO
662	bool "Add RCVTIMEO support to net_context"
663	help
664	  It is possible to time out receiving a network packet. The timeout
665	  time is configurable run-time in the application code. For network
666	  sockets timeout is configured per socket with
667	  setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, ...) function.
668
669config NET_CONTEXT_SNDTIMEO
670	bool "Add SNDTIMEO support to net_context"
671	help
672	  It is possible to time out sending a network packet. The timeout
673	  time is configurable run-time in the application code. For network
674	  sockets timeout is configured per socket with
675	  setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, ...) function.
676
677config NET_CONTEXT_RCVBUF
678	bool "Add RCVBUF support to net_context"
679	help
680	  If is possible to define the maximum socket receive buffer per socket.
681	  The default value is set by CONFIG_NET_TCP_MAX_RECV_WINDOW_SIZE. For
682	  TCP sockets, the rcvbuf will determine the receive window size.
683
684config NET_CONTEXT_SNDBUF
685	bool "Add SNDBUF support to net_context"
686	help
687	  It is possible to define the maximum socket send buffer per socket.
688	  For TCP sockets, the sndbuf will determine the total size of queued
689	  data in the TCP layer.
690
691config NET_CONTEXT_DSCP_ECN
692	bool "Add support for setting DSCP/ECN IP properties on net_context"
693	depends on NET_IP_DSCP_ECN
694	default y
695	help
696	  Allow to set Differentiated Services and Explicit Congestion
697	  Notification values on net_context. Those values are then used in
698	  IPv4/IPv6 header when sending packets over net_context.
699
700config NET_CONTEXT_REUSEADDR
701	bool "Add REUSEADDR support to net_context"
702	default y if NET_TCP || NET_UDP
703	help
704	  Allow to set the SO_REUSEADDR flag on a socket. This enables multiple
705	  sockets to bind to the same local IP address.
706
707config NET_CONTEXT_REUSEPORT
708	bool "Add REUSEPORT support to net_context"
709	default y if NET_TCP || NET_UDP
710	help
711	  Allow to set the SO_REUSEPORT flag on a socket. This enables multiple
712	  sockets to bind to the same local IP address and port combination.
713
714config NET_TEST
715	bool "Network Testing"
716	help
717	  Used for self-contained networking tests that do not require a
718	  network device.
719
720config NET_SLIP_TAP
721	bool "TAP SLIP driver"
722	depends on NET_QEMU_SLIP
723	depends on NET_NATIVE
724	select SLIP
725	select UART_PIPE
726	select UART_INTERRUPT_DRIVEN
727	select SLIP_TAP
728	default y if (QEMU_TARGET && !NET_TEST && !NET_L2_BT)
729	help
730	  SLIP TAP support is necessary when testing with QEMU. The host
731	  needs to have tunslip6 with TAP support running in order to
732	  communicate via the SLIP driver. See net-tools project at
733	  https://github.com/zephyrproject-rtos/net-tools for more details.
734
735config NET_TRICKLE
736	bool "Trickle library"
737	help
738	  Normally this is enabled automatically if needed,
739	  so say 'n' if unsure.
740
741if NET_TRICKLE
742module = NET_TRICKLE
743module-dep = NET_LOG
744module-str = Log level for Trickle algorithm
745module-help = Enables Trickle library output debug messages
746source "subsys/net/Kconfig.template.log_config.net"
747endif # NET_TRICKLE
748
749endif # NET_RAW_MODE
750
751config NET_PKT_RX_COUNT
752	int "How many packet receives can be pending at the same time"
753	default 14 if NET_L2_ETHERNET
754	default 4
755	help
756	  Each RX buffer will occupy smallish amount of memory.
757	  See include/net/net_pkt.h and the sizeof(struct net_pkt)
758
759config NET_PKT_TX_COUNT
760	int "How many packet sends can be pending at the same time"
761	default 14 if NET_L2_ETHERNET
762	default 4
763	help
764	  Each TX buffer will occupy smallish amount of memory.
765	  See include/net/net_pkt.h and the sizeof(struct net_pkt)
766
767config NET_BUF_RX_COUNT
768	int "How many network buffers are allocated for receiving data"
769	default 36 if NET_L2_ETHERNET
770	default 16
771	help
772	  Each data buffer will occupy CONFIG_NET_BUF_DATA_SIZE + smallish
773	  header (sizeof(struct net_buf)) amount of data.
774
775config NET_BUF_TX_COUNT
776	int "How many network buffers are allocated for sending data"
777	default 36 if NET_L2_ETHERNET
778	default 16
779	help
780	  Each data buffer will occupy CONFIG_NET_BUF_DATA_SIZE + smallish
781	  header (sizeof(struct net_buf)) amount of data.
782
783choice
784	prompt "Network packet data allocator type"
785	default NET_BUF_FIXED_DATA_SIZE
786	help
787	  Select the memory allocator for the network buffers that hold the
788	  packet data.
789
790config NET_BUF_FIXED_DATA_SIZE
791	bool "Fixed data size buffer"
792	help
793	  Each buffer comes with a built time configured size. If runtime
794	  requested is bigger than that, it will allocate as many net_buf
795	  as necessary to reach that request.
796
797config NET_BUF_VARIABLE_DATA_SIZE
798	bool "Variable data size buffer [EXPERIMENTAL]"
799	select EXPERIMENTAL
800	help
801	  The buffer is dynamically allocated from runtime requested size.
802
803endchoice
804
805config NET_BUF_DATA_SIZE
806	int "Size of each network data fragment"
807	default 128
808	depends on NET_BUF_FIXED_DATA_SIZE
809	help
810	  This value tells what is the fixed size of each network buffer.
811
812config NET_BUF_DATA_POOL_SIZE
813	int "Size of the memory pool where buffers are allocated from"
814	default 4096 if NET_L2_ETHERNET
815	default 2048
816	depends on NET_BUF_VARIABLE_DATA_SIZE
817	help
818	  This value tell what is the size of the memory pool where each
819	  network buffer is allocated from.
820
821config NET_PKT_BUF_USER_DATA_SIZE
822	int "Size of user_data available in rx and tx network buffers"
823	default BT_CONN_TX_USER_DATA_SIZE if NET_L2_BT
824	default 4
825	range BT_CONN_TX_USER_DATA_SIZE 16 if NET_L2_BT
826	range 4 16
827	help
828	  User data size used in rx and tx network buffers.
829
830config NET_HEADERS_ALWAYS_CONTIGUOUS
831	bool
832	help
833	  This a hidden option, which one should use with a lot of care.
834	  NO bug reports will be accepted if that option is enabled!
835	  You are warned.
836	  If you are 100% sure the headers memory space is always in a
837	  contiguous space, this will save stack usage and ROM in net core.
838	  This is a possible case when using IPv4 only, with
839	  NET_BUF_FIXED_DATA_SIZE enabled and NET_BUF_DATA_SIZE of 128 for
840	  instance.
841
842choice
843	prompt "Default Network Interface"
844	default NET_DEFAULT_IF_FIRST
845	help
846	  If system has multiple interfaces enabled, then user shall be able
847	  to choose default interface. Otherwise first interface will be the
848	  default interface.
849
850config NET_DEFAULT_IF_FIRST
851	bool "First available interface"
852
853config NET_DEFAULT_IF_UP
854	bool "First interface which is up"
855
856config NET_DEFAULT_IF_ETHERNET
857	bool "Ethernet"
858	depends on NET_L2_ETHERNET
859
860config NET_DEFAULT_IF_BLUETOOTH
861	bool "Bluetooth"
862	depends on NET_L2_BT
863
864config NET_DEFAULT_IF_IEEE802154
865	bool "IEEE 802.15.4"
866	depends on NET_L2_IEEE802154
867
868config NET_DEFAULT_IF_OFFLOAD
869	bool "Offloaded interface"
870	depends on NET_OFFLOAD
871
872config NET_DEFAULT_IF_DUMMY
873	bool "Dummy testing interface"
874	depends on NET_L2_DUMMY
875
876config NET_DEFAULT_IF_CANBUS_RAW
877	bool "Socket CAN interface"
878	depends on NET_L2_CANBUS_RAW
879
880config NET_DEFAULT_IF_PPP
881	bool "PPP interface"
882	depends on NET_L2_PPP
883
884config NET_DEFAULT_IF_WIFI
885	bool "WiFi interface"
886	depends on NET_L2_ETHERNET
887
888endchoice
889
890config NET_INTERFACE_NAME
891	bool "Allow setting a name to a network interface"
892	default y
893	help
894	  Allow application to set a name to the network interface in order
895	  to simplify network interface management.
896
897config NET_INTERFACE_NAME_LEN
898	int "Network interface max name length"
899	default 8
900	range 1 15
901	depends on NET_INTERFACE_NAME
902	help
903	  Maximum length of the network interface name.
904
905config NET_PKT_TIMESTAMP
906	bool "Network packet timestamp support"
907	help
908	  Enable network packet timestamp support. This is needed for
909	  example in gPTP which needs to know how long it takes to send
910	  a network packet or for timed radio protocols like IEEE 802.15.4
911	  CSL and TSCH.
912
913config NET_PKT_TIMESTAMP_THREAD
914	bool "Create TX timestamp thread"
915	default y if NET_L2_PTP
916	depends on NET_PKT_TIMESTAMP
917	help
918	  Create a TX timestamp thread that will pass the timestamped network
919	  packets to some other module like gPTP for further processing.
920	  If you just want to timestamp network packets and get information
921	  how long the network packets flow in the system, you can disable
922	  the thread support.
923
924config NET_PKT_TIMESTAMP_STACK_SIZE
925	int "Timestamp thread stack size"
926	default 1024
927	depends on NET_PKT_TIMESTAMP_THREAD
928	help
929	  Set the timestamp thread stack size in bytes. The timestamp
930	  thread waits for timestamped TX frames and calls registered
931	  callbacks.
932
933config NET_PKT_TXTIME
934	bool "Network packet TX time support"
935	help
936	  Enable network packet TX time support. This is needed for
937	  when the application wants to set the exact time when the network
938	  packet should be sent.
939
940config NET_PKT_RXTIME_STATS
941	bool "Network packet RX time statistics"
942	select NET_PKT_TIMESTAMP
943	select NET_STATISTICS
944	depends on (NET_UDP || NET_TCP || NET_SOCKETS_PACKET) && NET_NATIVE
945	help
946	  Enable network packet RX time statistics support. This is used to
947	  calculate how long on average it takes for a packet to travel from
948	  device driver to just before it is given to application. The RX
949	  timing information can then be seen in network interface statistics
950	  in net-shell.
951	  The RX statistics are only calculated for UDP and TCP packets.
952
953config NET_PKT_RXTIME_STATS_DETAIL
954	bool "Get extra receive detail statistics in RX path"
955	depends on NET_PKT_RXTIME_STATS
956	help
957	  Store receive statistics detail information in certain key points
958	  in RX path. This is very special configuration and will increase
959	  the size of net_pkt so in typical cases you should not enable it.
960	  The extra statistics can be seen in net-shell using "net stats"
961	  command.
962
963config NET_PKT_TXTIME_STATS
964	bool "Network packet TX time statistics"
965	select NET_PKT_TIMESTAMP
966	select NET_STATISTICS
967	depends on (NET_UDP || NET_TCP || NET_SOCKETS_PACKET) && NET_NATIVE
968	help
969	  Enable network packet TX time statistics support. This is used to
970	  calculate how long on average it takes for a packet to travel from
971	  application to just before it is sent to network. The TX timing
972	  information can then be seen in network interface statistics in
973	  net-shell.
974	  The RX calculation is done only for UDP, TCP or RAW packets,
975	  but for TX we do not know the protocol so the TX packet timing is
976	  done for all network protocol packets.
977
978config NET_PKT_TXTIME_STATS_DETAIL
979	bool "Get extra transmit detail statistics in TX path"
980	depends on NET_PKT_TXTIME_STATS
981	help
982	  Store receive statistics detail information in certain key points
983	  in TX path. This is very special configuration and will increase
984	  the size of net_pkt so in typical cases you should not enable it.
985	  The extra statistics can be seen in net-shell using "net stats"
986	  command.
987
988config NET_PROMISCUOUS_MODE
989	bool "Promiscuous mode support"
990	select NET_MGMT
991	select NET_MGMT_EVENT
992	select NET_L2_ETHERNET_MGMT if NET_L2_ETHERNET
993	help
994	  Enable promiscuous mode support. This only works if the network
995	  device driver supports promiscuous mode. The user application
996	  also needs to read the promiscuous mode data.
997
998if NET_PROMISCUOUS_MODE
999module = NET_PROMISC
1000module-dep = NET_LOG
1001module-str = Log level for promiscuous mode
1002module-help = Enables promiscuous mode to output debug messages.
1003source "subsys/net/Kconfig.template.log_config.net"
1004endif # NET_PROMISCUOUS_MODE
1005
1006config NET_DISABLE_ICMP_DESTINATION_UNREACHABLE
1007	bool "Disable destination unreachable ICMP errors"
1008	help
1009	  Suppress the generation of ICMP destination unreachable errors
1010	  when ports that are not in a listening state receive packets.
1011
1012source "subsys/net/ip/Kconfig.stack"
1013
1014source "subsys/net/ip/Kconfig.mgmt"
1015
1016source "subsys/net/ip/Kconfig.stats"
1017
1018source "subsys/net/ip/Kconfig.debug"
1019
1020endmenu
1021