From 13030d5a352b3ea68f51e560d4c29215a25f310d Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Tue, 26 Feb 2019 11:29:19 +0100 Subject: [PATCH] gnrc_netif: expose message queue size configurable --- sys/include/net/gnrc/netif/conf.h | 11 +++++++++++ sys/net/gnrc/netif/gnrc_netif.c | 6 ++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/include/net/gnrc/netif/conf.h b/sys/include/net/gnrc/netif/conf.h index 381ef4ceb54f..c16ab77b41a2 100644 --- a/sys/include/net/gnrc/netif/conf.h +++ b/sys/include/net/gnrc/netif/conf.h @@ -46,6 +46,17 @@ extern "C" { #define GNRC_NETIF_PRIO (THREAD_PRIORITY_MAIN - 5) #endif +/** + * @brief Message queue size for network interface threads + * + * @attention This has influence on the used stack memory of the thread, so + * the thread's stack size might need to be adapted if this is + * changed. + */ +#ifndef GNRC_NETIF_MSG_QUEUE_SIZE +#define GNRC_NETIF_MSG_QUEUE_SIZE (8U) +#endif + /** * @brief Number of multicast addresses needed for @ref net_gnrc_rpl "RPL". * diff --git a/sys/net/gnrc/netif/gnrc_netif.c b/sys/net/gnrc/netif/gnrc_netif.c index f4f1b0f7cd3e..e226b26e9920 100644 --- a/sys/net/gnrc/netif/gnrc_netif.c +++ b/sys/net/gnrc/netif/gnrc_netif.c @@ -38,8 +38,6 @@ #define ENABLE_DEBUG (0) #include "debug.h" -#define _NETIF_NETAPI_MSG_QUEUE_SIZE (8) - static gnrc_netif_t _netifs[GNRC_NETIF_NUMOF]; static void _update_l2addr_from_dev(gnrc_netif_t *netif); @@ -1170,7 +1168,7 @@ static void *_gnrc_netif_thread(void *args) netdev_t *dev; int res; msg_t reply = { .type = GNRC_NETAPI_MSG_TYPE_ACK }; - msg_t msg, msg_queue[_NETIF_NETAPI_MSG_QUEUE_SIZE]; + msg_t msg, msg_queue[GNRC_NETIF_MSG_QUEUE_SIZE]; DEBUG("gnrc_netif: starting thread %i\n", sched_active_pid); netif = args; @@ -1178,7 +1176,7 @@ static void *_gnrc_netif_thread(void *args) dev = netif->dev; netif->pid = sched_active_pid; /* setup the link-layer's message queue */ - msg_init_queue(msg_queue, _NETIF_NETAPI_MSG_QUEUE_SIZE); + msg_init_queue(msg_queue, GNRC_NETIF_MSG_QUEUE_SIZE); /* register the event callback with the device driver */ dev->event_callback = _event_cb; dev->context = netif;