1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

gnrc_netif: introduce GNRC_NETIF_STACKSIZE_DEFAULT

This commit is contained in:
Benjamin Valentin 2022-04-06 14:02:54 +02:00
parent 56fc7c375f
commit b1ea963df4
18 changed files with 54 additions and 38 deletions

View File

@ -23,12 +23,13 @@
#include "atwinc15x0.h" #include "atwinc15x0.h"
#include "atwinc15x0_params.h" #include "atwinc15x0_params.h"
#include "net/gnrc/netif/ethernet.h" #include "net/gnrc/netif/ethernet.h"
#include "include/init_devs.h"
/** /**
* @brief Define stack parameters for the MAC layer thread * @brief Define stack parameters for the MAC layer thread
* @{ * @{
*/ */
#define ATWINC15X0_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #define ATWINC15X0_MAC_STACKSIZE (GNRC_NETIF_STACKSIZE_DEFAULT)
#ifndef ATWINC15X0_MAC_PRIO #ifndef ATWINC15X0_MAC_PRIO
#define ATWINC15X0_MAC_PRIO (GNRC_NETIF_PRIO) #define ATWINC15X0_MAC_PRIO (GNRC_NETIF_PRIO)
#endif #endif

View File

@ -23,28 +23,15 @@
#include "cc1xxx_common.h" #include "cc1xxx_common.h"
#include "cc110x_params.h" #include "cc110x_params.h"
#include "log.h" #include "log.h"
#include "msg.h" #include "include/init_devs.h"
#include "net/gnrc/netif/conf.h" /* <- GNRC_NETIF_MSG_QUEUE_SIZE */
#define ENABLE_DEBUG 0 #define ENABLE_DEBUG 0
#include "debug.h" #include "debug.h"
#ifndef CC110X_EXTRA_STACKSIZE
/**
* @brief Additional stack size required by the driver
*
* With increasing of GNRC_NETIF_MSG_QUEUE_SIZE the required stack size
* increases as well. A queue size of 8 messages works with default stack size,
* so we increase the stack by `sizeof(msg_t)` for each additional element
*/
#define CC110X_EXTRA_STACKSIZE ((GNRC_NETIF_MSG_QUEUE_SIZE - 8) * sizeof(msg_t))
#endif
/** /**
* @brief Calculate the stack size for the MAC layer thread(s) * @brief Calculate the stack size for the MAC layer thread(s)
*/ */
#define CC110X_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + \ #define CC110X_MAC_STACKSIZE (GNRC_NETIF_STACKSIZE_DEFAULT + \
CC110X_EXTRA_STACKSIZE + \
DEBUG_EXTRA_STACKSIZE) DEBUG_EXTRA_STACKSIZE)
#ifndef CC110X_MAC_PRIO #ifndef CC110X_MAC_PRIO
/** /**

View File

@ -22,12 +22,13 @@
#include "dose.h" #include "dose.h"
#include "dose_params.h" #include "dose_params.h"
#include "net/gnrc/netif/ethernet.h" #include "net/gnrc/netif/ethernet.h"
#include "include/init_devs.h"
/** /**
* @brief Define stack parameters for the MAC layer thread * @brief Define stack parameters for the MAC layer thread
* @{ * @{
*/ */
#define DOSE_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE) #define DOSE_MAC_STACKSIZE (GNRC_NETIF_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE)
#ifndef DOSE_MAC_PRIO #ifndef DOSE_MAC_PRIO
#define DOSE_MAC_PRIO (GNRC_NETIF_PRIO) #define DOSE_MAC_PRIO (GNRC_NETIF_PRIO)
#endif #endif

View File

@ -23,12 +23,13 @@
#include "enc28j60.h" #include "enc28j60.h"
#include "enc28j60_params.h" #include "enc28j60_params.h"
#include "net/gnrc/netif/ethernet.h" #include "net/gnrc/netif/ethernet.h"
#include "include/init_devs.h"
/** /**
* @brief Define stack parameters for the MAC layer thread * @brief Define stack parameters for the MAC layer thread
* @{ * @{
*/ */
#define ENC28J60_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #define ENC28J60_MAC_STACKSIZE (GNRC_NETIF_STACKSIZE_DEFAULT)
#ifndef ENC28J60_MAC_PRIO #ifndef ENC28J60_MAC_PRIO
#define ENC28J60_MAC_PRIO (GNRC_NETIF_PRIO) #define ENC28J60_MAC_PRIO (GNRC_NETIF_PRIO)
#endif #endif

View File

@ -22,12 +22,13 @@
#include "encx24j600.h" #include "encx24j600.h"
#include "encx24j600_params.h" #include "encx24j600_params.h"
#include "net/gnrc/netif/ethernet.h" #include "net/gnrc/netif/ethernet.h"
#include "include/init_devs.h"
/** /**
* @brief Define stack parameters for the MAC layer thread * @brief Define stack parameters for the MAC layer thread
* @{ * @{
*/ */
#define ENCX24J600_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE) #define ENCX24J600_MAC_STACKSIZE (GNRC_NETIF_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE)
#ifndef ENCX24J600_MAC_PRIO #ifndef ENCX24J600_MAC_PRIO
#define ENCX24J600_MAC_PRIO (GNRC_NETIF_PRIO) #define ENCX24J600_MAC_PRIO (GNRC_NETIF_PRIO)
#endif #endif

View File

@ -19,6 +19,7 @@
#include "esp_eth_params.h" #include "esp_eth_params.h"
#include "esp_eth_netdev.h" #include "esp_eth_netdev.h"
#include "net/gnrc/netif/ethernet.h" #include "net/gnrc/netif/ethernet.h"
#include "include/init_devs.h"
static gnrc_netif_t _netif; static gnrc_netif_t _netif;

View File

@ -23,6 +23,7 @@
#include "ethos_params.h" #include "ethos_params.h"
#include "periph/uart.h" #include "periph/uart.h"
#include "net/gnrc/netif/ethernet.h" #include "net/gnrc/netif/ethernet.h"
#include "include/init_devs.h"
#define ETHOS_NUM ARRAY_SIZE(ethos_params) #define ETHOS_NUM ARRAY_SIZE(ethos_params)
@ -37,7 +38,7 @@ static gnrc_netif_t _netif[ETHOS_NUM];
* @brief Define stack parameters for the MAC layer thread * @brief Define stack parameters for the MAC layer thread
* @{ * @{
*/ */
#define ETHOS_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE) #define ETHOS_MAC_STACKSIZE (GNRC_NETIF_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE)
#ifndef ETHOS_MAC_PRIO #ifndef ETHOS_MAC_PRIO
#define ETHOS_MAC_PRIO (GNRC_NETIF_PRIO) #define ETHOS_MAC_PRIO (GNRC_NETIF_PRIO)
#endif #endif

View File

@ -21,8 +21,9 @@
#include "debug.h" #include "debug.h"
#include "netdev_tap_params.h" #include "netdev_tap_params.h"
#include "net/gnrc/netif/ethernet.h" #include "net/gnrc/netif/ethernet.h"
#include "include/init_devs.h"
#define TAP_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE) #define TAP_MAC_STACKSIZE (GNRC_NETIF_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE)
#define TAP_MAC_PRIO (GNRC_NETIF_PRIO) #define TAP_MAC_PRIO (GNRC_NETIF_PRIO)
static netdev_tap_t netdev_tap[NETDEV_TAP_MAX]; static netdev_tap_t netdev_tap[NETDEV_TAP_MAX];

View File

@ -24,6 +24,8 @@
#include "log.h" #include "log.h"
#include "msg.h" #include "msg.h"
#include "net/gnrc/netif/conf.h" #include "net/gnrc/netif/conf.h"
#include "include/init_devs.h"
#define ENABLE_DEBUG 0 #define ENABLE_DEBUG 0
#include "debug.h" #include "debug.h"
@ -42,7 +44,7 @@
/** /**
* @brief Calculate the stack size for the MAC layer thread(s) * @brief Calculate the stack size for the MAC layer thread(s)
*/ */
#define NRF24L01P_NG_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + \ #define NRF24L01P_NG_MAC_STACKSIZE (GNRC_NETIF_STACKSIZE_DEFAULT + \
NRF24L01P_NG_EXTRA_STACKSIZE + \ NRF24L01P_NG_EXTRA_STACKSIZE + \
DEBUG_EXTRA_STACKSIZE) DEBUG_EXTRA_STACKSIZE)
#ifndef NRF24L01P_NG_MAC_PRIO #ifndef NRF24L01P_NG_MAC_PRIO

View File

@ -19,9 +19,10 @@
#include "net/gnrc/netif/ethernet.h" #include "net/gnrc/netif/ethernet.h"
#include "sam0_eth_netdev.h" #include "sam0_eth_netdev.h"
#include "include/init_devs.h"
static netdev_t sam0eth; static netdev_t sam0eth;
static char stack[THREAD_STACKSIZE_DEFAULT]; static char stack[GNRC_NETIF_STACKSIZE_DEFAULT];
static gnrc_netif_t _netif; static gnrc_netif_t _netif;
void auto_init_sam0_eth(void) void auto_init_sam0_eth(void)
@ -29,7 +30,7 @@ void auto_init_sam0_eth(void)
/* setup netdev device */ /* setup netdev device */
sam0_eth_setup(&sam0eth); sam0_eth_setup(&sam0eth);
/* initialize netdev <-> gnrc adapter state */ /* initialize netdev <-> gnrc adapter state */
gnrc_netif_ethernet_create(&_netif, stack, THREAD_STACKSIZE_DEFAULT, gnrc_netif_ethernet_create(&_netif, stack, GNRC_NETIF_STACKSIZE_DEFAULT,
GNRC_NETIF_PRIO, "sam0_eth", &sam0eth); GNRC_NETIF_PRIO, "sam0_eth", &sam0eth);
} }

View File

@ -21,6 +21,7 @@
#include "board.h" #include "board.h"
#include "net/gnrc/netif/raw.h" #include "net/gnrc/netif/raw.h"
#include "net/gnrc.h" #include "net/gnrc.h"
#include "include/init_devs.h"
#include "slipdev.h" #include "slipdev.h"
#include "slipdev_params.h" #include "slipdev_params.h"
@ -31,7 +32,7 @@
* @brief Define stack parameters for the MAC layer thread * @brief Define stack parameters for the MAC layer thread
* @{ * @{
*/ */
#define SLIPDEV_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #define SLIPDEV_STACKSIZE (GNRC_NETIF_STACKSIZE_DEFAULT)
#ifndef SLIPDEV_PRIO #ifndef SLIPDEV_PRIO
#define SLIPDEV_PRIO (GNRC_NETIF_PRIO) #define SLIPDEV_PRIO (GNRC_NETIF_PRIO)
#endif #endif

View File

@ -9,9 +9,10 @@
#include "stm32_eth.h" #include "stm32_eth.h"
#include "net/gnrc/netif/ethernet.h" #include "net/gnrc/netif/ethernet.h"
#include "include/init_devs.h"
static netdev_t stm32eth; static netdev_t stm32eth;
static char stack[THREAD_STACKSIZE_DEFAULT]; static char stack[GNRC_NETIF_STACKSIZE_DEFAULT];
static gnrc_netif_t _netif; static gnrc_netif_t _netif;
void auto_init_stm32_eth(void) void auto_init_stm32_eth(void)
@ -19,7 +20,7 @@ void auto_init_stm32_eth(void)
/* setup netdev device */ /* setup netdev device */
stm32_eth_netdev_setup(&stm32eth); stm32_eth_netdev_setup(&stm32eth);
/* initialize netdev <-> gnrc adapter state */ /* initialize netdev <-> gnrc adapter state */
gnrc_netif_ethernet_create(&_netif, stack, THREAD_STACKSIZE_DEFAULT, GNRC_NETIF_PRIO, "stm32_eth", gnrc_netif_ethernet_create(&_netif, stack, GNRC_NETIF_STACKSIZE_DEFAULT, GNRC_NETIF_PRIO, "stm32_eth",
&stm32eth); &stm32eth);
} }
/** @} */ /** @} */

View File

@ -24,6 +24,7 @@
#include "net/gnrc/netif/lorawan_base.h" #include "net/gnrc/netif/lorawan_base.h"
#include "net/gnrc/netif/raw.h" #include "net/gnrc/netif/raw.h"
#include "net/gnrc.h" #include "net/gnrc.h"
#include "include/init_devs.h"
#include "sx126x.h" #include "sx126x.h"
#include "sx126x_params.h" #include "sx126x_params.h"
@ -36,7 +37,7 @@
/** /**
* @brief Define stack parameters for the MAC layer thread * @brief Define stack parameters for the MAC layer thread
*/ */
#define SX126X_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #define SX126X_STACKSIZE (GNRC_NETIF_STACKSIZE_DEFAULT)
#ifndef SX126X_PRIO #ifndef SX126X_PRIO
#define SX126X_PRIO (GNRC_NETIF_PRIO) #define SX126X_PRIO (GNRC_NETIF_PRIO)
#endif #endif

View File

@ -24,6 +24,7 @@
#include "net/gnrc/netif/lorawan_base.h" #include "net/gnrc/netif/lorawan_base.h"
#include "net/gnrc/netif/raw.h" #include "net/gnrc/netif/raw.h"
#include "net/gnrc.h" #include "net/gnrc.h"
#include "include/init_devs.h"
#include "sx127x.h" #include "sx127x.h"
#include "sx127x_params.h" #include "sx127x_params.h"
@ -36,7 +37,7 @@
/** /**
* @brief Define stack parameters for the MAC layer thread * @brief Define stack parameters for the MAC layer thread
*/ */
#define SX127X_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #define SX127X_STACKSIZE (GNRC_NETIF_STACKSIZE_DEFAULT)
#ifndef SX127X_PRIO #ifndef SX127X_PRIO
#define SX127X_PRIO (GNRC_NETIF_PRIO) #define SX127X_PRIO (GNRC_NETIF_PRIO)
#endif #endif

View File

@ -22,6 +22,7 @@
#include "log.h" #include "log.h"
#include "usb/usbus/cdc/ecm.h" #include "usb/usbus/cdc/ecm.h"
#include "net/gnrc/netif/ethernet.h" #include "net/gnrc/netif/ethernet.h"
#include "include/init_devs.h"
/** /**
* @brief global cdc ecm object, declared in the usb auto init file * @brief global cdc ecm object, declared in the usb auto init file
@ -32,7 +33,7 @@ extern usbus_cdcecm_device_t cdcecm;
* @brief Define stack parameters for the MAC layer thread * @brief Define stack parameters for the MAC layer thread
* @{ * @{
*/ */
#define CDCECM_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #define CDCECM_MAC_STACKSIZE (GNRC_NETIF_STACKSIZE_DEFAULT)
#ifndef CDCECM_MAC_PRIO #ifndef CDCECM_MAC_PRIO
#define CDCECM_MAC_PRIO (GNRC_NETIF_PRIO) #define CDCECM_MAC_PRIO (GNRC_NETIF_PRIO)
#endif #endif

View File

@ -21,12 +21,13 @@
#include "w5100.h" #include "w5100.h"
#include "w5100_params.h" #include "w5100_params.h"
#include "net/gnrc/netif/ethernet.h" #include "net/gnrc/netif/ethernet.h"
#include "include/init_devs.h"
/** /**
* @brief Define stack parameters for the MAC layer thread * @brief Define stack parameters for the MAC layer thread
* @{ * @{
*/ */
#define MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #define MAC_STACKSIZE (GNRC_NETIF_STACKSIZE_DEFAULT)
#define MAC_PRIO (GNRC_NETIF_PRIO) #define MAC_PRIO (GNRC_NETIF_PRIO)
/*** @} */ /*** @} */

View File

@ -24,6 +24,7 @@
#include "gnrc_netif_xbee.h" #include "gnrc_netif_xbee.h"
#include "xbee.h" #include "xbee.h"
#include "xbee_params.h" #include "xbee_params.h"
#include "include/init_devs.h"
/** /**
* @brief Calculate the number of configured XBee devices * @brief Calculate the number of configured XBee devices
@ -33,7 +34,7 @@
/** /**
* @brief Define stack parameters for the MAC layer thread * @brief Define stack parameters for the MAC layer thread
*/ */
#define XBEE_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT) #define XBEE_MAC_STACKSIZE (GNRC_NETIF_STACKSIZE_DEFAULT)
#ifndef XBEE_MAC_PRIO #ifndef XBEE_MAC_PRIO
#define XBEE_MAC_PRIO (GNRC_NETIF_PRIO) #define XBEE_MAC_PRIO (GNRC_NETIF_PRIO)
#endif #endif

View File

@ -20,29 +20,41 @@
#define INIT_DEVS_H #define INIT_DEVS_H
#include "thread.h" #include "thread.h"
#include "msg.h"
#include "net/gnrc/netif/conf.h" /* <- GNRC_NETIF_MSG_QUEUE_SIZE */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/**
* @brief stack size of a netif thread
*
* Message queue was previously allocated on the stack, reduce
* stack size by default msg queue size to keep the RAM use the same
*/
#ifndef GNRC_NETIF_STACKSIZE_DEFAULT
#define GNRC_NETIF_STACKSIZE_DEFAULT (THREAD_STACKSIZE_DEFAULT - 128)
#endif
/** /**
* @brief extra stack size if ieee802154 security is enabled * @brief extra stack size if ieee802154 security is enabled
* *
* You may increase this value if you experience a stack overflow * You may increase this value if you experience a stack overflow
* with IEEE 802.15.4 security enabled. * with IEEE 802.15.4 security enabled.
*/ */
#ifdef MODULE_IEEE802154_SECURITY
#define IEEE802154_SECURITY_EXTRA_STACKSIZE (128) #define IEEE802154_SECURITY_EXTRA_STACKSIZE (128)
#else
#define IEEE802154_SECURITY_EXTRA_STACKSIZE (0)
#endif
#ifndef IEEE802154_STACKSIZE_DEFAULT #ifndef IEEE802154_STACKSIZE_DEFAULT
#ifdef MODULE_IEEE802154_SECURITY
#define IEEE802154_STACKSIZE_DEFAULT (THREAD_STACKSIZE_DEFAULT + \
IEEE802154_SECURITY_EXTRA_STACKSIZE)
#else
/** /**
* @brief stack size of an ieee802154 device * @brief stack size of an ieee802154 device
*/ */
#define IEEE802154_STACKSIZE_DEFAULT (THREAD_STACKSIZE_DEFAULT) #define IEEE802154_STACKSIZE_DEFAULT (GNRC_NETIF_STACKSIZE_DEFAULT + \
#endif IEEE802154_SECURITY_EXTRA_STACKSIZE)
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus