mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
gnrc/pktbuf : Move 'GNRC_PKTBUF_SIZE' to 'CONFIG_'
This commit is contained in:
parent
7bd2a6f8c9
commit
5523d119b6
@ -74,9 +74,9 @@ extern "C" {
|
||||
# define ISR_STACKSIZE (256)
|
||||
#endif
|
||||
|
||||
#ifndef GNRC_PKTBUF_SIZE
|
||||
#ifndef CONFIG_GNRC_PKTBUF_SIZE
|
||||
/* TODO: Make this value overall MTU dependent */
|
||||
# define GNRC_PKTBUF_SIZE (2560)
|
||||
# define CONFIG_GNRC_PKTBUF_SIZE (2560)
|
||||
#endif
|
||||
|
||||
#ifndef GNRC_IPV6_STACK_SIZE
|
||||
|
@ -55,9 +55,9 @@ extern "C" {
|
||||
*/
|
||||
#define NATIVE_ETH_PROTO 0x1234
|
||||
|
||||
#if (defined(GNRC_PKTBUF_SIZE)) && (GNRC_PKTBUF_SIZE < 2048)
|
||||
# undef GNRC_PKTBUF_SIZE
|
||||
# define GNRC_PKTBUF_SIZE (2048)
|
||||
#if (defined(CONFIG_GNRC_PKTBUF_SIZE)) && (CONFIG_GNRC_PKTBUF_SIZE < 2048)
|
||||
# undef CONFIG_GNRC_PKTBUF_SIZE
|
||||
# define CONFIG_GNRC_PKTBUF_SIZE (2048)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -62,8 +62,8 @@ extern "C" {
|
||||
* buffer size on these CPUs
|
||||
* @{
|
||||
*/
|
||||
#ifndef GNRC_PKTBUF_SIZE
|
||||
#define GNRC_PKTBUF_SIZE (2048)
|
||||
#ifndef CONFIG_GNRC_PKTBUF_SIZE
|
||||
#define CONFIG_GNRC_PKTBUF_SIZE (2048)
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
|
@ -57,7 +57,7 @@ ifneq (,$(filter $(BOARD),$(BOARD_PROVIDES_NETIF)))
|
||||
|
||||
# We use only the lower layers of the GNRC network stack, hence, we can
|
||||
# reduce the size of the packet buffer a bit
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=512
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=512
|
||||
endif
|
||||
|
||||
FEATURES_OPTIONAL += periph_rtc
|
||||
|
@ -21,7 +21,7 @@ USEMODULE += $(DRIVER)
|
||||
|
||||
# We can reduce the size of the packet buffer for LoRaWAN, since there's no IP
|
||||
# support. This will reduce RAM consumption.
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=512
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=512
|
||||
|
||||
|
||||
########################### COMPILE TIME CONFIGURATION ########################
|
||||
|
@ -24,7 +24,7 @@ USEMODULE += gnrc_icmpv6_echo
|
||||
USEMODULE += prng_minstd
|
||||
|
||||
CFLAGS += -DLOG_LEVEL=LOG_NONE # disable log output
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=512 -DCONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF=2 \
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=512 -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
|
||||
|
||||
|
@ -42,7 +42,7 @@ ifneq (,$(filter $(BOARD),$(LOW_MEMORY_BOARDS)))
|
||||
$(info Using low-memory configuration for microcoap_server.)
|
||||
## low-memory tuning values
|
||||
# lower pktbuf buffer size
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=1000
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=1000
|
||||
USEMODULE += prng_minstd
|
||||
endif
|
||||
|
||||
|
@ -8,7 +8,7 @@ BOARD ?= samr21-xpro
|
||||
RIOTBASE ?= $(CURDIR)/../..
|
||||
|
||||
# lower pktbuf size to something sufficient for this application
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=2000
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=2000
|
||||
|
||||
#
|
||||
# Networking
|
||||
|
@ -14,7 +14,7 @@
|
||||
*
|
||||
* @note **WARNING!!** Do not store data structures that are not packed
|
||||
* (defined with `__attribute__((packed))`) or enforce alignment in
|
||||
* in any way in here if @ref GNRC_PKTBUF_SIZE > 0. On some RISC architectures
|
||||
* in any way in here if @ref CONFIG_GNRC_PKTBUF_SIZE > 0. On some RISC architectures
|
||||
* this *will* lead to alignment problems and can potentially result
|
||||
* in segmentation/hard faults and other unexpected behaviour.
|
||||
*
|
||||
@ -45,7 +45,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @def GNRC_PKTBUF_SIZE
|
||||
* @def CONFIG_GNRC_PKTBUF_SIZE
|
||||
* @defgroup net_gnrc_pktbuf_conf GNRC PKTBUF compile configurations
|
||||
* @ingroup net_gnrc_conf
|
||||
* @{
|
||||
@ -56,11 +56,11 @@ extern "C" {
|
||||
* @details The rational here is to have at least space for 4 full-MTU IPv6
|
||||
* packages (2 incoming, 2 outgoing; 2 * 2 * 1280 B = 5 KiB) +
|
||||
* Meta-Data (roughly estimated to 1 KiB; might be smaller). If
|
||||
* @ref GNRC_PKTBUF_SIZE is 0 the packet buffer will use dynamic memory
|
||||
* @ref CONFIG_GNRC_PKTBUF_SIZE is 0 the packet buffer will use dynamic memory
|
||||
* management to allocate packets.
|
||||
*/
|
||||
#ifndef GNRC_PKTBUF_SIZE
|
||||
#define GNRC_PKTBUF_SIZE (6144)
|
||||
#ifndef CONFIG_GNRC_PKTBUF_SIZE
|
||||
#define CONFIG_GNRC_PKTBUF_SIZE (6144)
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
@ -76,7 +76,7 @@ void gnrc_pktbuf_init(void);
|
||||
* function externally. This will most likely create memory leaks or
|
||||
* not allowed memory access.
|
||||
*
|
||||
* @pre size < GNRC_PKTBUF_SIZE
|
||||
* @pre size < CONFIG_GNRC_PKTBUF_SIZE
|
||||
*
|
||||
* @param[in] next Next gnrc_pktsnip_t in the packet. Leave NULL if you
|
||||
* want to create a new packet.
|
||||
|
@ -101,9 +101,9 @@ gnrc_pktsnip_t *gnrc_pktbuf_add(gnrc_pktsnip_t *next, const void *data, size_t s
|
||||
{
|
||||
gnrc_pktsnip_t *pkt;
|
||||
|
||||
if (size > GNRC_PKTBUF_SIZE) {
|
||||
DEBUG("pktbuf: size (%u) > GNRC_PKTBUF_SIZE (%u)\n",
|
||||
(unsigned)size, GNRC_PKTBUF_SIZE);
|
||||
if (size > CONFIG_GNRC_PKTBUF_SIZE) {
|
||||
DEBUG("pktbuf: size (%u) > CONFIG_GNRC_PKTBUF_SIZE (%u)\n",
|
||||
(unsigned)size, CONFIG_GNRC_PKTBUF_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
mutex_lock(&_mutex);
|
||||
|
@ -41,7 +41,7 @@ typedef struct _unused {
|
||||
} _unused_t;
|
||||
|
||||
static mutex_t _mutex = MUTEX_INIT;
|
||||
static uint8_t _pktbuf[GNRC_PKTBUF_SIZE];
|
||||
static uint8_t _pktbuf[CONFIG_GNRC_PKTBUF_SIZE];
|
||||
static _unused_t *_first_unused;
|
||||
|
||||
#ifdef DEVELHELP
|
||||
@ -57,7 +57,7 @@ static void _pktbuf_free(void *data, size_t size);
|
||||
|
||||
static inline bool _pktbuf_contains(void *ptr)
|
||||
{
|
||||
return (unsigned)((uint8_t *)ptr - _pktbuf) < GNRC_PKTBUF_SIZE;
|
||||
return (unsigned)((uint8_t *)ptr - _pktbuf) < CONFIG_GNRC_PKTBUF_SIZE;
|
||||
}
|
||||
|
||||
/* fits size to byte alignment */
|
||||
@ -93,9 +93,9 @@ gnrc_pktsnip_t *gnrc_pktbuf_add(gnrc_pktsnip_t *next, const void *data, size_t s
|
||||
{
|
||||
gnrc_pktsnip_t *pkt;
|
||||
|
||||
if (size > GNRC_PKTBUF_SIZE) {
|
||||
DEBUG("pktbuf: size (%u) > GNRC_PKTBUF_SIZE (%u)\n",
|
||||
(unsigned)size, GNRC_PKTBUF_SIZE);
|
||||
if (size > CONFIG_GNRC_PKTBUF_SIZE) {
|
||||
DEBUG("pktbuf: size (%u) > CONFIG_GNRC_PKTBUF_SIZE (%u)\n",
|
||||
(unsigned)size, CONFIG_GNRC_PKTBUF_SIZE);
|
||||
return NULL;
|
||||
}
|
||||
mutex_lock(&_mutex);
|
||||
@ -303,10 +303,10 @@ void gnrc_pktbuf_stats(void)
|
||||
int count = 0;
|
||||
|
||||
printf("packet buffer: first byte: %p, last byte: %p (size: %u)\n",
|
||||
(void *)&_pktbuf[0], (void *)&_pktbuf[GNRC_PKTBUF_SIZE], GNRC_PKTBUF_SIZE);
|
||||
(void *)&_pktbuf[0], (void *)&_pktbuf[CONFIG_GNRC_PKTBUF_SIZE], CONFIG_GNRC_PKTBUF_SIZE);
|
||||
printf(" position of last byte used: %" PRIu16 "\n", max_byte_count);
|
||||
if (ptr == NULL) { /* packet buffer is completely full */
|
||||
_print_chunk(chunk, GNRC_PKTBUF_SIZE, count++);
|
||||
_print_chunk(chunk, CONFIG_GNRC_PKTBUF_SIZE, count++);
|
||||
}
|
||||
|
||||
if (((void *)ptr) == ((void *)chunk)) { /* _first_unused is at the beginning */
|
||||
@ -318,7 +318,7 @@ void gnrc_pktbuf_stats(void)
|
||||
while (ptr) {
|
||||
size_t size = ((uint8_t *)ptr) - chunk;
|
||||
if ((size == 0) && (!_pktbuf_contains(ptr)) &&
|
||||
(!_pktbuf_contains(chunk)) && (size > GNRC_PKTBUF_SIZE)) {
|
||||
(!_pktbuf_contains(chunk)) && (size > CONFIG_GNRC_PKTBUF_SIZE)) {
|
||||
puts("ERROR");
|
||||
return;
|
||||
}
|
||||
@ -328,8 +328,8 @@ void gnrc_pktbuf_stats(void)
|
||||
ptr = ptr->next;
|
||||
}
|
||||
|
||||
if (chunk <= &_pktbuf[GNRC_PKTBUF_SIZE - 1]) {
|
||||
_print_chunk(chunk, &_pktbuf[GNRC_PKTBUF_SIZE] - chunk, count);
|
||||
if (chunk <= &_pktbuf[CONFIG_GNRC_PKTBUF_SIZE - 1]) {
|
||||
_print_chunk(chunk, &_pktbuf[CONFIG_GNRC_PKTBUF_SIZE] - chunk, count);
|
||||
}
|
||||
#else
|
||||
DEBUG("pktbuf: needs od module\n");
|
||||
@ -351,14 +351,14 @@ bool gnrc_pktbuf_is_sane(void)
|
||||
/* Invariants of this implementation:
|
||||
* - the head of _unused_t list is _first_unused
|
||||
* - if _unused_t list is empty the packet buffer is full and _first_unused is NULL
|
||||
* - forall ptr_in _unused_t list: &_pktbuf[0] < ptr < &_pktbuf[GNRC_PKTBUF_SIZE]
|
||||
* - forall ptr_in _unused_t list: &_pktbuf[0] < ptr < &_pktbuf[CONFIG_GNRC_PKTBUF_SIZE]
|
||||
* - forall ptr in _unused_t list: ptr->next == NULL || ptr < ptr->next
|
||||
* - forall ptr in _unused_t list: (ptr->next != NULL && ptr->size <= (ptr->next - ptr)) ||
|
||||
* (ptr->next == NULL && ptr->size == (GNRC_PKTBUF_SIZE - (ptr - &_pktbuf[0])))
|
||||
* (ptr->next == NULL && ptr->size == (CONFIG_GNRC_PKTBUF_SIZE - (ptr - &_pktbuf[0])))
|
||||
*/
|
||||
|
||||
while (ptr) {
|
||||
if (&_pktbuf[0] >= (uint8_t *)ptr && (uint8_t *)ptr >= &_pktbuf[GNRC_PKTBUF_SIZE]) {
|
||||
if (&_pktbuf[0] >= (uint8_t *)ptr && (uint8_t *)ptr >= &_pktbuf[CONFIG_GNRC_PKTBUF_SIZE]) {
|
||||
return false;
|
||||
}
|
||||
if ((ptr->next != NULL) && (ptr >= ptr->next)) {
|
||||
@ -366,7 +366,7 @@ bool gnrc_pktbuf_is_sane(void)
|
||||
}
|
||||
if (((ptr->next == NULL) || (ptr->size > (size_t)((uint8_t *)(ptr->next) - (uint8_t *)ptr))) &&
|
||||
((ptr->next != NULL) ||
|
||||
(ptr->size != (size_t)(GNRC_PKTBUF_SIZE - ((uint8_t *)ptr - &_pktbuf[0]))))) {
|
||||
(ptr->size != (size_t)(CONFIG_GNRC_PKTBUF_SIZE - ((uint8_t *)ptr - &_pktbuf[0]))))) {
|
||||
return false;
|
||||
}
|
||||
ptr = ptr->next;
|
||||
@ -426,7 +426,7 @@ static void *_pktbuf_alloc(size_t size)
|
||||
else {
|
||||
_unused_t *new = (_unused_t *)(((uint8_t *)ptr) + size);
|
||||
|
||||
if (((((uint8_t *)new) - &(_pktbuf[0])) + sizeof(_unused_t)) > GNRC_PKTBUF_SIZE) {
|
||||
if (((((uint8_t *)new) - &(_pktbuf[0])) + sizeof(_unused_t)) > CONFIG_GNRC_PKTBUF_SIZE) {
|
||||
/* content of new would exceed packet buffer size so set to NULL */
|
||||
_first_unused = NULL;
|
||||
}
|
||||
@ -478,7 +478,7 @@ static void _pktbuf_free(void *data, size_t size)
|
||||
new->size = _align(size);
|
||||
/* calculate number of bytes between new _unused_t chunk and end of packet
|
||||
* buffer */
|
||||
bytes_at_end = ((&_pktbuf[0] + GNRC_PKTBUF_SIZE) - (((uint8_t *)new) + new->size));
|
||||
bytes_at_end = ((&_pktbuf[0] + CONFIG_GNRC_PKTBUF_SIZE) - (((uint8_t *)new) + new->size));
|
||||
if (bytes_at_end < sizeof(_unused_t)) {
|
||||
/* new is very last segment and there is a little bit of memory left
|
||||
* that wouldn't fit _unused_t (cut of in _pktbuf_alloc()) => re-add it */
|
||||
|
@ -34,7 +34,7 @@ ifneq (,$(filter ncv7356,$(TRX_TO_BUILD)))
|
||||
CFLAGS += -DNCV7356_MODE1_PIN=$(NCV7356_MODE1_PIN)
|
||||
endif
|
||||
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=4096
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=4096
|
||||
CFLAGS += -DCAN_PKT_BUF_SIZE=64
|
||||
CFLAGS += -DCAN_ROUTER_MAX_FILTER=32
|
||||
|
||||
|
@ -9,7 +9,7 @@ USEMODULE += shell_commands
|
||||
USEMODULE += ps
|
||||
|
||||
# lower pktbuf size
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=2048
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=2048
|
||||
|
||||
# set board specific peripheral configurations
|
||||
ifneq (,$(filter nucleo-f334r8,$(BOARD)))
|
||||
|
@ -6,8 +6,8 @@ USEMODULE += shell_commands
|
||||
USEMODULE += ps
|
||||
|
||||
# allow to use a smaller packet buffer in low-PDU drivers
|
||||
ifdef GNRC_PKTBUF_SIZE
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=$(GNRC_PKTBUF_SIZE)
|
||||
ifdef CONFIG_GNRC_PKTBUF_SIZE
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=$(CONFIG_GNRC_PKTBUF_SIZE)
|
||||
endif
|
||||
|
||||
# gnrc is a meta module including all required, basic gnrc networking modules
|
||||
|
@ -1,6 +1,6 @@
|
||||
USEMODULE += xbee
|
||||
|
||||
# No need of big buffer for this test
|
||||
GNRC_PKTBUF_SIZE=512
|
||||
CONFIG_GNRC_PKTBUF_SIZE=512
|
||||
|
||||
include ../driver_netdev_common/Makefile
|
||||
|
@ -30,7 +30,7 @@ USEMODULE += gnrc_gomach
|
||||
|
||||
# We use only the lower layers of the GNRC network stack, hence, we can
|
||||
# reduce the size of the packet buffer a bit
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=1024
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=1024
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
|
@ -12,7 +12,7 @@ USEMODULE += shell
|
||||
USEMODULE += shell_commands
|
||||
USEMODULE += xtimer
|
||||
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=512
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=512
|
||||
CFLAGS += -DTEST_SUITES
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
@ -8,7 +8,7 @@ USEMODULE += netdev_eth
|
||||
USEMODULE += netdev_test
|
||||
|
||||
CFLAGS += -DGNRC_NETTYPE_NDP=GNRC_NETTYPE_TEST
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=512
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=512
|
||||
CFLAGS += -DTEST_SUITES
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
@ -12,7 +12,7 @@ USEMODULE += netdev_test
|
||||
# lower log-level to save memory of LOG_WARNING() in gnrc_netif
|
||||
CFLAGS += -DLOG_LEVEL=LOG_ERROR
|
||||
CFLAGS += -DGNRC_NETTYPE_NDP=GNRC_NETTYPE_TEST
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=512
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=512
|
||||
CFLAGS += -DTEST_SUITES
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
@ -28,7 +28,7 @@ USEMODULE += posix_inet
|
||||
LOW_MEMORY_BOARDS := nucleo-f334r8 msb-430 msb-430h
|
||||
|
||||
ifeq ($(BOARD),$(filter $(BOARD),$(LOW_MEMORY_BOARDS)))
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=512 -DCONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF=2 \
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=512 -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
|
||||
endif
|
||||
|
@ -27,7 +27,7 @@ USEMODULE += gnrc_lwmac
|
||||
|
||||
# We use only the lower layers of the GNRC network stack, hence, we can
|
||||
# reduce the size of the packet buffer a bit
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=512
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=512
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
|
@ -8,7 +8,7 @@ USEMODULE += netdev_ieee802154
|
||||
USEMODULE += netdev_test
|
||||
|
||||
CFLAGS += -DGNRC_NETTYPE_NDP=GNRC_NETTYPE_TEST
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=512
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=512
|
||||
CFLAGS += -DTEST_SUITES
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
@ -83,7 +83,7 @@ static void fill_pktbuf(void)
|
||||
gnrc_pktsnip_t *pkt = gnrc_pktbuf_add(NULL, NULL,
|
||||
/* 24 = sizeof(gnrc_pktsnip_t) +
|
||||
* potential alignment */
|
||||
GNRC_PKTBUF_SIZE - 24U,
|
||||
CONFIG_GNRC_PKTBUF_SIZE - 24U,
|
||||
GNRC_NETTYPE_UNDEF);
|
||||
TEST_ASSERT_NOT_NULL(pkt);
|
||||
TEST_ASSERT(gnrc_pktbuf_is_sane());
|
||||
@ -498,7 +498,7 @@ static void test_nbr_sol_send__pktbuf_full1(void)
|
||||
/* don't be able to fit any more data into packet buffer
|
||||
* - 24 == sizeof(gnrc_pktsnip_t) + pktbuf internal padding */
|
||||
gnrc_pktsnip_t *tmp = gnrc_pktbuf_add(NULL, NULL,
|
||||
GNRC_PKTBUF_SIZE - 24,
|
||||
CONFIG_GNRC_PKTBUF_SIZE - 24,
|
||||
GNRC_NETTYPE_UNDEF);
|
||||
TEST_ASSERT_NOT_NULL(tmp);
|
||||
gnrc_ndp_nbr_sol_send(&test_tgt, test_netif, &test_src, &test_dst, NULL);
|
||||
@ -513,7 +513,7 @@ static void test_nbr_sol_send__pktbuf_full2(void)
|
||||
* - 24 == sizeof(gnrc_pktsnip_t) + pktbuf internal padding
|
||||
* - 16 == size of SLLAO for IEEE 802.15.4 */
|
||||
gnrc_pktsnip_t *tmp = gnrc_pktbuf_add(NULL, NULL,
|
||||
GNRC_PKTBUF_SIZE - (2 * 24) - 16,
|
||||
CONFIG_GNRC_PKTBUF_SIZE - (2 * 24) - 16,
|
||||
GNRC_NETTYPE_UNDEF);
|
||||
TEST_ASSERT_NOT_NULL(tmp);
|
||||
gnrc_ndp_nbr_sol_send(&test_tgt, test_netif, &test_src, &test_dst, NULL);
|
||||
@ -528,7 +528,7 @@ static void test_nbr_sol_send__pktbuf_full3(void)
|
||||
* - 24 == sizeof(gnrc_pktsnip_t) + pktbuf internal padding
|
||||
* - 16 == size of SLLAO for IEEE 802.15.4 */
|
||||
gnrc_pktsnip_t *tmp = gnrc_pktbuf_add(NULL, NULL,
|
||||
GNRC_PKTBUF_SIZE - (3 * 24) - 16 -
|
||||
CONFIG_GNRC_PKTBUF_SIZE - (3 * 24) - 16 -
|
||||
sizeof(ndp_nbr_sol_t),
|
||||
GNRC_NETTYPE_UNDEF);
|
||||
TEST_ASSERT_NOT_NULL(tmp);
|
||||
@ -544,7 +544,7 @@ static void test_nbr_sol_send__pktbuf_full4(void)
|
||||
* - 24 == sizeof(gnrc_pktsnip_t) + pktbuf internal padding
|
||||
* - 16 == size of SLLAO for IEEE 802.15.4 */
|
||||
gnrc_pktsnip_t *tmp = gnrc_pktbuf_add(NULL, NULL,
|
||||
GNRC_PKTBUF_SIZE - (4 * 24) - 16 -
|
||||
CONFIG_GNRC_PKTBUF_SIZE - (4 * 24) - 16 -
|
||||
sizeof(ndp_nbr_sol_t) -
|
||||
sizeof(ipv6_hdr_t),
|
||||
GNRC_NETTYPE_UNDEF);
|
||||
@ -709,7 +709,7 @@ static void test_nbr_adv_send__pktbuf_full1(void)
|
||||
/* don't be able to fit any more data into packet buffer
|
||||
* - 24 == sizeof(gnrc_pktsnip_t) + pktbuf internal padding */
|
||||
gnrc_pktsnip_t *tmp = gnrc_pktbuf_add(NULL, NULL,
|
||||
GNRC_PKTBUF_SIZE - 24,
|
||||
CONFIG_GNRC_PKTBUF_SIZE - 24,
|
||||
GNRC_NETTYPE_UNDEF);
|
||||
TEST_ASSERT_NOT_NULL(tmp);
|
||||
gnrc_ndp_nbr_adv_send(&test_src, test_netif, &test_dst, true, NULL);
|
||||
@ -724,7 +724,7 @@ static void test_nbr_adv_send__pktbuf_full2(void)
|
||||
* - 24 == sizeof(gnrc_pktsnip_t) + pktbuf internal padding
|
||||
* - 16 == size of TLLAO for IEEE 802.15.4 */
|
||||
gnrc_pktsnip_t *tmp = gnrc_pktbuf_add(NULL, NULL,
|
||||
GNRC_PKTBUF_SIZE - (2 * 24) - 16,
|
||||
CONFIG_GNRC_PKTBUF_SIZE - (2 * 24) - 16,
|
||||
GNRC_NETTYPE_UNDEF);
|
||||
TEST_ASSERT_NOT_NULL(tmp);
|
||||
gnrc_ndp_nbr_adv_send(&test_src, test_netif, &test_dst, true, NULL);
|
||||
@ -739,7 +739,7 @@ static void test_nbr_adv_send__pktbuf_full3(void)
|
||||
* - 24 == sizeof(gnrc_pktsnip_t) + pktbuf internal padding
|
||||
* - 16 == size of TLLAO for IEEE 802.15.4 */
|
||||
gnrc_pktsnip_t *tmp = gnrc_pktbuf_add(NULL, NULL,
|
||||
GNRC_PKTBUF_SIZE - (3 * 24) - 16 -
|
||||
CONFIG_GNRC_PKTBUF_SIZE - (3 * 24) - 16 -
|
||||
sizeof(ndp_nbr_adv_t),
|
||||
GNRC_NETTYPE_UNDEF);
|
||||
TEST_ASSERT_NOT_NULL(tmp);
|
||||
@ -755,7 +755,7 @@ static void test_nbr_adv_send__pktbuf_full4(void)
|
||||
* - 24 == sizeof(gnrc_pktsnip_t) + pktbuf internal padding
|
||||
* - 16 == size of TLLAO for IEEE 802.15.4 */
|
||||
gnrc_pktsnip_t *tmp = gnrc_pktbuf_add(NULL, NULL,
|
||||
GNRC_PKTBUF_SIZE - (4 * 24) - 16 -
|
||||
CONFIG_GNRC_PKTBUF_SIZE - (4 * 24) - 16 -
|
||||
sizeof(ndp_nbr_adv_t) -
|
||||
sizeof(ipv6_hdr_t),
|
||||
GNRC_NETTYPE_UNDEF);
|
||||
@ -832,7 +832,7 @@ static void test_rtr_sol_send__pktbuf_full1(void)
|
||||
/* don't be able to fit any more data into packet buffer
|
||||
* - 24 == sizeof(gnrc_pktsnip_t) + pktbuf internal padding */
|
||||
gnrc_pktsnip_t *tmp = gnrc_pktbuf_add(NULL, NULL,
|
||||
GNRC_PKTBUF_SIZE - 24,
|
||||
CONFIG_GNRC_PKTBUF_SIZE - 24,
|
||||
GNRC_NETTYPE_UNDEF);
|
||||
TEST_ASSERT_NOT_NULL(tmp);
|
||||
gnrc_ndp_rtr_sol_send(test_netif, &test_dst);
|
||||
@ -847,7 +847,7 @@ static void test_rtr_sol_send__pktbuf_full2(void)
|
||||
* - 24 == sizeof(gnrc_pktsnip_t) + pktbuf internal padding
|
||||
* - 16 == size of SLLAO for IEEE 802.15.4 */
|
||||
gnrc_pktsnip_t *tmp = gnrc_pktbuf_add(NULL, NULL,
|
||||
GNRC_PKTBUF_SIZE - (2 * 24) - 16,
|
||||
CONFIG_GNRC_PKTBUF_SIZE - (2 * 24) - 16,
|
||||
GNRC_NETTYPE_UNDEF);
|
||||
TEST_ASSERT_NOT_NULL(tmp);
|
||||
gnrc_ndp_rtr_sol_send(test_netif, &test_dst);
|
||||
@ -862,7 +862,7 @@ static void test_rtr_sol_send__pktbuf_full3(void)
|
||||
* - 24 == sizeof(gnrc_pktsnip_t) + pktbuf internal padding
|
||||
* - 16 == size of SLLAO for IEEE 802.15.4 */
|
||||
gnrc_pktsnip_t *tmp = gnrc_pktbuf_add(NULL, NULL,
|
||||
GNRC_PKTBUF_SIZE - (3 * 24) - 16 -
|
||||
CONFIG_GNRC_PKTBUF_SIZE - (3 * 24) - 16 -
|
||||
sizeof(ndp_rtr_sol_t),
|
||||
GNRC_NETTYPE_UNDEF);
|
||||
TEST_ASSERT_NOT_NULL(tmp);
|
||||
@ -878,7 +878,7 @@ static void test_rtr_sol_send__pktbuf_full4(void)
|
||||
* - 24 == sizeof(gnrc_pktsnip_t) + pktbuf internal padding
|
||||
* - 16 == size of SLLAO for IEEE 802.15.4 */
|
||||
gnrc_pktsnip_t *tmp = gnrc_pktbuf_add(NULL, NULL,
|
||||
GNRC_PKTBUF_SIZE - (4 * 24) - 16 -
|
||||
CONFIG_GNRC_PKTBUF_SIZE - (4 * 24) - 16 -
|
||||
sizeof(ndp_rtr_sol_t) -
|
||||
sizeof(ipv6_hdr_t),
|
||||
GNRC_NETTYPE_UNDEF);
|
||||
@ -1031,7 +1031,7 @@ static void test_rtr_adv_send__pktbuf_full1(void)
|
||||
/* don't be able to fit any more data into packet buffer
|
||||
* - 24 == sizeof(gnrc_pktsnip_t) + pktbuf internal padding */
|
||||
gnrc_pktsnip_t *tmp = gnrc_pktbuf_add(NULL, NULL,
|
||||
GNRC_PKTBUF_SIZE - 24,
|
||||
CONFIG_GNRC_PKTBUF_SIZE - 24,
|
||||
GNRC_NETTYPE_UNDEF);
|
||||
TEST_ASSERT_NOT_NULL(tmp);
|
||||
gnrc_ndp_rtr_adv_send(test_netif, &test_src, &test_dst, false, NULL);
|
||||
@ -1046,7 +1046,7 @@ static void test_rtr_adv_send__pktbuf_full2(void)
|
||||
* - 24 == sizeof(gnrc_pktsnip_t) + pktbuf internal padding
|
||||
* - 16 == size of SLLAO for IEEE 802.15.4 */
|
||||
gnrc_pktsnip_t *tmp = gnrc_pktbuf_add(NULL, NULL,
|
||||
GNRC_PKTBUF_SIZE - (2 * 24) - 16,
|
||||
CONFIG_GNRC_PKTBUF_SIZE - (2 * 24) - 16,
|
||||
GNRC_NETTYPE_UNDEF);
|
||||
TEST_ASSERT_NOT_NULL(tmp);
|
||||
gnrc_ndp_rtr_adv_send(test_netif, &test_src, &test_dst, false, NULL);
|
||||
@ -1061,7 +1061,7 @@ static void test_rtr_adv_send__pktbuf_full3(void)
|
||||
* - 24 == sizeof(gnrc_pktsnip_t) + pktbuf internal padding
|
||||
* - 16 == size of SLLAO for IEEE 802.15.4 */
|
||||
gnrc_pktsnip_t *tmp = gnrc_pktbuf_add(NULL, NULL,
|
||||
GNRC_PKTBUF_SIZE - (3 * 24) - 16 -
|
||||
CONFIG_GNRC_PKTBUF_SIZE - (3 * 24) - 16 -
|
||||
sizeof(ndp_rtr_adv_t),
|
||||
GNRC_NETTYPE_UNDEF);
|
||||
TEST_ASSERT_NOT_NULL(tmp);
|
||||
@ -1077,7 +1077,7 @@ static void test_rtr_adv_send__pktbuf_full4(void)
|
||||
* - 24 == sizeof(gnrc_pktsnip_t) + pktbuf internal padding
|
||||
* - 16 == size of SLLAO for IEEE 802.15.4 */
|
||||
gnrc_pktsnip_t *tmp = gnrc_pktbuf_add(NULL, NULL,
|
||||
GNRC_PKTBUF_SIZE - (4 * 24) - 16 -
|
||||
CONFIG_GNRC_PKTBUF_SIZE - (4 * 24) - 16 -
|
||||
sizeof(ndp_rtr_adv_t) -
|
||||
sizeof(ipv6_hdr_t),
|
||||
GNRC_NETTYPE_UNDEF);
|
||||
|
@ -7,6 +7,6 @@ USEMODULE += embunit
|
||||
DISABLE_MODULE += auto_init_gnrc_%
|
||||
|
||||
# we don't need all this packet buffer space so reduce it a little
|
||||
CFLAGS += -DTEST_SUITES -DGNRC_PKTBUF_SIZE=2048
|
||||
CFLAGS += -DTEST_SUITES -DCONFIG_GNRC_PKTBUF_SIZE=2048
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
@ -10,6 +10,6 @@ USEMODULE += netdev_test
|
||||
USEMODULE += od
|
||||
|
||||
# we don't need all this packet buffer space so reduce it a little
|
||||
CFLAGS += -DTEST_SUITES -DGNRC_PKTBUF_SIZE=2048
|
||||
CFLAGS += -DTEST_SUITES -DCONFIG_GNRC_PKTBUF_SIZE=2048
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
@ -10,7 +10,7 @@ USEMODULE += sock_async_event
|
||||
USEMODULE += od
|
||||
USEMODULE += xtimer
|
||||
|
||||
CFLAGS += -DSOCK_HAS_IPV6 -DGNRC_PKTBUF_SIZE=200
|
||||
CFLAGS += -DSOCK_HAS_IPV6 -DCONFIG_GNRC_PKTBUF_SIZE=200
|
||||
# mock IPv6 gnrc_nettype
|
||||
CFLAGS += -DTEST_SUITES -DGNRC_NETTYPE_IPV6=GNRC_NETTYPE_TEST
|
||||
|
||||
|
@ -31,7 +31,7 @@ USEMODULE += posix_inet
|
||||
LOW_MEMORY_BOARDS := nucleo-f334r8 msb-430 msb-430h
|
||||
|
||||
ifeq ($(BOARD),$(filter $(BOARD),$(LOW_MEMORY_BOARDS)))
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=512 -DCONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF=2 \
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=512 -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
|
||||
endif
|
||||
|
@ -4,7 +4,7 @@ USEMODULE += gnrc_sock_ip
|
||||
USEMODULE += gnrc_ipv6
|
||||
USEMODULE += ps
|
||||
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=200
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=200
|
||||
CFLAGS += -DTEST_SUITES
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
@ -7,6 +7,6 @@ USEMODULE += gnrc_sock_udp
|
||||
USEMODULE += od
|
||||
USEMODULE += xtimer
|
||||
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=200
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=200
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
@ -5,7 +5,7 @@ USEMODULE += gnrc_sock_udp
|
||||
USEMODULE += gnrc_ipv6
|
||||
USEMODULE += ps
|
||||
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=400
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=400
|
||||
CFLAGS += -DTEST_SUITES
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
@ -16,7 +16,7 @@ USEMODULE += ps
|
||||
USEMODULE += netstats_l2
|
||||
USEMODULE += netstats_ipv6
|
||||
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=8192
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=8192
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
|
@ -13,6 +13,6 @@ USEMODULE += netdev_eth
|
||||
USEMODULE += netdev_test
|
||||
USEMODULE += od
|
||||
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=200
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=200
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
@ -26,7 +26,7 @@ ifneq (,$(filter $(BOARD),$(LOW_MEMORY_BOARDS)))
|
||||
$(info Using low-memory configuration for microcoap_server.)
|
||||
## low-memory tuning values
|
||||
# lower pktbuf buffer size
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=1000
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=1000
|
||||
USEMODULE += prng_minstd
|
||||
endif
|
||||
|
||||
|
@ -39,7 +39,7 @@ ifneq (,$(filter $(BOARD),$(LOW_MEMORY_BOARDS)))
|
||||
$(info Using low-memory configuration for microcoap_server.)
|
||||
## low-memory tuning values
|
||||
# lower pktbuf buffer size
|
||||
CFLAGS += -DGNRC_PKTBUF_SIZE=1000
|
||||
CFLAGS += -DCONFIG_GNRC_PKTBUF_SIZE=1000
|
||||
USEMODULE += prng_minstd
|
||||
endif
|
||||
|
||||
|
@ -207,12 +207,12 @@ static void test_pktbuf_add__success(void)
|
||||
gnrc_pktsnip_t *pkt, *pkt_prev = NULL;
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
pkt = gnrc_pktbuf_add(NULL, NULL, (GNRC_PKTBUF_SIZE / 10) + 4, GNRC_NETTYPE_TEST);
|
||||
pkt = gnrc_pktbuf_add(NULL, NULL, (CONFIG_GNRC_PKTBUF_SIZE / 10) + 4, GNRC_NETTYPE_TEST);
|
||||
|
||||
TEST_ASSERT_NOT_NULL(pkt);
|
||||
TEST_ASSERT_NULL(pkt->next);
|
||||
TEST_ASSERT_NOT_NULL(pkt->data);
|
||||
TEST_ASSERT_EQUAL_INT((GNRC_PKTBUF_SIZE / 10) + 4, pkt->size);
|
||||
TEST_ASSERT_EQUAL_INT((CONFIG_GNRC_PKTBUF_SIZE / 10) + 4, pkt->size);
|
||||
TEST_ASSERT_EQUAL_INT(GNRC_NETTYPE_TEST, pkt->type);
|
||||
TEST_ASSERT_EQUAL_INT(1, pkt->users);
|
||||
|
||||
@ -509,12 +509,12 @@ static void test_pktbuf_realloc_data__size_0(void)
|
||||
TEST_ASSERT(gnrc_pktbuf_is_empty());
|
||||
}
|
||||
|
||||
#ifndef MODULE_GNRC_PKTBUF_MALLOC /* GNRC_PKTBUF_SIZE does not apply for gnrc_pktbuf_malloc */
|
||||
#ifndef MODULE_GNRC_PKTBUF_MALLOC /* CONFIG_GNRC_PKTBUF_SIZE does not apply for gnrc_pktbuf_malloc */
|
||||
static void test_pktbuf_realloc_data__memfull(void)
|
||||
{
|
||||
gnrc_pktsnip_t *pkt = gnrc_pktbuf_add(NULL, NULL, sizeof(TEST_STRING8), GNRC_NETTYPE_TEST);
|
||||
|
||||
TEST_ASSERT_EQUAL_INT(ENOMEM, gnrc_pktbuf_realloc_data(pkt, GNRC_PKTBUF_SIZE + 1));
|
||||
TEST_ASSERT_EQUAL_INT(ENOMEM, gnrc_pktbuf_realloc_data(pkt, CONFIG_GNRC_PKTBUF_SIZE + 1));
|
||||
gnrc_pktbuf_release(pkt);
|
||||
TEST_ASSERT(gnrc_pktbuf_is_empty());
|
||||
}
|
||||
@ -656,10 +656,10 @@ static void test_pktbuf_realloc_data__success3(void)
|
||||
#ifndef MODULE_GNRC_PKTBUF_MALLOC
|
||||
static void test_pktbuf_merge_data__memfull(void)
|
||||
{
|
||||
gnrc_pktsnip_t *pkt = gnrc_pktbuf_add(NULL, NULL, (GNRC_PKTBUF_SIZE / 4),
|
||||
gnrc_pktsnip_t *pkt = gnrc_pktbuf_add(NULL, NULL, (CONFIG_GNRC_PKTBUF_SIZE / 4),
|
||||
GNRC_NETTYPE_TEST);
|
||||
|
||||
pkt = gnrc_pktbuf_add(pkt, NULL, (GNRC_PKTBUF_SIZE / 4) + 1,
|
||||
pkt = gnrc_pktbuf_add(pkt, NULL, (CONFIG_GNRC_PKTBUF_SIZE / 4) + 1,
|
||||
GNRC_NETTYPE_TEST);
|
||||
TEST_ASSERT_EQUAL_INT(ENOMEM, gnrc_pktbuf_merge(pkt));
|
||||
gnrc_pktbuf_release(pkt);
|
||||
@ -817,7 +817,7 @@ static void test_pktbuf_start_write__pkt_users_2(void)
|
||||
static void test_pktbuf_reverse_snips__too_full(void)
|
||||
{
|
||||
gnrc_pktsnip_t *pkt, *pkt_next, *pkt_huge;
|
||||
const size_t pkt_huge_size = GNRC_PKTBUF_SIZE - (3 * 8) -
|
||||
const size_t pkt_huge_size = CONFIG_GNRC_PKTBUF_SIZE - (3 * 8) -
|
||||
(3 * sizeof(gnrc_pktsnip_t)) - 4;
|
||||
|
||||
pkt_next = gnrc_pktbuf_add(NULL, TEST_STRING8, 8, GNRC_NETTYPE_TEST);
|
||||
|
Loading…
Reference in New Issue
Block a user