Skip to content

Commit

Permalink
drivers: net: adding NET_DRIVERS menuconfig
Browse files Browse the repository at this point in the history
Fixes: #38403

Adding NET_DRIVERS menuconfig so that network drivers are grouped
together in its own menu entry under drivers, similar to most other
drivers.

This further has the advantages that `CONFIG_NET_DRIVERS` can be used
for testing to determine if network drivers has been selected.

This changed revealed a dependency loop where both `select` (for SLIP)
and `depends` (for PPP) which both depends on NET_DRIVERS` where in use
in the dependency tree for Qemu networking, especially NET_SLIP_TAP.

This is handled by defaulting `NET_DRIVERS` to `y` when building for a
Qemu target.
`SLIP` had a dependency to `!QEMU_TARGET || NET_QEMU_SLIP`. This is
changed so that SLIP prompt depends on `!QEMU_TARGET` which provides
full user control in hardware but makes the symbol promptless on Qemu
targets.

Signed-off-by: Torsten Rasmussen <[email protected]>
  • Loading branch information
tejlmand authored and github-actions[bot] committed Sep 28, 2021
1 parent cd71145 commit 85d18d4
Show file tree
Hide file tree
Showing 25 changed files with 37 additions and 5 deletions.
7 changes: 7 additions & 0 deletions boards/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ config QEMU_TARGET
Mark all QEMU targets with this variable for checking whether we are
running in an emulated environment.

config NET_DRIVERS
bool
default y if QEMU_TARGET && NETWORKING
help
When building for a qemu target then NET_DRIVERS will be default
enabled to allow for easy use of SLIP or PPP

# Note: $BOARD_DIR might be a glob pattern

choice
Expand Down
2 changes: 1 addition & 1 deletion drivers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ add_subdirectory_ifdef(CONFIG_PM_CPU_OPS pm_cpu_ops)
add_subdirectory_ifdef(CONFIG_FLASH_HAS_DRIVER_ENABLED flash)
add_subdirectory_ifdef(CONFIG_SERIAL_HAS_DRIVER serial)
add_subdirectory_ifdef(CONFIG_BT_DRIVERS bluetooth)
add_subdirectory_ifdef(CONFIG_NETWORKING net)
add_subdirectory_ifdef(CONFIG_NET_DRIVERS net)
add_subdirectory_ifdef(CONFIG_NET_L2_ETHERNET ethernet)
add_subdirectory_ifdef(CONFIG_ENTROPY_HAS_DRIVER entropy)
add_subdirectory_ifdef(CONFIG_SYS_CLOCK_EXISTS timer)
Expand Down
2 changes: 0 additions & 2 deletions drivers/ethernet/phy/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# SPDX-License-Identifier: Apache-2.0

zephyr_library()

zephyr_library_sources_ifdef(CONFIG_PHY_GENERIC_MII phy_mii.c)
10 changes: 8 additions & 2 deletions drivers/net/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Misc network drivers configuration options
# SPDX-License-Identifier: Apache-2.0

menuconfig NET_DRIVERS
bool "Network Drivers"

if NET_DRIVERS

#
# PPP options
#
Expand Down Expand Up @@ -90,8 +95,7 @@ endif # NET_PPP
# SLIP options
#
menuconfig SLIP
bool "SLIP driver"
depends on (!QEMU_TARGET || NET_QEMU_SLIP)
bool "SLIP driver" if !QEMU_TARGET
depends on NET_NATIVE
select UART_PIPE
select UART_INTERRUPT_DRIVEN
Expand Down Expand Up @@ -149,3 +153,5 @@ module-help = Sets log level for network loopback driver.
source "subsys/net/Kconfig.template.log_config.net"

endif

endif # NET_DRIVERS
1 change: 1 addition & 0 deletions samples/net/cloud/tagoio_http_post/overlay-modem.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ CONFIG_NET_CONNECTION_MANAGER=y

# PPP networking support
CONFIG_NET_NATIVE=y
CONFIG_NET_DRIVERS=y
CONFIG_NET_PPP=y
CONFIG_NET_L2_PPP=y
CONFIG_NET_L2_PPP_TIMEOUT=10000
Expand Down
1 change: 1 addition & 0 deletions samples/net/gsm_modem/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CONFIG_MODEM=y
CONFIG_MODEM_GSM_PPP=y

# PPP networking support
CONFIG_NET_DRIVERS=y
CONFIG_NET_PPP=y
CONFIG_NET_L2_PPP=y
CONFIG_NET_NATIVE=y
Expand Down
1 change: 1 addition & 0 deletions samples/net/sockets/echo_server/overlay-ppp.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONFIG_NET_DRIVERS=y
CONFIG_NET_PPP=y
CONFIG_NET_L2_PPP=y
CONFIG_NET_STATISTICS_PPP=y
Expand Down
1 change: 1 addition & 0 deletions samples/subsys/mgmt/updatehub/overlay-modem.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ CONFIG_MODEM_GSM_PPP=y
CONFIG_MODEM_GSM_APN="<Your Access Point Network>"

# PPP networking support
CONFIG_NET_DRIVERS=y
CONFIG_NET_NATIVE=y
CONFIG_NET_PPP=y
CONFIG_NET_L2_PPP=y
Expand Down
1 change: 1 addition & 0 deletions tests/drivers/build_all/modem/modem.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CONFIG_SERIAL=y
CONFIG_TEST_UART=y
CONFIG_NETWORKING=y
CONFIG_NET_IPV4=y
CONFIG_NET_DRIVERS=y
CONFIG_NET_PPP=y
CONFIG_NET_L2_PPP=y
CONFIG_MODEM=y
Expand Down
1 change: 1 addition & 0 deletions tests/net/all/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ CONFIG_NET_LLDP_TX_HOLD=2
CONFIG_NET_LLDP_TX_INTERVAL=3

# Loopback
CONFIG_NET_DRIVERS=y
CONFIG_NET_LOOPBACK_LOG_LEVEL_DBG=y
CONFIG_NET_LOOPBACK=y

Expand Down
1 change: 1 addition & 0 deletions tests/net/lib/dns_sd/prj-no-ipv6.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Networking config
CONFIG_NETWORKING=y
CONFIG_NET_TEST=y
CONFIG_NET_DRIVERS=y
CONFIG_NET_LOOPBACK=y
CONFIG_NET_IPV4=y
CONFIG_NET_IPV6=y
Expand Down
1 change: 1 addition & 0 deletions tests/net/lib/dns_sd/prj.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Networking config
CONFIG_NETWORKING=y
CONFIG_NET_TEST=y
CONFIG_NET_DRIVERS=y
CONFIG_NET_LOOPBACK=y
CONFIG_NET_IPV4=y
CONFIG_NET_IPV6=y
Expand Down
1 change: 1 addition & 0 deletions tests/net/ppp/driver/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CONFIG_NET_UDP=y
CONFIG_NET_TCP=n
CONFIG_NET_IPV4=y
CONFIG_NET_MAX_CONTEXTS=4
CONFIG_NET_DRIVERS=y
CONFIG_NET_PPP=y
CONFIG_NET_L2_PPP=y
CONFIG_NET_L2_DUMMY=n
Expand Down
1 change: 1 addition & 0 deletions tests/net/socket/getaddrinfo/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CONFIG_NEWLIB_LIBC=y
# Networking config
CONFIG_NETWORKING=y
CONFIG_NET_TEST=y
CONFIG_NET_DRIVERS=y
CONFIG_NET_LOOPBACK=y
CONFIG_NET_IPV4=y
CONFIG_NET_IPV6=y
Expand Down
1 change: 1 addition & 0 deletions tests/net/socket/getnameinfo/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CONFIG_NEWLIB_LIBC=y
# Networking config
CONFIG_NETWORKING=y
CONFIG_NET_TEST=y
CONFIG_NET_DRIVERS=y
CONFIG_NET_LOOPBACK=y
CONFIG_NET_IPV4=y
CONFIG_NET_IPV6=y
Expand Down
1 change: 1 addition & 0 deletions tests/net/socket/misc/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CONFIG_NEWLIB_LIBC=y
# Networking config
CONFIG_NETWORKING=y
CONFIG_NET_TEST=y
CONFIG_NET_DRIVERS=y
CONFIG_NET_LOOPBACK=y
CONFIG_NET_IPV4=y
CONFIG_NET_IPV6=y
Expand Down
1 change: 1 addition & 0 deletions tests/net/socket/poll/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ CONFIG_ZTEST_STACKSIZE=1280
CONFIG_ZTEST=y

CONFIG_NET_TEST=y
CONFIG_NET_DRIVERS=y
CONFIG_NET_LOOPBACK=y
1 change: 1 addition & 0 deletions tests/net/socket/register/prj.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CONFIG_ZTEST=y
CONFIG_NETWORKING=y
CONFIG_NET_TEST=y
CONFIG_NET_DRIVERS=y
CONFIG_NET_LOOPBACK=y
CONFIG_NET_IPV4=y
CONFIG_NET_IPV6=y
Expand Down
1 change: 1 addition & 0 deletions tests/net/socket/select/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CONFIG_NEWLIB_LIBC=y
# Networking config
CONFIG_NETWORKING=y
CONFIG_NET_TEST=y
CONFIG_NET_DRIVERS=y
CONFIG_NET_LOOPBACK=y
CONFIG_NET_IPV4=n
CONFIG_NET_IPV6=y
Expand Down
1 change: 1 addition & 0 deletions tests/net/socket/socketpair/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CONFIG_NEWLIB_LIBC=y
# Networking config
CONFIG_NETWORKING=y
CONFIG_NET_TEST=y
CONFIG_NET_DRIVERS=y
CONFIG_NET_LOOPBACK=y
CONFIG_NET_IPV4=y
CONFIG_NET_IPV6=y
Expand Down
1 change: 1 addition & 0 deletions tests/net/socket/tcp/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_POSIX_MAX_FDS=20

# Network driver config
CONFIG_NET_DRIVERS=y
CONFIG_NET_LOOPBACK=y
CONFIG_TEST_RANDOM_GENERATOR=y

Expand Down
1 change: 1 addition & 0 deletions tests/net/socket/tls/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ CONFIG_NET_CONTEXT_RCVTIMEO=y
CONFIG_POSIX_MAX_FDS=20

# Network driver config
CONFIG_NET_DRIVERS=y
CONFIG_NET_LOOPBACK=y
CONFIG_TEST_RANDOM_GENERATOR=y

Expand Down
1 change: 1 addition & 0 deletions tests/net/socket/tls_ext/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CONFIG_ZTEST=y
CONFIG_TEST_RANDOM_GENERATOR=y
CONFIG_NETWORKING=y
CONFIG_NET_TEST=y
CONFIG_NET_DRIVERS=y
CONFIG_NET_LOOPBACK=y
CONFIG_NET_IPV4=y
CONFIG_NET_TCP=y
Expand Down
1 change: 1 addition & 0 deletions tests/net/socket/websocket/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CONFIG_NET_IPV6=y
CONFIG_NET_TCP=y
CONFIG_NET_SHELL=y
CONFIG_NET_STATISTICS=y
CONFIG_NET_DRIVERS=y
CONFIG_NET_LOOPBACK=y

# Sockets
Expand Down
1 change: 1 addition & 0 deletions tests/net/trickle/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ CONFIG_NET_BUF_TX_COUNT=5
CONFIG_NET_TRICKLE=y
CONFIG_ZTEST=y
CONFIG_ZTEST_STACKSIZE=1024
CONFIG_NET_DRIVERS=y
CONFIG_NET_LOOPBACK=y
CONFIG_NET_IPV6_MLD=n

0 comments on commit 85d18d4

Please sign in to comment.