Skip to content

Commit 981affd

Browse files
aescolarSeppoTakalo
authored andcommitted
[nrf fromtree] drivers/ethernet/eth_native_posix: Rename to eth_native_tap
Rename this driver to eth_native_tap, including renaming all its options. The old options remain until v4.4, but as deprecated. Signed-off-by: Alberto Escolar Piedras <[email protected]> (cherry picked from commit 78f8006)
1 parent 2742e46 commit 981affd

File tree

23 files changed

+253
-180
lines changed

23 files changed

+253
-180
lines changed

boards/native/native_sim/Kconfig.defconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if NETWORKING
1717
config NET_L2_ETHERNET
1818
default y if !NET_LOOPBACK && !NET_TEST
1919

20-
config ETH_NATIVE_POSIX
20+
config ETH_NATIVE_TAP
2121
default y if NET_L2_ETHERNET && ETH_DRIVER
2222

2323
endif # NETWORKING

boards/native/native_sim/doc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ host libC (:kconfig:option:`CONFIG_EXTERNAL_LIBC`):
705705
Entropy, :ref:`Native posix entropy <nsim_per_entr>`, :kconfig:option:`CONFIG_FAKE_ENTROPY_NATIVE_POSIX`, All
706706
EEPROM, EEPROM simulator, :kconfig:option:`CONFIG_EEPROM_SIMULATOR`, All
707707
EEPROM, EEPROM emulator, :kconfig:option:`CONFIG_EEPROM_EMULATOR`, All
708-
Ethernet, :ref:`Eth native_posix <nsim_per_ethe>`, :kconfig:option:`CONFIG_ETH_NATIVE_POSIX`, All
708+
Ethernet, :ref:`Eth native_tap <nsim_per_ethe>`, :kconfig:option:`CONFIG_ETH_NATIVE_TAP`, All
709709
Flash, :ref:`Flash simulator <nsim_per_flash_simu>`, :kconfig:option:`CONFIG_FLASH_SIMULATOR`, All
710710
Flash, :ref:`Host based flash access <native_fuse_flash>`, :kconfig:option:`CONFIG_FUSE_FS_ACCESS`, Host libC
711711
GPIO, GPIO emulator, :kconfig:option:`CONFIG_GPIO_EMUL`, All

doc/connectivity/networking/eth_bridge_native_sim_setup.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Then create a sample and enable Ethernet bridging support. In this example we cr
6161
-DCONFIG_NATIVE_UART_AUTOATTACH_DEFAULT_CMD="\"gnome-terminal -- screen %s\"" \
6262
-DCONFIG_NET_ETHERNET_BRIDGE=y \
6363
-DCONFIG_NET_ETHERNET_BRIDGE_SHELL=y \
64-
-DCONFIG_ETH_NATIVE_POSIX_INTERFACE_COUNT=2 \
64+
-DCONFIG_ETH_NATIVE_TAP_INTERFACE_COUNT=2 \
6565
-DCONFIG_NET_IF_MAX_IPV6_COUNT=2 \
6666
-DCONFIG_NET_IF_MAX_IPV4_COUNT=2
6767
../build/echo-server/zephyr/zephyr.exe -attach_uart

doc/connectivity/networking/native_sim_setup.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ Setting interface name from command line
149149
****************************************
150150

151151
By default the Ethernet interface name used by native_sim is determined by
152-
:kconfig:option:`CONFIG_ETH_NATIVE_POSIX_DRV_NAME`, but is also possible
152+
:kconfig:option:`CONFIG_ETH_NATIVE_TAP_DRV_NAME`, but is also possible
153153
to set it from the command line using ``--eth-if=<interface_name>``.
154154
This can be useful if the application has to be
155155
run in multiple instances and recompiling it for each instance would be

doc/connectivity/networking/networking_with_multiple_instances.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ or if you want to use native_sim board, type this:
153153
-DCONFIG_NET_CONFIG_MY_IPV6_ADDR=\"2001:db8:100::1\" \
154154
-DCONFIG_NET_CONFIG_PEER_IPV6_ADDR=\"2001:db8:200::1\" \
155155
-DCONFIG_NET_CONFIG_MY_IPV4_GW=\"203.0.113.1\" \
156-
-DCONFIG_ETH_NATIVE_POSIX_DRV_NAME=\"zeth.1\" \
157-
-DCONFIG_ETH_NATIVE_POSIX_MAC_ADDR=\"00:00:5e:00:53:01\" \
158-
-DCONFIG_ETH_NATIVE_POSIX_RANDOM_MAC=n
156+
-DCONFIG_ETH_NATIVE_TAP_DRV_NAME=\"zeth.1\" \
157+
-DCONFIG_ETH_NATIVE_TAP_MAC_ADDR=\"00:00:5e:00:53:01\" \
158+
-DCONFIG_ETH_NATIVE_TAP_RANDOM_MAC=n
159159
160160
161161
In terminal #5, if you are using QEMU, type this:
@@ -184,9 +184,9 @@ or if you want to use native_sim board, type this:
184184
-DCONFIG_NET_CONFIG_MY_IPV6_ADDR=\"2001:db8:200::1\" \
185185
-DCONFIG_NET_CONFIG_PEER_IPV6_ADDR=\"2001:db8:100::1\" \
186186
-DCONFIG_NET_CONFIG_MY_IPV4_GW=\"198.51.100.1\" \
187-
-DCONFIG_ETH_NATIVE_POSIX_DRV_NAME=\"zeth.2\" \
188-
-DCONFIG_ETH_NATIVE_POSIX_MAC_ADDR=\"00:00:5e:00:53:02\" \
189-
-DCONFIG_ETH_NATIVE_POSIX_RANDOM_MAC=n
187+
-DCONFIG_ETH_NATIVE_TAP_DRV_NAME=\"zeth.2\" \
188+
-DCONFIG_ETH_NATIVE_TAP_MAC_ADDR=\"00:00:5e:00:53:02\" \
189+
-DCONFIG_ETH_NATIVE_TAP_RANDOM_MAC=n
190190
191191
192192
Also if you have firewall enabled in your host, you need to allow traffic

drivers/ethernet/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,17 @@ endif()
5858
zephyr_library_sources_ifdef(CONFIG_ETH_NXP_S32_GMAC eth_nxp_s32_gmac.c)
5959
zephyr_library_sources_ifdef(CONFIG_ETH_NUMAKER eth_numaker.c)
6060

61-
if(CONFIG_ETH_NATIVE_POSIX)
61+
if(CONFIG_ETH_NATIVE_TAP)
6262
if (CONFIG_NATIVE_APPLICATION)
63-
set(native_posix_source_files eth_native_posix.c eth_native_posix_adapt.c)
64-
set_source_files_properties(${native_posix_source_files}
63+
set(native_tap_source_files eth_native_tap.c eth_native_tap_adapt.c)
64+
set_source_files_properties(${native_tap_source_files}
6565
PROPERTIES COMPILE_DEFINITIONS
6666
"NO_POSIX_CHEATS;_BSD_SOURCE;_DEFAULT_SOURCE"
6767
)
68-
zephyr_library_sources(${native_posix_source_files})
68+
zephyr_library_sources(${native_tap_source_files})
6969
else()
70-
zephyr_library_sources(eth_native_posix.c)
71-
target_sources(native_simulator INTERFACE eth_native_posix_adapt.c)
70+
zephyr_library_sources(eth_native_tap.c)
71+
target_sources(native_simulator INTERFACE eth_native_tap_adapt.c)
7272
endif()
7373
endif()
7474

drivers/ethernet/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ source "drivers/ethernet/Kconfig.sam_gmac"
5757
source "drivers/ethernet/Kconfig.stm32_hal"
5858
source "drivers/ethernet/Kconfig.dwmac"
5959
source "drivers/ethernet/Kconfig.smsc911x"
60-
source "drivers/ethernet/Kconfig.native_posix"
60+
source "drivers/ethernet/Kconfig.native_tap"
6161
source "drivers/ethernet/Kconfig.stellaris"
6262
source "drivers/ethernet/Kconfig.litex"
6363
source "drivers/ethernet/Kconfig.gecko"

drivers/ethernet/Kconfig.native_posix

Lines changed: 0 additions & 86 deletions
This file was deleted.
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# Native TAP ethernet driver configuration options
2+
3+
# Copyright (c) 2018 Intel Corporation
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
menuconfig ETH_NATIVE_TAP
7+
bool "Native TAP Ethernet driver"
8+
depends on ARCH_POSIX
9+
select ETH_NATIVE_POSIX_BACKWARDS_COMPAT_MENU
10+
help
11+
Enable native_sim TAP ethernet driver. Note, this driver is run inside
12+
a process in your host system.
13+
14+
if ETH_NATIVE_TAP
15+
16+
config ETH_NATIVE_TAP_INTERFACE_COUNT
17+
int "Number of network interfaces created"
18+
default ETH_NATIVE_POSIX_INTERFACE_COUNT
19+
range 1 32
20+
help
21+
By default only one network interface is created. It is possible
22+
to create multiple interfaces in certain use cases. For example if
23+
multiple ports are defined in gPTP or PTP, then multiple network interfaces
24+
must be created here.
25+
26+
config ETH_NATIVE_TAP_DRV_NAME
27+
string "Ethernet driver name"
28+
default ETH_NATIVE_POSIX_DRV_NAME
29+
help
30+
This option sets the driver name and name of the network interface
31+
in your host system. If there are multiple network interfaces defined,
32+
then this value is used as a prefix and the interface names will be
33+
zeth0, zeth1, etc.
34+
35+
config ETH_NATIVE_TAP_DEV_NAME
36+
string "Host ethernet TUN/TAP device name"
37+
default ETH_NATIVE_POSIX_DEV_NAME
38+
help
39+
This option sets the TUN/TAP device name in your host system.
40+
41+
config ETH_NATIVE_TAP_PTP_CLOCK
42+
bool "PTP clock driver support"
43+
default ETH_NATIVE_POSIX_PTP_CLOCK
44+
select PTP_CLOCK
45+
depends on NET_GPTP || PTP
46+
help
47+
Enable PTP clock support.
48+
49+
config ETH_NATIVE_TAP_RANDOM_MAC
50+
bool "Random MAC address"
51+
depends on ENTROPY_GENERATOR
52+
default ETH_NATIVE_POSIX_RANDOM_MAC
53+
help
54+
Generate a random MAC address dynamically.
55+
56+
config ETH_NATIVE_TAP_VLAN_TAG_STRIP
57+
bool "Strip VLAN tag from Rx frames"
58+
default ETH_NATIVE_POSIX_VLAN_TAG_STRIP
59+
depends on NET_VLAN
60+
help
61+
Native TAP ethernet driver will strip of VLAN tag from
62+
Rx Ethernet frames and sets tag information in net packet
63+
metadata.
64+
65+
config ETH_NATIVE_TAP_MAC_ADDR
66+
string "MAC address for the interface"
67+
default ETH_NATIVE_POSIX_MAC_ADDR
68+
depends on !ETH_NATIVE_TAP_RANDOM_MAC
69+
help
70+
Specify a MAC address for the ethernet interface in the form of
71+
six hex 8-bit chars separated by colons (e.g.:
72+
aa:33:cc:22:e2:c0). The default is an empty string, which
73+
means the code will make 00:00:5E:00:53:XX, where XX will be
74+
random.
75+
76+
config ETH_NATIVE_TAP_RX_TIMEOUT
77+
int "Ethernet RX timeout"
78+
default ETH_NATIVE_POSIX_RX_TIMEOUT
79+
range 1 100
80+
help
81+
Native TAP ethernet driver repeatedly checks for new data.
82+
Specify how long the thread sleeps between these checks if no new data
83+
available.
84+
85+
endif # ETH_NATIVE_TAP
86+
87+
88+
config ETH_NATIVE_POSIX
89+
bool "Native POSIX Ethernet driver (deprecated)"
90+
depends on ARCH_POSIX
91+
select DEPRECATED
92+
select ETH_NATIVE_TAP
93+
select ETH_NATIVE_POSIX_BACKWARDS_COMPAT_MENU
94+
help
95+
Deprecated, use ETH_NATIVE_TAP instead
96+
97+
menuconfig ETH_NATIVE_POSIX_BACKWARDS_COMPAT_MENU
98+
bool "Native POSIX Ethernet driver options (deprecated)"
99+
depends on ARCH_POSIX
100+
101+
if ETH_NATIVE_POSIX_BACKWARDS_COMPAT_MENU
102+
103+
config ETH_NATIVE_POSIX_INTERFACE_COUNT
104+
int "Number of network interfaces created (deprecated)"
105+
default NET_GPTP_NUM_PORTS if NET_GPTP
106+
default PTP_NUM_PORTS if PTP
107+
default 1
108+
range 1 32
109+
help
110+
Deprecated, use ETH_NATIVE_TAP_INTERFACE_COUNT instead
111+
112+
config ETH_NATIVE_POSIX_DRV_NAME
113+
string "Ethernet driver name (deprecated)"
114+
default "zeth"
115+
help
116+
Deprecated, use ETH_NATIVE_TAP_DRV_NAME instead
117+
118+
config ETH_NATIVE_POSIX_DEV_NAME
119+
string "Host ethernet TUN/TAP device name (deprecated)"
120+
default "/dev/net/tun"
121+
help
122+
Deprecated, use ETH_NATIVE_TAP_DEV_NAME instead
123+
124+
config ETH_NATIVE_POSIX_PTP_CLOCK
125+
bool "PTP clock driver support (deprecated)"
126+
default y if NET_GPTP || PTP
127+
depends on NET_GPTP || PTP
128+
help
129+
Deprecated, use ETH_NATIVE_TAP_PTP_CLOCK instead
130+
131+
config ETH_NATIVE_POSIX_RANDOM_MAC
132+
bool "Random MAC address (deprecated)"
133+
depends on ENTROPY_GENERATOR
134+
default y
135+
help
136+
Deprecated, use ETH_NATIVE_TAP_RANDOM_MAC instead
137+
138+
config ETH_NATIVE_POSIX_VLAN_TAG_STRIP
139+
bool "Strip VLAN tag from Rx frames (deprecated)"
140+
depends on NET_VLAN
141+
help
142+
Deprecated, use ETH_NATIVE_TAP_VLAN_TAG_STRIP instead
143+
144+
config ETH_NATIVE_POSIX_MAC_ADDR
145+
string "MAC address for the interface (deprecated)"
146+
default ""
147+
depends on !ETH_NATIVE_POSIX_RANDOM_MAC
148+
help
149+
Deprecated, use ETH_NATIVE_TAP_MAC_ADDR instead
150+
151+
config ETH_NATIVE_POSIX_RX_TIMEOUT
152+
int "Ethernet RX timeout (deprecated)"
153+
default 1 if NET_GPTP
154+
default 50
155+
range 1 100
156+
help
157+
Deprecated, use ETH_NATIVE_TAP_DEV_NAME instead
158+
159+
endif # ETH_NATIVE_POSIX_BACKWARDS_COMPAT

0 commit comments

Comments
 (0)