gnrc_netif: add GNRC_NETIF_SINGLE macro

This commit is contained in:
Jose Alamos 2020-03-17 12:32:34 +01:00
parent e451570219
commit 44f7cb712c
2 changed files with 15 additions and 3 deletions

View File

@ -29,6 +29,18 @@
extern "C" { extern "C" {
#endif #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 * @brief Default priority for network interface threads
*/ */

View File

@ -49,9 +49,9 @@ int gnrc_netif_create(gnrc_netif_t *netif, char *stack, int stacksize, char prio
{ {
int res; int res;
if (IS_ACTIVE(DEVELHELP) && IS_ACTIVE(GNRC_NETIF_SINGLE) && netif_iter(NULL)) { if (IS_ACTIVE(DEVELHELP) && gnrc_netif_highlander() && netif_iter(NULL)) {
LOG_WARNING("gnrc_netif: GNRC_NETIF_SINGLE set but more than one " LOG_WARNING("gnrc_netif: gnrc_netif_highlander() returned true but "
"interface is being registered."); "more than one interface is being registered.\n");
assert(netif_iter(NULL) == NULL); assert(netif_iter(NULL) == NULL);
} }
rmutex_init(&netif->mutex); rmutex_init(&netif->mutex);