From 750fd30bb489f5ea3dcafc3ceba44dff2fee7fa9 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Fri, 18 Oct 2019 08:42:50 +0200 Subject: [PATCH 1/2] gnrc_sixlowpan_config: fix module doc for reassembly buffer config --- sys/include/net/gnrc/sixlowpan/config.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/include/net/gnrc/sixlowpan/config.h b/sys/include/net/gnrc/sixlowpan/config.h index b800ed8933..ed1ed36ab0 100644 --- a/sys/include/net/gnrc/sixlowpan/config.h +++ b/sys/include/net/gnrc/sixlowpan/config.h @@ -65,7 +65,7 @@ extern "C" { * @brief Size of the reassembly buffer * * @note Only applicable with - * [gnrc_sixlowpan_frag](@ref net_gnrc_sixlowpan_frag) module + * [gnrc_sixlowpan_frag_rb](@ref net_gnrc_sixlowpan_frag_rb) module */ #ifndef GNRC_SIXLOWPAN_FRAG_RBUF_SIZE #define GNRC_SIXLOWPAN_FRAG_RBUF_SIZE (4U) @@ -75,7 +75,7 @@ extern "C" { * @brief Timeout for reassembly buffer entries in microseconds * * @note Only applicable with - * [gnrc_sixlowpan_frag](@ref net_gnrc_sixlowpan_frag) module + * [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) @@ -85,7 +85,7 @@ extern "C" { * @brief Aggressively override reassembly buffer when full * * @note Only applicable with - * [gnrc_sixlowpan_frag](@ref net_gnrc_sixlowpan_frag) module + * [gnrc_sixlowpan_frag_rb](@ref net_gnrc_sixlowpan_frag_rb) module * * 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 From 796d6a3167d2cb5cad00bf1d451dad20e1f52705 Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Fri, 18 Oct 2019 08:43:21 +0200 Subject: [PATCH 2/2] gnrc_sixlowpan: move garbage collect msg type to reassembly buffer --- sys/include/net/gnrc/sixlowpan/frag.h | 5 ----- sys/include/net/gnrc/sixlowpan/frag/rb.h | 4 ++++ .../network_layer/sixlowpan/frag/rb/gnrc_sixlowpan_frag_rb.c | 2 +- sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c | 4 +++- tests/gnrc_sixlowpan_frag/main.c | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/sys/include/net/gnrc/sixlowpan/frag.h b/sys/include/net/gnrc/sixlowpan/frag.h index 4bf1994661..b0cd698661 100644 --- a/sys/include/net/gnrc/sixlowpan/frag.h +++ b/sys/include/net/gnrc/sixlowpan/frag.h @@ -51,11 +51,6 @@ extern "C" { * @brief Message type for passing one 6LoWPAN fragment down the network stack */ #define GNRC_SIXLOWPAN_MSG_FRAG_SND (0x0225) - -/** - * @brief Message type for triggering garbage collection reassembly buffer - */ -#define GNRC_SIXLOWPAN_MSG_FRAG_GC_RBUF (0x0226) /** @} */ /** diff --git a/sys/include/net/gnrc/sixlowpan/frag/rb.h b/sys/include/net/gnrc/sixlowpan/frag/rb.h index 76091e270e..3909edad30 100644 --- a/sys/include/net/gnrc/sixlowpan/frag/rb.h +++ b/sys/include/net/gnrc/sixlowpan/frag/rb.h @@ -31,6 +31,10 @@ #ifdef __cplusplus extern "C" { #endif +/** + * @brief Message type for triggering garbage collection reassembly buffer + */ +#define GNRC_SIXLOWPAN_FRAG_RB_GC_MSG (0x0226) /** * @brief Fragment intervals to identify limits of fragments and duplicates. 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 16913c8fe2..c4faefa724 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 @@ -55,7 +55,7 @@ static gnrc_sixlowpan_frag_rb_t rbuf[GNRC_SIXLOWPAN_FRAG_RBUF_SIZE]; static char l2addr_str[3 * IEEE802154_LONG_ADDRESS_LEN]; static xtimer_t _gc_timer; -static msg_t _gc_timer_msg = { .type = GNRC_SIXLOWPAN_MSG_FRAG_GC_RBUF }; +static msg_t _gc_timer_msg = { .type = GNRC_SIXLOWPAN_FRAG_RB_GC_MSG }; /* ------------------------------------ * internal function definitions diff --git a/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c b/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c index 3c57df4b8c..923037fd8d 100644 --- a/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c +++ b/sys/net/gnrc/network_layer/sixlowpan/gnrc_sixlowpan.c @@ -348,7 +348,9 @@ static void *_event_loop(void *args) DEBUG("6lo: send fragmented event received\n"); gnrc_sixlowpan_frag_send(NULL, msg.content.ptr, 0); break; - case GNRC_SIXLOWPAN_MSG_FRAG_GC_RBUF: +#endif +#ifdef MODULE_GNRC_SIXLOWPAN_FRAG_RB + case GNRC_SIXLOWPAN_FRAG_RB_GC_MSG: DEBUG("6lo: garbage collect reassembly buffer event received\n"); gnrc_sixlowpan_frag_rb_gc(); break; diff --git a/tests/gnrc_sixlowpan_frag/main.c b/tests/gnrc_sixlowpan_frag/main.c index a54d436dc2..5162bb83c6 100644 --- a/tests/gnrc_sixlowpan_frag/main.c +++ b/tests/gnrc_sixlowpan_frag/main.c @@ -594,7 +594,7 @@ static void test_rbuf_gc__timed(void) xtimer_msg_receive_timeout(&msg, TEST_GC_TIMEOUT) >= 0, "Waiting for GC timer timed out" ); - TEST_ASSERT_EQUAL_INT(GNRC_SIXLOWPAN_MSG_FRAG_GC_RBUF, msg.type); + TEST_ASSERT_EQUAL_INT(GNRC_SIXLOWPAN_FRAG_RB_GC_MSG, msg.type); gnrc_sixlowpan_frag_rb_gc(); /* reassembly buffer is now empty */ TEST_ASSERT_NULL(_first_non_empty_rbuf());