1# Native posix ethernet driver configuration options
2
3# Copyright (c) 2018 Intel Corporation
4# SPDX-License-Identifier: Apache-2.0
5
6menuconfig ETH_NATIVE_POSIX
7	bool "Native Posix Ethernet driver"
8	depends on ARCH_POSIX && EXTERNAL_LIBC
9	help
10	  Enable native posix ethernet driver. Note, this driver is run inside
11	  a process in your host system.
12
13if ETH_NATIVE_POSIX
14config ETH_NATIVE_POSIX_STARTUP_AUTOMATIC
15	bool "Start network interface automatically"
16	help
17	  If set, the native_posix ethernet driver will set up the network
18	  interface, requiring ``zephyr.exe`` to be run with root privileges
19	  (needed to create and configure the TAP device).
20	  If not set (the default and recommended way), the network interface
21	  must be set up manually using ``net-setup.sh`` (from the net-tools
22	  project repo). The ``zephyr.exe`` program can then be run as a
23	  non-root user.
24
25if ETH_NATIVE_POSIX_STARTUP_AUTOMATIC
26
27config ETH_NATIVE_POSIX_SETUP_SCRIPT
28	string "Host setup script"
29	default "${ZEPHYR_BASE}/samples/net/eth_native_posix/net_setup_host"
30	help
31	  This option sets the name of the script that is run when the host TAP
32	  network interface is created. The script should setup IP addresses
33	  etc. for the host TAP network interface.
34	  The default script accepts following options:
35	  -i|--interface <network interface name>, default is zeth
36	  -f|--file <config file name>, default is net_setup_host.conf
37	  If needed, you can add these options to this script name option.
38	  Note that the driver will add -i option with the value of
39	  CONFIG_ETH_NATIVE_POSIX_DRV_NAME option to the end of the options
40	  list when calling the host setup script.
41
42config ETH_NATIVE_POSIX_STARTUP_SCRIPT
43	string "Host startup script"
44	default ""
45	help
46	  This option sets the name of the script that is run when the host TAP
47	  network interface is created and setup script has been run.
48	  The startup script could launch e.g., wireshark to capture
49	  the network traffic for the freshly started network interface.
50	  Note that the network interface name CONFIG_ETH_NATIVE_POSIX_DRV_NAME
51	  is appended at the end of this startup script name.
52	  Example script for starting wireshark is provided in
53	  ${ZEPHYR_BASE}/samples/net/eth_native_posix/net_start_wireshark.sh
54	  file.
55
56config ETH_NATIVE_POSIX_STARTUP_SCRIPT_USER
57	string "Username to run the host startup script"
58	default ""
59	help
60	  By default the startup script is run as a root user. Set here the
61	  username to run the script if running it as a root user is not
62	  desired. Note that this setting is only for startup script and not
63	  for the setup script. The setup script needs to be run always as
64	  a root user.
65
66endif # ETH_NATIVE_POSIX_STARTUP_AUTOMATIC
67
68config ETH_NATIVE_POSIX_INTERFACE_COUNT
69	int "Number of network interfaces created"
70	default NET_GPTP_NUM_PORTS if NET_GPTP
71	default 1
72	range 1 32
73	help
74	  By default only one network interface is created. It is possible
75	  to create multiple interfaces in certain use cases. For example if
76	  multiple ports are defined in gPTP, then multiple network interfaces
77	  must be created here.
78
79config ETH_NATIVE_POSIX_DRV_NAME
80	string "Ethernet driver name"
81	default "zeth"
82	help
83	  This option sets the driver name and name of the network interface
84	  in your host system. If there are multiple network interfaces defined,
85	  then this value is used as a prefix and the interface names will be
86	  zeth0, zeth1, etc.
87
88config ETH_NATIVE_POSIX_DEV_NAME
89	string "Host ethernet TUN/TAP device name"
90	default "/dev/net/tun"
91	help
92	  This option sets the TUN/TAP device name in your host system.
93
94config ETH_NATIVE_POSIX_PTP_CLOCK
95	bool "PTP clock driver support"
96	default y if NET_GPTP
97	select PTP_CLOCK
98	depends on NET_GPTP
99	help
100	  Enable PTP clock support.
101
102config ETH_NATIVE_POSIX_RANDOM_MAC
103	bool "Random MAC address"
104	depends on ENTROPY_GENERATOR
105	default y
106	help
107	  Generate a random MAC address dynamically.
108
109config ETH_NATIVE_POSIX_VLAN_TAG_STRIP
110	bool "Strip VLAN tag from Rx frames"
111	depends on NET_VLAN
112	help
113	  Native posix ethernet driver will strip of VLAN tag from
114	  Rx Ethernet frames and sets tag information in net packet
115	  metadata.
116
117config ETH_NATIVE_POSIX_MAC_ADDR
118	string "MAC address for the interface"
119	default ""
120	depends on !ETH_NATIVE_POSIX_RANDOM_MAC
121	help
122	  Specify a MAC address for the ethernet interface in the form of
123	  six hex 8-bit chars separated by colons (e.g.:
124	  aa:33:cc:22:e2:c0).  The default is an empty string, which
125	  means the code will make 00:00:5E:00:53:XX, where XX will be
126	  random.
127
128config ETH_NATIVE_POSIX_RX_TIMEOUT
129	int "Ethernet RX timeout"
130	default 1 if NET_GPTP
131	default 50
132	range 1 100
133	help
134	  Native posix ethernet driver repeatedly checks for new data.
135	  Specify how long the thread sleeps between these checks if no new data
136	  available.
137
138endif # ETH_NATIVE_POSIX
139