From de99b99b3598c09e4249f4d34f34a6d48386c1c9 Mon Sep 17 00:00:00 2001 From: PeterKietzmann Date: Tue, 14 Jan 2020 12:08:25 +0100 Subject: [PATCH 01/11] Kconfig: Expose gnrc/sixlowpan configurations --- sys/net/gnrc/Kconfig | 1 + sys/net/gnrc/network_layer/sixlowpan/Kconfig | 23 ++++++++++ .../gnrc/network_layer/sixlowpan/frag/Kconfig | 14 +++++++ .../network_layer/sixlowpan/frag/fb/Kconfig | 22 ++++++++++ .../network_layer/sixlowpan/frag/rb/Kconfig | 42 +++++++++++++++++++ .../network_layer/sixlowpan/frag/vrb/Kconfig | 26 ++++++++++++ .../gnrc/network_layer/sixlowpan/nd/Kconfig | 24 +++++++++++ 7 files changed, 152 insertions(+) create mode 100644 sys/net/gnrc/network_layer/sixlowpan/Kconfig create mode 100644 sys/net/gnrc/network_layer/sixlowpan/frag/Kconfig create mode 100644 sys/net/gnrc/network_layer/sixlowpan/frag/fb/Kconfig create mode 100644 sys/net/gnrc/network_layer/sixlowpan/frag/rb/Kconfig create mode 100644 sys/net/gnrc/network_layer/sixlowpan/frag/vrb/Kconfig create mode 100644 sys/net/gnrc/network_layer/sixlowpan/nd/Kconfig diff --git a/sys/net/gnrc/Kconfig b/sys/net/gnrc/Kconfig index 9328153efa..4d986c9a68 100644 --- a/sys/net/gnrc/Kconfig +++ b/sys/net/gnrc/Kconfig @@ -12,5 +12,6 @@ rsource "netif/Kconfig" rsource "network_layer/ipv6/Kconfig" rsource "network_layer/ipv6/blacklist/Kconfig" rsource "network_layer/ipv6/whitelist/Kconfig" +rsource "network_layer/sixlowpan/Kconfig" endmenu # GNRC Network Stack diff --git a/sys/net/gnrc/network_layer/sixlowpan/Kconfig b/sys/net/gnrc/network_layer/sixlowpan/Kconfig new file mode 100644 index 0000000000..d38ae846f9 --- /dev/null +++ b/sys/net/gnrc/network_layer/sixlowpan/Kconfig @@ -0,0 +1,23 @@ +# Copyright (c) 2020 HAW Hamburg +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# + +menuconfig KCONFIG_MODULE_GNRC_SIXLOWPAN + bool "Configure GNRC 6LoWPAN" + depends on MODULE_GNRC_SIXLOWPAN + help + Configure GNRC 6LoWPAN module using Kconfig. + +if KCONFIG_MODULE_GNRC_SIXLOWPAN + +rsource "frag/Kconfig" +rsource "nd/Kconfig" + +config GNRC_SIXLOWPAN_MSG_QUEUE_SIZE + int "Message queue size for the 6LoWPAN thread" + default 8 + +endif # KCONFIG_MODULE_GNRC_SIXLOWPAN diff --git a/sys/net/gnrc/network_layer/sixlowpan/frag/Kconfig b/sys/net/gnrc/network_layer/sixlowpan/frag/Kconfig new file mode 100644 index 0000000000..71ca3f3a3d --- /dev/null +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/Kconfig @@ -0,0 +1,14 @@ +# Copyright (c) 2020 HAW Hamburg +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# + +if MODULE_GNRC_SIXLOWPAN_FRAG + +rsource "fb/Kconfig" +rsource "rb/Kconfig" +rsource "vrb/Kconfig" + +endif # MODULE_GNRC_SIXLOWPAN_FRAG diff --git a/sys/net/gnrc/network_layer/sixlowpan/frag/fb/Kconfig b/sys/net/gnrc/network_layer/sixlowpan/frag/fb/Kconfig new file mode 100644 index 0000000000..5309bc22b9 --- /dev/null +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/fb/Kconfig @@ -0,0 +1,22 @@ +# Copyright (c) 2020 HAW Hamburg +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# +menuconfig KCONFIG_MODULE_GNRC_SIXLOWPAN_FRAG_FB + bool "Configure GNRC 6LoWPAN Fragmentation buffer" + depends on MODULE_GNRC_SIXLOWPAN_FRAG_FB + help + Configure GNRC 6LoWPAN Fragmentation buffer using Kconfig. + +if KCONFIG_MODULE_GNRC_SIXLOWPAN_FRAG_FB + +config GNRC_SIXLOWPAN_FRAG_FB_SIZE + int "Number of datagrams that can be fragmented simultaneously" + default 1 + help + This determines the number of @ref gnrc_sixlowpan_frag_fb_t instances + available. + +endif # KCONFIG_MODULE_GNRC_SIXLOWPAN_FRAG_FB diff --git a/sys/net/gnrc/network_layer/sixlowpan/frag/rb/Kconfig b/sys/net/gnrc/network_layer/sixlowpan/frag/rb/Kconfig new file mode 100644 index 0000000000..c3c0051fd0 --- /dev/null +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/rb/Kconfig @@ -0,0 +1,42 @@ +# Copyright (c) 2020 HAW Hamburg +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# +menuconfig KCONFIG_MODULE_GNRC_SIXLOWPAN_FRAG_RB + bool "Configure GNRC 6LoWPAN Reassembly buffer" + depends on MODULE_GNRC_SIXLOWPAN_FRAG_RB + help + Configure GNRC 6LoWPAN Reassembly buffer using Kconfig. + +if KCONFIG_MODULE_GNRC_SIXLOWPAN_FRAG_RB + +config GNRC_SIXLOWPAN_FRAG_RBUF_SIZE + int "Size of the reassembly buffer" + default 4 + +config GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US + int "Timeout for reassembly buffer entries in microseconds" + default 3000000 + +config GNRC_SIXLOWPAN_FRAG_RBUF_DO_NOT_OVERRIDE + bool "Keep all but oldest fragment when reassembly buffer is full" + help + When not set, it will cause the reassembly buffer to + override the oldest entry no matter what. When set, only the oldest + entry that is older than @ref CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US + will be overwritten (they will still timeout normally if reassembly + buffer is not full). + +config GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER + int "Deletion timer for reassembly buffer entries in microseconds" + default 0 + help + Time to pass between completion of a datagram and the deletion + of its reassembly buffer entry. If this value is 0, the entry + is dropped immediately. Use this value to prevent re-creation + of a reassembly buffer entry on late arriving link-layer + uplicates. + +endif # KCONFIG_MODULE_GNRC_SIXLOWPAN_FRAG_RB diff --git a/sys/net/gnrc/network_layer/sixlowpan/frag/vrb/Kconfig b/sys/net/gnrc/network_layer/sixlowpan/frag/vrb/Kconfig new file mode 100644 index 0000000000..6a2d54660b --- /dev/null +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/vrb/Kconfig @@ -0,0 +1,26 @@ +# Copyright (c) 2020 HAW Hamburg +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# +menuconfig KCONFIG_MODULE_GNRC_SIXLOWPAN_FRAG_VRB + bool "Configure GNRC 6LoWPAN Virtual reassembly buffer" + depends on MODULE_GNRC_SIXLOWPAN_FRAG_VRB + help + Configure GNRC 6LoWPAN Virtual reassembly buffer module using Kconfig. + +if KCONFIG_MODULE_GNRC_SIXLOWPAN_FRAG_VRB + +config GNRC_SIXLOWPAN_FRAG_VRB_SIZE + int "Size of the virtual reassembly buffer" + default 16 + help + Has a direct influence on the number of available + gnrc_sixlowpan_frag_rb_int_t entries. + +config GNRC_SIXLOWPAN_FRAG_VRB_TIMEOUT_US + int "Timeout for a virtual reassembly buffer entry in microseconds" + default 3000000 + +endif # KCONFIG_MODULE_GNRC_SIXLOWPAN_FRAG_VRB diff --git a/sys/net/gnrc/network_layer/sixlowpan/nd/Kconfig b/sys/net/gnrc/network_layer/sixlowpan/nd/Kconfig new file mode 100644 index 0000000000..d948969a18 --- /dev/null +++ b/sys/net/gnrc/network_layer/sixlowpan/nd/Kconfig @@ -0,0 +1,24 @@ +# Copyright (c) 2020 HAW Hamburg +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# +menuconfig KCONFIG_MODULE_GNRC_SIXLOWPAN_ND + bool "Configure GNRC 6LoWPAN Neighbor Discovery" + depends on MODULE_GNRC_SIXLOWPAN_ND + help + Configure GNRC 6LoWPAN Neighbor Discovery module using Kconfig. + +if KCONFIG_MODULE_GNRC_SIXLOWPAN_ND + +config GNRC_SIXLOWPAN_ND_AR_LTIME + int "Registration lifetime for the address registration option in minutes" + depends on MODULE_GNRC_IPV6_NIB + default 15 + help + This value should be adapted to the devices power-lifecycle so that it is + greater than the time the device spends sleeping. See RFC 6775, section + 5.8.1. + +endif # KCONFIG_MODULE_GNRC_SIXLOWPAN_ND From b5ea3122e748255281aac0441f761bcade0e9ba5 Mon Sep 17 00:00:00 2001 From: PeterKietzmann Date: Tue, 14 Jan 2020 12:12:30 +0100 Subject: [PATCH 02/11] net/gnrc/sixlowpan:Move queue size macro to 'CONFIG_' namespace --- sys/include/net/gnrc/sixlowpan/config.h | 4 ++-- sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/include/net/gnrc/sixlowpan/config.h b/sys/include/net/gnrc/sixlowpan/config.h index 2f9aa5e6a0..e0edbf4b9a 100644 --- a/sys/include/net/gnrc/sixlowpan/config.h +++ b/sys/include/net/gnrc/sixlowpan/config.h @@ -45,8 +45,8 @@ extern "C" { /** * @brief Default message queue size to use for the 6LoWPAN thread. */ -#ifndef GNRC_SIXLOWPAN_MSG_QUEUE_SIZE -#define GNRC_SIXLOWPAN_MSG_QUEUE_SIZE (8U) +#ifndef CONFIG_GNRC_SIXLOWPAN_MSG_QUEUE_SIZE +#define CONFIG_GNRC_SIXLOWPAN_MSG_QUEUE_SIZE (8U) #endif /** diff --git a/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c b/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c index 6ecd314af6..ffdeb6b8bc 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c +++ b/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c @@ -308,12 +308,12 @@ static void _send(gnrc_pktsnip_t *pkt) static void *_event_loop(void *args) { - msg_t msg, reply, msg_q[GNRC_SIXLOWPAN_MSG_QUEUE_SIZE]; + msg_t msg, reply, msg_q[CONFIG_GNRC_SIXLOWPAN_MSG_QUEUE_SIZE]; gnrc_netreg_entry_t me_reg = GNRC_NETREG_ENTRY_INIT_PID(GNRC_NETREG_DEMUX_CTX_ALL, sched_active_pid); (void)args; - msg_init_queue(msg_q, GNRC_SIXLOWPAN_MSG_QUEUE_SIZE); + msg_init_queue(msg_q, CONFIG_GNRC_SIXLOWPAN_MSG_QUEUE_SIZE); /* register interest in all 6LoWPAN packets */ gnrc_netreg_register(GNRC_NETTYPE_SIXLOWPAN, &me_reg); From 89af238eec0078f059ca544dd78e0ce4a6ad12d1 Mon Sep 17 00:00:00 2001 From: PeterKietzmann Date: Tue, 14 Jan 2020 12:16:03 +0100 Subject: [PATCH 03/11] net/gnrc/sixlowpan/frag/fb:Move size macro to 'CONFIG_' namespace --- sys/include/net/gnrc/sixlowpan/config.h | 4 ++-- .../sixlowpan/frag/fb/gnrc_sixlowpan_frag_fb.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/include/net/gnrc/sixlowpan/config.h b/sys/include/net/gnrc/sixlowpan/config.h index e0edbf4b9a..f2eaa4a8b5 100644 --- a/sys/include/net/gnrc/sixlowpan/config.h +++ b/sys/include/net/gnrc/sixlowpan/config.h @@ -58,8 +58,8 @@ extern "C" { * @note Only applicable with * [gnrc_sixlowpan_frag_fb](@ref net_gnrc_sixlowpan_frag_fb) module */ -#ifndef GNRC_SIXLOWPAN_FRAG_FB_SIZE -#define GNRC_SIXLOWPAN_FRAG_FB_SIZE (1U) +#ifndef CONFIG_GNRC_SIXLOWPAN_FRAG_FB_SIZE +#define CONFIG_GNRC_SIXLOWPAN_FRAG_FB_SIZE (1U) #endif /** diff --git a/sys/net/gnrc/network_layer/sixlowpan/frag/fb/gnrc_sixlowpan_frag_fb.c b/sys/net/gnrc/network_layer/sixlowpan/frag/fb/gnrc_sixlowpan_frag_fb.c index aca899411b..920e21f27b 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/frag/fb/gnrc_sixlowpan_frag_fb.c +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/fb/gnrc_sixlowpan_frag_fb.c @@ -22,7 +22,7 @@ #include "net/gnrc/sixlowpan/frag/stats.h" #endif -static gnrc_sixlowpan_frag_fb_t _fbs[GNRC_SIXLOWPAN_FRAG_FB_SIZE]; +static gnrc_sixlowpan_frag_fb_t _fbs[CONFIG_GNRC_SIXLOWPAN_FRAG_FB_SIZE]; static uint16_t _current_tag; #ifdef TEST_SUITES @@ -35,7 +35,7 @@ void gnrc_sixlowpan_frag_fb_reset(void) gnrc_sixlowpan_frag_fb_t *gnrc_sixlowpan_frag_fb_get(void) { - for (unsigned i = 0; i < GNRC_SIXLOWPAN_FRAG_FB_SIZE; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_FB_SIZE; i++) { if (_fbs[i].pkt == NULL) { return &_fbs[i]; } @@ -48,7 +48,7 @@ gnrc_sixlowpan_frag_fb_t *gnrc_sixlowpan_frag_fb_get(void) gnrc_sixlowpan_frag_fb_t *gnrc_sixlowpan_frag_fb_get_by_tag(uint16_t tag) { - for (unsigned i = 0; i < GNRC_SIXLOWPAN_FRAG_FB_SIZE; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_FB_SIZE; i++) { if ((_fbs[i].pkt != NULL) && (_fbs[i].tag == tag)) { return &_fbs[i]; } From 9389d5b90fdcc9e21bcb3eb0106497ed25733072 Mon Sep 17 00:00:00 2001 From: PeterKietzmann Date: Tue, 14 Jan 2020 12:19:37 +0100 Subject: [PATCH 04/11] net/gnrc/sixlowpan/frag/rb:Move size macro to 'CONFIG_' namespace --- sys/include/net/gnrc/sixlowpan/config.h | 4 ++-- .../sixlowpan/frag/rb/gnrc_sixlowpan_frag_rb.c | 12 ++++++------ tests/gnrc_sixlowpan_frag/main.c | 10 +++++----- tests/gnrc_sixlowpan_iphc_w_vrb/main.c | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sys/include/net/gnrc/sixlowpan/config.h b/sys/include/net/gnrc/sixlowpan/config.h index f2eaa4a8b5..bf500b2a82 100644 --- a/sys/include/net/gnrc/sixlowpan/config.h +++ b/sys/include/net/gnrc/sixlowpan/config.h @@ -68,8 +68,8 @@ extern "C" { * @note Only applicable with * [gnrc_sixlowpan_frag_rb](@ref net_gnrc_sixlowpan_frag_rb) module */ -#ifndef GNRC_SIXLOWPAN_FRAG_RBUF_SIZE -#define GNRC_SIXLOWPAN_FRAG_RBUF_SIZE (4U) +#ifndef CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_SIZE +#define CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_SIZE (4U) #endif /** diff --git a/sys/net/gnrc/network_layer/sixlowpan/frag/rb/gnrc_sixlowpan_frag_rb.c b/sys/net/gnrc/network_layer/sixlowpan/frag/rb/gnrc_sixlowpan_frag_rb.c index a2fe7c937a..736b56a590 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/frag/rb/gnrc_sixlowpan_frag_rb.c +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/rb/gnrc_sixlowpan_frag_rb.c @@ -49,12 +49,12 @@ /* same as ((int) ceil((double) N / D)) */ #define DIV_CEIL(N, D) (((N) + (D) - 1) / (D)) #define RBUF_INT_SIZE (DIV_CEIL(IPV6_MIN_MTU, GNRC_SIXLOWPAN_FRAG_SIZE) * \ - GNRC_SIXLOWPAN_FRAG_RBUF_SIZE) + CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_SIZE) #endif static gnrc_sixlowpan_frag_rb_int_t rbuf_int[RBUF_INT_SIZE]; -static gnrc_sixlowpan_frag_rb_t rbuf[GNRC_SIXLOWPAN_FRAG_RBUF_SIZE]; +static gnrc_sixlowpan_frag_rb_t rbuf[CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_SIZE]; static char l2addr_str[3 * IEEE802154_LONG_ADDRESS_LEN]; @@ -164,7 +164,7 @@ static gnrc_sixlowpan_frag_rb_t *_rbuf_get_by_tag(const gnrc_netif_hdr_t *netif_ const uint8_t src_len = netif_hdr->src_l2addr_len; const uint8_t dst_len = netif_hdr->dst_l2addr_len; - for (unsigned i = 0; i < GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { gnrc_sixlowpan_frag_rb_t *e = &rbuf[i]; if ((e->pkt != NULL) && (e->super.tag == tag) && @@ -379,7 +379,7 @@ void gnrc_sixlowpan_frag_rb_gc(void) uint32_t now_usec = xtimer_now_usec(); unsigned int i; - for (i = 0; i < GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { + for (i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { /* since pkt occupies pktbuf, aggressivly collect garbage */ if (!gnrc_sixlowpan_frag_rb_entry_empty(&rbuf[i]) && ((now_usec - rbuf[i].super.arrival) > @@ -417,7 +417,7 @@ static int _rbuf_get(const void *src, size_t src_len, gnrc_sixlowpan_frag_rb_t *res = NULL, *oldest = NULL; uint32_t now_usec = xtimer_now_usec(); - for (unsigned int i = 0; i < GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { + for (unsigned int i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { /* check first if entry already available */ if ((rbuf[i].pkt != NULL) && (rbuf[i].super.datagram_size == size) && (rbuf[i].super.tag == tag) && (rbuf[i].super.src_len == src_len) && @@ -533,7 +533,7 @@ void gnrc_sixlowpan_frag_rb_reset(void) { xtimer_remove(&_gc_timer); memset(rbuf_int, 0, sizeof(rbuf_int)); - for (unsigned int i = 0; i < GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { + for (unsigned int i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { if ((rbuf[i].pkt != NULL) && (rbuf[i].pkt->users > 0)) { _gc_pkt(&rbuf[i]); diff --git a/tests/gnrc_sixlowpan_frag/main.c b/tests/gnrc_sixlowpan_frag/main.c index 2eeda6f503..e288ba2db1 100644 --- a/tests/gnrc_sixlowpan_frag/main.c +++ b/tests/gnrc_sixlowpan_frag/main.c @@ -210,7 +210,7 @@ static const gnrc_sixlowpan_frag_rb_t *_first_non_empty_rbuf(void) { const gnrc_sixlowpan_frag_rb_t *rbuf = gnrc_sixlowpan_frag_rb_array(); - for (unsigned i = 0; i < GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { if (!gnrc_sixlowpan_frag_rb_entry_empty(&rbuf[i])) { return rbuf; } @@ -390,7 +390,7 @@ static void test_rbuf_add__full_rbuf(void) gnrc_pktsnip_t *pkt; const gnrc_sixlowpan_frag_rb_t *rbuf; - for (unsigned i = 0; i < GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { pkt = gnrc_pktbuf_add(NULL, _fragment1, sizeof(_fragment1), GNRC_NETTYPE_SIXLOWPAN); TEST_ASSERT_NOT_NULL(pkt); @@ -407,7 +407,7 @@ static void test_rbuf_add__full_rbuf(void) &_test_netif_hdr.hdr, pkt, TEST_FRAGMENT1_OFFSET, TEST_PAGE )); rbuf = gnrc_sixlowpan_frag_rb_array(); - for (unsigned i = 0; i < GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { const gnrc_sixlowpan_frag_rb_t *entry = &rbuf[i]; TEST_ASSERT_MESSAGE(!gnrc_sixlowpan_frag_rb_entry_empty(entry), @@ -467,7 +467,7 @@ static void test_rbuf_add__overlap_lhs(void) &_test_netif_hdr.hdr, pkt2, pkt2_offset, TEST_PAGE )); rbuf = gnrc_sixlowpan_frag_rb_array(); - for (unsigned i = 0; i < GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { const gnrc_sixlowpan_frag_rb_t *entry = &rbuf[i]; if (!gnrc_sixlowpan_frag_rb_entry_empty(entry)) { static const size_t pkt3_offset = TEST_FRAGMENT3_OFFSET - 8U - 1; @@ -516,7 +516,7 @@ static void test_rbuf_add__overlap_rhs(void) &_test_netif_hdr.hdr, pkt2, pkt2_offset, TEST_PAGE )); rbuf = gnrc_sixlowpan_frag_rb_array(); - for (unsigned i = 0; i < GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { const gnrc_sixlowpan_frag_rb_t *entry = &rbuf[i]; if (!gnrc_sixlowpan_frag_rb_entry_empty(entry)) { static const size_t pkt3_offset = TEST_FRAGMENT3_OFFSET + 8U - 1U; diff --git a/tests/gnrc_sixlowpan_iphc_w_vrb/main.c b/tests/gnrc_sixlowpan_iphc_w_vrb/main.c index 3fb71a3d30..88e352724a 100644 --- a/tests/gnrc_sixlowpan_iphc_w_vrb/main.c +++ b/tests/gnrc_sixlowpan_iphc_w_vrb/main.c @@ -142,7 +142,7 @@ static bool _rb_is_empty(void) const gnrc_sixlowpan_frag_rb_t *rb = gnrc_sixlowpan_frag_rb_array(); unsigned res = 0; - for (unsigned i = 0; i < GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { res += gnrc_sixlowpan_frag_rb_entry_empty(&rb[i]); } return res; @@ -158,7 +158,7 @@ static void _test_no_vrbe_but_rbe_exists(void) sizeof(_test_src), TEST_TAG)); /* and one reassembly buffer entry exists with the source and tag exists */ - for (unsigned i = 0; i < GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_SIZE; i++) { if (!gnrc_sixlowpan_frag_rb_entry_empty(&rb[i])) { rbs++; TEST_ASSERT_EQUAL_INT(sizeof(_test_src), rb[i].super.src_len); From 811facfa1581ceaed221c6210ba746e5f11af5da Mon Sep 17 00:00:00 2001 From: PeterKietzmann Date: Tue, 14 Jan 2020 12:22:57 +0100 Subject: [PATCH 05/11] net/gnrc/sixlowpan/frag/rb:Move timeout macro to 'CONFIG_' namespace --- sys/include/net/gnrc/sixlowpan/config.h | 6 +++--- .../sixlowpan/frag/rb/gnrc_sixlowpan_frag_rb.c | 10 +++++----- tests/gnrc_sixlowpan_frag/main.c | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sys/include/net/gnrc/sixlowpan/config.h b/sys/include/net/gnrc/sixlowpan/config.h index bf500b2a82..5401d3afd7 100644 --- a/sys/include/net/gnrc/sixlowpan/config.h +++ b/sys/include/net/gnrc/sixlowpan/config.h @@ -78,8 +78,8 @@ extern "C" { * @note Only applicable with * [gnrc_sixlowpan_frag_rb](@ref net_gnrc_sixlowpan_frag_rb) module */ -#ifndef GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US -#define GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US (3U * US_PER_SEC) +#ifndef CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US +#define CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US (3U * US_PER_SEC) #endif /** @@ -106,7 +106,7 @@ extern "C" { * * When set to a non-zero value this will cause the reassembly buffer to * override the oldest entry no matter what. When set to zero only the oldest - * entry that is older than @ref GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US will be + * entry that is older than @ref CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US will be * overwritten (they will still timeout normally if reassembly buffer is not * full). * diff --git a/sys/net/gnrc/network_layer/sixlowpan/frag/rb/gnrc_sixlowpan_frag_rb.c b/sys/net/gnrc/network_layer/sixlowpan/frag/rb/gnrc_sixlowpan_frag_rb.c index 736b56a590..59af193f5d 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/frag/rb/gnrc_sixlowpan_frag_rb.c +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/rb/gnrc_sixlowpan_frag_rb.c @@ -383,7 +383,7 @@ void gnrc_sixlowpan_frag_rb_gc(void) /* since pkt occupies pktbuf, aggressivly collect garbage */ if (!gnrc_sixlowpan_frag_rb_entry_empty(&rbuf[i]) && ((now_usec - rbuf[i].super.arrival) > - GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US)) { + CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US)) { DEBUG("6lo rfrag: entry (%s, ", gnrc_netif_addr_to_str(rbuf[i].super.src, rbuf[i].super.src_len, @@ -405,7 +405,7 @@ void gnrc_sixlowpan_frag_rb_gc(void) static inline void _set_rbuf_timeout(void) { - xtimer_set_msg(&_gc_timer, GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US, + xtimer_set_msg(&_gc_timer, CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US, &_gc_timer_msg, sched_active_pid); } @@ -467,7 +467,7 @@ static int _rbuf_get(const void *src, size_t src_len, assert(!gnrc_sixlowpan_frag_rb_entry_empty(oldest)); if (GNRC_SIXLOWPAN_FRAG_RBUF_AGGRESSIVE_OVERRIDE || ((now_usec - oldest->super.arrival) > - GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US)) { + CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US)) { DEBUG("6lo rfrag: reassembly buffer full, remove oldest entry\n"); gnrc_pktbuf_release(oldest->pkt); gnrc_sixlowpan_frag_rb_remove(oldest); @@ -567,10 +567,10 @@ static void _tmp_rm(gnrc_sixlowpan_frag_rb_t *rbuf) /* use garbage-collection to leave the entry for at least * GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER in the reassembly buffer by * setting the arrival time to - * (GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US - GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER) + * (CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US - GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER) * microseconds in the past */ rbuf->super.arrival = xtimer_now_usec() - - (GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US - + (CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US - GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER); /* reset current size to prevent late duplicates to trigger another * dispatch */ diff --git a/tests/gnrc_sixlowpan_frag/main.c b/tests/gnrc_sixlowpan_frag/main.c index e288ba2db1..51f1d69d63 100644 --- a/tests/gnrc_sixlowpan_frag/main.c +++ b/tests/gnrc_sixlowpan_frag/main.c @@ -35,7 +35,7 @@ #define TEST_TAG (0x690e) #define TEST_PAGE (0) #define TEST_RECEIVE_TIMEOUT (100U) -#define TEST_GC_TIMEOUT (GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US + TEST_RECEIVE_TIMEOUT) +#define TEST_GC_TIMEOUT (CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US + TEST_RECEIVE_TIMEOUT) /* test date taken from an experimental run (uncompressed ICMPv6 echo reply with * 300 byte payload)*/ @@ -591,8 +591,8 @@ static void test_rbuf_gc__manually(void) &_test_netif_hdr.hdr, pkt, TEST_FRAGMENT1_OFFSET, TEST_PAGE ))); TEST_ASSERT_NOT_NULL(entry); - /* set arrival GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US into the past */ - entry->super.arrival -= GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US; + /* set arrival CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US into the past */ + entry->super.arrival -= CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US; gnrc_sixlowpan_frag_rb_gc(); /* reassembly buffer is now empty */ TEST_ASSERT_NULL(_first_non_empty_rbuf()); From 582779a7a0cc4a581f8edf59db0f658c151ee5e4 Mon Sep 17 00:00:00 2001 From: PeterKietzmann Date: Tue, 14 Jan 2020 12:27:24 +0100 Subject: [PATCH 06/11] net/gnrc/sixlowpan/frag/rb:Move del. timer macro to 'CONFIG_' namespace --- sys/include/net/gnrc/sixlowpan/config.h | 4 ++-- .../sixlowpan/frag/rb/gnrc_sixlowpan_frag_rb.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sys/include/net/gnrc/sixlowpan/config.h b/sys/include/net/gnrc/sixlowpan/config.h index 5401d3afd7..0388313a33 100644 --- a/sys/include/net/gnrc/sixlowpan/config.h +++ b/sys/include/net/gnrc/sixlowpan/config.h @@ -132,8 +132,8 @@ extern "C" { * immediately. Use this value to prevent re-creation of a reassembly buffer * entry on late arriving link-layer duplicates. */ -#ifndef GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER -#define GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER (0U) +#ifndef CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER +#define CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER (0U) #endif /** diff --git a/sys/net/gnrc/network_layer/sixlowpan/frag/rb/gnrc_sixlowpan_frag_rb.c b/sys/net/gnrc/network_layer/sixlowpan/frag/rb/gnrc_sixlowpan_frag_rb.c index 59af193f5d..c4cd26d8ee 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/frag/rb/gnrc_sixlowpan_frag_rb.c +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/rb/gnrc_sixlowpan_frag_rb.c @@ -364,7 +364,7 @@ static bool _rbuf_update_ints(gnrc_sixlowpan_frag_rb_base_t *entry, static void _gc_pkt(gnrc_sixlowpan_frag_rb_t *rbuf) { -#if GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER > 0 +#if CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER > 0 if (rbuf->super.current_size == 0) { /* packet is scheduled for deletion, but was complete, i.e. pkt is * already handed up to other layer, i.e. no need to release */ @@ -433,7 +433,7 @@ static int _rbuf_get(const void *src, size_t src_len, rbuf[i].super.dst_len, l2addr_str), (unsigned)rbuf[i].super.datagram_size, rbuf[i].super.tag); -#if GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER > 0 +#if CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER > 0 if (rbuf[i].super.current_size == 0) { /* ensure that only empty reassembly buffer entries and entries * scheduled for deletion have `current_size == 0` */ @@ -563,21 +563,21 @@ void gnrc_sixlowpan_frag_rb_base_rm(gnrc_sixlowpan_frag_rb_base_t *entry) static void _tmp_rm(gnrc_sixlowpan_frag_rb_t *rbuf) { -#if GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER > 0U +#if CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER > 0U /* use garbage-collection to leave the entry for at least - * GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER in the reassembly buffer by + * CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER in the reassembly buffer by * setting the arrival time to - * (CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US - GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER) + * (CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US - CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER) * microseconds in the past */ rbuf->super.arrival = xtimer_now_usec() - (CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US - - GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER); + CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER); /* reset current size to prevent late duplicates to trigger another * dispatch */ rbuf->super.current_size = 0; -#else /* GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER == 0U */ +#else /* CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER == 0U */ gnrc_sixlowpan_frag_rb_remove(rbuf); -#endif /* GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER */ +#endif /* CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_DEL_TIMER */ } int gnrc_sixlowpan_frag_rb_dispatch_when_complete(gnrc_sixlowpan_frag_rb_t *rbuf, From 7d2c9ef418af4828eaf9ec907fc3358428b022ab Mon Sep 17 00:00:00 2001 From: PeterKietzmann Date: Tue, 14 Jan 2020 12:29:31 +0100 Subject: [PATCH 07/11] net/gnrc/sixlowpan/nd:Move ND time macro to 'CONFIG_' namespace --- sys/include/net/gnrc/sixlowpan/config.h | 4 ++-- sys/include/net/gnrc/sixlowpan/nd.h | 4 ++-- sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/include/net/gnrc/sixlowpan/config.h b/sys/include/net/gnrc/sixlowpan/config.h index 0388313a33..addba0d7db 100644 --- a/sys/include/net/gnrc/sixlowpan/config.h +++ b/sys/include/net/gnrc/sixlowpan/config.h @@ -150,8 +150,8 @@ extern "C" { * provides capabilities to build the address registration option as a * @ref gnrc_pktsnip_t */ -#ifndef GNRC_SIXLOWPAN_ND_AR_LTIME -#define GNRC_SIXLOWPAN_ND_AR_LTIME (15U) +#ifndef CONFIG_GNRC_SIXLOWPAN_ND_AR_LTIME +#define CONFIG_GNRC_SIXLOWPAN_ND_AR_LTIME (15U) #endif /** diff --git a/sys/include/net/gnrc/sixlowpan/nd.h b/sys/include/net/gnrc/sixlowpan/nd.h index 67ae239e0d..5cb1e300e4 100644 --- a/sys/include/net/gnrc/sixlowpan/nd.h +++ b/sys/include/net/gnrc/sixlowpan/nd.h @@ -36,7 +36,7 @@ extern "C" { #endif -#ifndef GNRC_SIXLOWPAN_ND_AR_LTIME +#ifndef CONFIG_GNRC_SIXLOWPAN_ND_AR_LTIME /** * @brief Registration lifetime in minutes for the address registration option * @@ -47,7 +47,7 @@ extern "C" { * RFC 6775, section 5.8.1 * */ -#define GNRC_SIXLOWPAN_ND_AR_LTIME (15U) +#define CONFIG_GNRC_SIXLOWPAN_ND_AR_LTIME (15U) #endif /** diff --git a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c index c4ecf556bc..429b6566e7 100644 --- a/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c +++ b/sys/net/gnrc/network_layer/ipv6/nib/_nib-arsm.c @@ -50,7 +50,7 @@ void _snd_ns(const ipv6_addr_t *tgt, gnrc_netif_t *netif, DEBUG("nib: can't get EUI-64 of the interface for ARO\n"); return; } - ext_opt = gnrc_sixlowpan_nd_opt_ar_build(0, GNRC_SIXLOWPAN_ND_AR_LTIME, + ext_opt = gnrc_sixlowpan_nd_opt_ar_build(0, CONFIG_GNRC_SIXLOWPAN_ND_AR_LTIME, &eui64, NULL); if (ext_opt == NULL) { DEBUG("nib: error allocating ARO.\n"); From a3f349c991c0981ea022334c83b8e0eb12cd80cf Mon Sep 17 00:00:00 2001 From: PeterKietzmann Date: Fri, 17 Jan 2020 18:07:38 +0100 Subject: [PATCH 08/11] net/gnrc/sixlowpan/nd: remove duplicate definition --- sys/include/net/gnrc/sixlowpan/nd.h | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/sys/include/net/gnrc/sixlowpan/nd.h b/sys/include/net/gnrc/sixlowpan/nd.h index 5cb1e300e4..ef98c2d869 100644 --- a/sys/include/net/gnrc/sixlowpan/nd.h +++ b/sys/include/net/gnrc/sixlowpan/nd.h @@ -27,6 +27,7 @@ #include "kernel_types.h" #include "net/gnrc/pkt.h" +#include "net/gnrc/sixlowpan/config.h" #include "net/ipv6/addr.h" #include "net/ndp.h" #include "net/sixlowpan/nd.h" @@ -36,20 +37,6 @@ extern "C" { #endif -#ifndef CONFIG_GNRC_SIXLOWPAN_ND_AR_LTIME -/** - * @brief Registration lifetime in minutes for the address registration option - * - * This value should be adapted to the devices power-lifecycle so that it is greater than the - * time the device spends sleeping. - * - * @see - * RFC 6775, section 5.8.1 - * - */ -#define CONFIG_GNRC_SIXLOWPAN_ND_AR_LTIME (15U) -#endif - /** * @brief Builds the address registration option. * From cc6bee498664a1d1591cf3eb4700db67cea20ac0 Mon Sep 17 00:00:00 2001 From: PeterKietzmann Date: Tue, 14 Jan 2020 12:31:49 +0100 Subject: [PATCH 09/11] net/gnrc/sixlowpan/frag/vrb:Move size macro to 'CONFIG_' namespace --- sys/include/net/gnrc/sixlowpan/config.h | 13 ++++--------- .../sixlowpan/frag/vrb/gnrc_sixlowpan_frag_vrb.c | 8 ++++---- tests/gnrc_sixlowpan_iphc_w_vrb/main.c | 2 +- .../tests-gnrc_sixlowpan_frag_vrb.c | 2 +- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/sys/include/net/gnrc/sixlowpan/config.h b/sys/include/net/gnrc/sixlowpan/config.h index addba0d7db..c5cf5d1da0 100644 --- a/sys/include/net/gnrc/sixlowpan/config.h +++ b/sys/include/net/gnrc/sixlowpan/config.h @@ -162,16 +162,11 @@ extern "C" { * @note Only applicable with * [gnrc_sixlowpan_frag_vrb](@ref net_gnrc_sixlowpan_frag_vrb) module, * but has also a direct influence on the number of available - * gnrc_sixlowpan_frag_rb_int_t entries (even when - * `gnrc_sixlowpan_frag_vrb` is not compiled in). + * gnrc_sixlowpan_frag_rb_int_t entries. */ -#ifndef GNRC_SIXLOWPAN_FRAG_VRB_SIZE -#if defined(MODULE_GNRC_SIXLOWPAN_FRAG_VRB) || defined(DOXYGEN) -#define GNRC_SIXLOWPAN_FRAG_VRB_SIZE (16U) -#else /* defined(MODULE_GNRC_SIXLOWPAN_FRAG_VRB) || defined(DOXYGEN) */ -#define GNRC_SIXLOWPAN_FRAG_VRB_SIZE (0U) -#endif /* defined(MODULE_GNRC_SIXLOWPAN_FRAG_VRB) || defined(DOXYGEN) */ -#endif /* GNRC_SIXLOWPAN_FRAG_VRB_SIZE */ +#ifndef CONFIG_GNRC_SIXLOWPAN_FRAG_VRB_SIZE +#define CONFIG_GNRC_SIXLOWPAN_FRAG_VRB_SIZE (16U) +#endif /* CONFIG_GNRC_SIXLOWPAN_FRAG_VRB_SIZE */ /** * @brief Timeout for a VRB entry in microseconds diff --git a/sys/net/gnrc/network_layer/sixlowpan/frag/vrb/gnrc_sixlowpan_frag_vrb.c b/sys/net/gnrc/network_layer/sixlowpan/frag/vrb/gnrc_sixlowpan_frag_vrb.c index dac87c3984..1c9cffe625 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/frag/vrb/gnrc_sixlowpan_frag_vrb.c +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/vrb/gnrc_sixlowpan_frag_vrb.c @@ -30,7 +30,7 @@ #define ENABLE_DEBUG (0) #include "debug.h" -static gnrc_sixlowpan_frag_vrb_t _vrb[GNRC_SIXLOWPAN_FRAG_VRB_SIZE]; +static gnrc_sixlowpan_frag_vrb_t _vrb[CONFIG_GNRC_SIXLOWPAN_FRAG_VRB_SIZE]; #ifdef MODULE_GNRC_IPV6_NIB static char addr_str[IPV6_ADDR_MAX_STR_LEN]; #else /* MODULE_GNRC_IPV6_NIB */ @@ -57,7 +57,7 @@ gnrc_sixlowpan_frag_vrb_t *gnrc_sixlowpan_frag_vrb_add( assert(out_netif != NULL); assert(out_dst != NULL); assert(out_dst_len > 0); - for (unsigned i = 0; i < GNRC_SIXLOWPAN_FRAG_VRB_SIZE; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_VRB_SIZE; i++) { gnrc_sixlowpan_frag_vrb_t *ptr = &_vrb[i]; if (gnrc_sixlowpan_frag_vrb_entry_empty(ptr) || @@ -171,7 +171,7 @@ gnrc_sixlowpan_frag_vrb_t *gnrc_sixlowpan_frag_vrb_get( { DEBUG("6lo vrb: trying to get entry for (%s, %u)\n", gnrc_netif_addr_to_str(src, src_len, addr_str), src_tag); - for (unsigned i = 0; i < GNRC_SIXLOWPAN_FRAG_VRB_SIZE; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_VRB_SIZE; i++) { gnrc_sixlowpan_frag_vrb_t *vrbe = &_vrb[i]; if (_equal_index(vrbe, src, src_len, src_tag)) { @@ -190,7 +190,7 @@ void gnrc_sixlowpan_frag_vrb_gc(void) { uint32_t now_usec = xtimer_now_usec(); - for (unsigned i = 0; i < GNRC_SIXLOWPAN_FRAG_VRB_SIZE; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_VRB_SIZE; i++) { if (!gnrc_sixlowpan_frag_vrb_entry_empty(&_vrb[i]) && (now_usec - _vrb[i].super.arrival) > GNRC_SIXLOWPAN_FRAG_VRB_TIMEOUT_US) { DEBUG("6lo vrb: entry (%s, ", diff --git a/tests/gnrc_sixlowpan_iphc_w_vrb/main.c b/tests/gnrc_sixlowpan_iphc_w_vrb/main.c index 88e352724a..40ee2706ad 100644 --- a/tests/gnrc_sixlowpan_iphc_w_vrb/main.c +++ b/tests/gnrc_sixlowpan_iphc_w_vrb/main.c @@ -208,7 +208,7 @@ static void test_recv__vrb_full(void) TEST_ASSERT_NOT_NULL(pkt); /* Fill up VRB */ - for (unsigned i = 0; i < GNRC_SIXLOWPAN_FRAG_VRB_SIZE; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_VRB_SIZE; i++) { base.tag++; base.arrival = xtimer_now_usec(); TEST_ASSERT_NOT_NULL(gnrc_sixlowpan_frag_vrb_add(&base, _mock_netif, diff --git a/tests/unittests/tests-gnrc_sixlowpan_frag_vrb/tests-gnrc_sixlowpan_frag_vrb.c b/tests/unittests/tests-gnrc_sixlowpan_frag_vrb/tests-gnrc_sixlowpan_frag_vrb.c index d00a54ee0d..a37e5fc925 100644 --- a/tests/unittests/tests-gnrc_sixlowpan_frag_vrb/tests-gnrc_sixlowpan_frag_vrb.c +++ b/tests/unittests/tests-gnrc_sixlowpan_frag_vrb/tests-gnrc_sixlowpan_frag_vrb.c @@ -108,7 +108,7 @@ static void test_vrb_add__full(void) gnrc_sixlowpan_frag_rb_base_t base = _base; /* fill up VRB */ - for (unsigned i = 0; i < GNRC_SIXLOWPAN_FRAG_VRB_SIZE; i++) { + for (unsigned i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_VRB_SIZE; i++) { TEST_ASSERT_NOT_NULL(gnrc_sixlowpan_frag_vrb_add(&base, &_dummy_netif, _out_dst, From 55282a1b1dc376aecbb4b72d74b320b2ddb147f0 Mon Sep 17 00:00:00 2001 From: PeterKietzmann Date: Tue, 14 Jan 2020 12:33:41 +0100 Subject: [PATCH 10/11] net/gnrc/sixlowpan/frag/vrb:Move timeout macro to 'CONFIG_' namespace --- sys/include/net/gnrc/sixlowpan/config.h | 6 +++--- .../sixlowpan/frag/vrb/gnrc_sixlowpan_frag_vrb.c | 2 +- .../tests-gnrc_sixlowpan_frag_vrb.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/include/net/gnrc/sixlowpan/config.h b/sys/include/net/gnrc/sixlowpan/config.h index c5cf5d1da0..d215b1b86b 100644 --- a/sys/include/net/gnrc/sixlowpan/config.h +++ b/sys/include/net/gnrc/sixlowpan/config.h @@ -176,9 +176,9 @@ extern "C" { * @note Only applicable with * [gnrc_sixlowpan_frag_vrb](@ref net_gnrc_sixlowpan_frag_vrb) module. */ -#ifndef GNRC_SIXLOWPAN_FRAG_VRB_TIMEOUT_US -#define GNRC_SIXLOWPAN_FRAG_VRB_TIMEOUT_US (GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US) -#endif /* GNRC_SIXLOWPAN_FRAG_VRB_TIMEOUT_US */ +#ifndef CONFIG_GNRC_SIXLOWPAN_FRAG_VRB_TIMEOUT_US +#define CONFIG_GNRC_SIXLOWPAN_FRAG_VRB_TIMEOUT_US (CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US) +#endif /* CONFIG_GNRC_SIXLOWPAN_FRAG_VRB_TIMEOUT_US */ /** * @name Selective fragment recovery configuration diff --git a/sys/net/gnrc/network_layer/sixlowpan/frag/vrb/gnrc_sixlowpan_frag_vrb.c b/sys/net/gnrc/network_layer/sixlowpan/frag/vrb/gnrc_sixlowpan_frag_vrb.c index 1c9cffe625..fb4c232916 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/frag/vrb/gnrc_sixlowpan_frag_vrb.c +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/vrb/gnrc_sixlowpan_frag_vrb.c @@ -192,7 +192,7 @@ void gnrc_sixlowpan_frag_vrb_gc(void) for (unsigned i = 0; i < CONFIG_GNRC_SIXLOWPAN_FRAG_VRB_SIZE; i++) { if (!gnrc_sixlowpan_frag_vrb_entry_empty(&_vrb[i]) && - (now_usec - _vrb[i].super.arrival) > GNRC_SIXLOWPAN_FRAG_VRB_TIMEOUT_US) { + (now_usec - _vrb[i].super.arrival) > CONFIG_GNRC_SIXLOWPAN_FRAG_VRB_TIMEOUT_US) { DEBUG("6lo vrb: entry (%s, ", gnrc_netif_addr_to_str(_vrb[i].super.src, _vrb[i].super.src_len, diff --git a/tests/unittests/tests-gnrc_sixlowpan_frag_vrb/tests-gnrc_sixlowpan_frag_vrb.c b/tests/unittests/tests-gnrc_sixlowpan_frag_vrb/tests-gnrc_sixlowpan_frag_vrb.c index a37e5fc925..4e3fac7877 100644 --- a/tests/unittests/tests-gnrc_sixlowpan_frag_vrb/tests-gnrc_sixlowpan_frag_vrb.c +++ b/tests/unittests/tests-gnrc_sixlowpan_frag_vrb/tests-gnrc_sixlowpan_frag_vrb.c @@ -161,7 +161,7 @@ static void test_vrb_gc(void) gnrc_sixlowpan_frag_rb_base_t base = _base; gnrc_sixlowpan_frag_vrb_t *res; - base.arrival = xtimer_now_usec() - GNRC_SIXLOWPAN_FRAG_VRB_TIMEOUT_US - 1000; + base.arrival = xtimer_now_usec() - CONFIG_GNRC_SIXLOWPAN_FRAG_VRB_TIMEOUT_US - 1000; TEST_ASSERT_NOT_NULL((res = gnrc_sixlowpan_frag_vrb_add(&base, &_dummy_netif, _out_dst, From df7a5d6df82255843a331b8cc44985c76ae93572 Mon Sep 17 00:00:00 2001 From: PeterKietzmann Date: Fri, 17 Jan 2020 18:07:23 +0100 Subject: [PATCH 11/11] net/gnrc/sixlowpan/frag/rb:Move not override to 'CONFIG_' namespace --- sys/include/net/gnrc/sixlowpan/config.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/include/net/gnrc/sixlowpan/config.h b/sys/include/net/gnrc/sixlowpan/config.h index d215b1b86b..5c9dd0eb74 100644 --- a/sys/include/net/gnrc/sixlowpan/config.h +++ b/sys/include/net/gnrc/sixlowpan/config.h @@ -91,11 +91,11 @@ extern "C" { * When not set, it will cause the reassembly buffer to override the oldest entry * if a new entry has to be created and the reassembly buffer is full, no matter what. * When set to 1, only incomplete entries that are older than - * @ref GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US will be overwritten (they will still timeout - * normally). + * @ref CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_US will be overwritten (they will still + * timeout normally). */ #ifdef DOXYGEN -#define GNRC_SIXLOWPAN_FRAG_RBUF_DO_NOT_OVERRIDE +#define CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_DO_NOT_OVERRIDE #endif /** @@ -110,15 +110,15 @@ extern "C" { * overwritten (they will still timeout normally if reassembly buffer is not * full). * - * @deprecated Use inverse @ref GNRC_SIXLOWPAN_FRAG_RBUF_DO_NOT_OVERRIDE instead. + * @deprecated Use inverse @ref CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_DO_NOT_OVERRIDE instead. * Will be removed after 2020.10 release. */ #ifndef GNRC_SIXLOWPAN_FRAG_RBUF_AGGRESSIVE_OVERRIDE -#if IS_ACTIVE(GNRC_SIXLOWPAN_FRAG_RBUF_DO_NOT_OVERRIDE) +#if IS_ACTIVE(CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_DO_NOT_OVERRIDE) #define GNRC_SIXLOWPAN_FRAG_RBUF_AGGRESSIVE_OVERRIDE (0) -#else /* GNRC_SIXLOWPAN_FRAG_RBUF_DO_NOT_OVERRIDE */ +#else /* CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_DO_NOT_OVERRIDE */ #define GNRC_SIXLOWPAN_FRAG_RBUF_AGGRESSIVE_OVERRIDE (1) -#endif /* GNRC_SIXLOWPAN_FRAG_RBUF_DO_NOT_OVERRIDE */ +#endif /* CONFIG_GNRC_SIXLOWPAN_FRAG_RBUF_DO_NOT_OVERRIDE */ #endif /* GNRC_SIXLOWPAN_FRAG_RBUF_AGGRESSIVE_OVERRIDE */ /**