Skip to content

Commit

Permalink
Merge pull request #14632 from benpicco/netif_single
Browse files Browse the repository at this point in the history
gnrc_netif: replace GNRC_NETIF_SINGLE with gnrc_netif_single pseudo-module
  • Loading branch information
miri64 authored Jul 28, 2020
2 parents 72d6d90 + 0c06694 commit 0e3aa2f
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 27 deletions.
5 changes: 2 additions & 3 deletions examples/emcute_mqttsn/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ USEMODULE += shell_commands
USEMODULE += ps
# For testing we also include the ping6 command and some stats
USEMODULE += gnrc_icmpv6_echo
# Optimize network stack to for use with a single network interface
USEMODULE += gnrc_netif_single

# Allow for env-var-based override of the nodes name (EMCUTE_ID)
ifneq (,$(EMCUTE_ID))
CFLAGS += -DEMCUTE_ID=\"$(EMCUTE_ID)\"
endif

# Optimize network stack to for use with a single network interface
CFLAGS += -DGNRC_NETIF_SINGLE

# Comment this out to disable code in RIOT that does safety checking
# which is not needed in a production environment but helps in the
# development process:
Expand Down
7 changes: 3 additions & 4 deletions examples/gnrc_minimal/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ DEVELHELP ?= 0
# NOTE: 6LoWPAN will be included if IEEE802.15.4 devices are present
USEMODULE += gnrc_netdev_default
USEMODULE += auto_init_gnrc_netif
# Enable single interface optimization.
# Remove this if more than one interface is present
USEMODULE += gnrc_netif_single
# Specify the minimum networking modules for IPv6
USEMODULE += gnrc_ipv6
# Additional networking modules that can be dropped if not needed
Expand All @@ -32,10 +35,6 @@ CFLAGS += -DCONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF=2 \
-DGNRC_NETIF_IPV6_GROUPS_NUMOF=2 -DCONFIG_GNRC_IPV6_NIB_NUMOF=1 \
-DCONFIG_GNRC_IPV6_NIB_OFFL_NUMOF=1 # be able to configure at least one route

# Enable single interface optimization. Set to 0 if more than one interface is
# present
CFLAGS += -DGNRC_NETIF_SINGLE=1

# Change this to 0 show compiler invocation lines by default:
QUIET ?= 1

Expand Down
1 change: 1 addition & 0 deletions makefiles/pseudomodules.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ PSEUDOMODULES += gnrc_pktbuf_cmd
PSEUDOMODULES += gnrc_netif_6lo
PSEUDOMODULES += gnrc_netif_ipv6
PSEUDOMODULES += gnrc_netif_mac
PSEUDOMODULES += gnrc_netif_single
PSEUDOMODULES += gnrc_netif_cmd_%
PSEUDOMODULES += gnrc_netif_dedup
PSEUDOMODULES += gnrc_nettype_%
Expand Down
7 changes: 6 additions & 1 deletion sys/include/net/gnrc/netif.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
* Network interfaces in the context of GNRC are threads for protocols that are
* below the network layer.
*
* ## Single interface optimizations
*
* If you only have one network interface on the board, you can select the
* `gnrc_netif_single` pseudo-module to enable further optimisations.
*
* @{
*
* @file
Expand Down Expand Up @@ -330,7 +335,7 @@ unsigned gnrc_netif_numof(void);
*/
static inline bool gnrc_netif_highlander(void)
{
return IS_ACTIVE(GNRC_NETIF_SINGLE);
return IS_USED(MODULE_GNRC_NETIF_SINGLE);
}

/**
Expand Down
12 changes: 0 additions & 12 deletions sys/include/net/gnrc/netif/conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,6 @@
extern "C" {
#endif

/**
* @brief Single interface optimizations
*
* Define to 1 to allow GNRC optimizations when only one interface
* is available.
*
* @note This MUST NOT be enabled if there's more than one interface.
*/
#if DOXYGEN
#define GNRC_NETIF_SINGLE
#endif

/**
* @brief Default priority for network interface threads
*/
Expand Down
4 changes: 2 additions & 2 deletions tests/emcute/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ endif
USEMODULE += auto_init_gnrc_netif
USEMODULE += gnrc_ipv6_default
USEMODULE += gnrc_sock_udp
USEMODULE += gnrc_netif_single # Only one interface used and it makes
# shell commands easier
USEMODULE += emcute
USEMODULE += od
USEMODULE += shell
Expand All @@ -25,8 +27,6 @@ USEMODULE += sock_util

CFLAGS += -DEMCUTE_TOPIC_MAXLEN="249" # 256 - 7
CFLAGS += -DSTDIO_UART_RX_BUFSIZE="512" # Adapt to SHELL_BUFSIZE in app
CFLAGS += -DGNRC_NETIF_SINGLE # Only one interface used and it makes
# shell commands easier

# The test requires some setup and to be run as root
# So it cannot currently be run
Expand Down
5 changes: 2 additions & 3 deletions tests/gnrc_sock_dns/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ RIOTBASE ?= $(CURDIR)/../..

export TAP ?= tap0

CFLAGS += -DGNRC_NETIF_SINGLE # Only one interface used and it makes
# shell commands easier

USEMODULE += sock_dns
USEMODULE += gnrc_sock_udp
USEMODULE += gnrc_ipv6_default
USEMODULE += gnrc_ipv6_nib_dns
USEMODULE += gnrc_netif_single # Only one interface used and it makes
# shell commands easier
# use Ethernet as link-layer protocol
ifeq (native,$(BOARD))
TERMFLAGS ?= $(TAP)
Expand Down
4 changes: 2 additions & 2 deletions tests/gnrc_tcp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ TIMEOUT_US ?= 3000000
TEST_ON_CI_BLACKLIST += all

CFLAGS += -DSHELL_NO_ECHO
CFLAGS += -DGNRC_NETIF_SINGLE # Only one interface used and it makes
# shell commands easier

ifeq (native,$(BOARD))
TERMFLAGS ?= $(TAP)
Expand All @@ -30,6 +28,8 @@ USEMODULE += auto_init_gnrc_netif
USEMODULE += gnrc_ipv6_default
USEMODULE += gnrc_tcp
USEMODULE += gnrc_pktbuf_cmd
USEMODULE += gnrc_netif_single # Only one interface used and it makes
# shell commands easier
USEMODULE += shell
USEMODULE += shell_commands
USEMODULE += od
Expand Down

0 comments on commit 0e3aa2f

Please sign in to comment.