1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-16 10:03:50 +01:00

gnrc/ipv6/ext/frag: Move configurations to 'CONFIG_' namespace

Macros that changed:
GNRC_IPV6_EXT_FRAG_SEND_SIZE -> CONFIG_GNRC_IPV6_EXT_FRAG_SEND_SIZE
GNRC_IPV6_EXT_FRAG_RBUF_SIZE -> CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_SIZE
GNRC_IPV6_EXT_FRAG_LIMITS_POOL_SIZE -> CONFIG_GNRC_IPV6_EXT_FRAG_LIMITS_POOL_SIZE
GNRC_IPV6_EXT_FRAG_RBUF_TIMEOUT_US -> CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_TIMEOUT_US
This commit is contained in:
Leandro Lanzieri 2019-12-13 15:54:05 +01:00
parent 596d02387f
commit 5602bd55ed
5 changed files with 22 additions and 22 deletions

View File

@ -52,8 +52,8 @@ extern "C" {
*
* @note Only applicable with [gnrc_ipv6_ext_frag](@ref net_gnrc_ipv6_ext_frag) module
*/
#ifndef GNRC_IPV6_EXT_FRAG_SEND_SIZE
#define GNRC_IPV6_EXT_FRAG_SEND_SIZE (1U)
#ifndef CONFIG_GNRC_IPV6_EXT_FRAG_SEND_SIZE
#define CONFIG_GNRC_IPV6_EXT_FRAG_SEND_SIZE (1U)
#endif
/**
@ -63,8 +63,8 @@ extern "C" {
*
* @note Only applicable with [gnrc_ipv6_ext_frag](@ref net_gnrc_ipv6_ext_frag) module
*/
#ifndef GNRC_IPV6_EXT_FRAG_RBUF_SIZE
#define GNRC_IPV6_EXT_FRAG_RBUF_SIZE (1U)
#ifndef CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_SIZE
#define CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_SIZE (1U)
#endif
/**
@ -75,8 +75,8 @@ extern "C" {
*
* @note Only applicable with [gnrc_ipv6_ext_frag](@ref net_gnrc_ipv6_ext_frag) module
*/
#ifndef GNRC_IPV6_EXT_FRAG_LIMITS_POOL_SIZE
#define GNRC_IPV6_EXT_FRAG_LIMITS_POOL_SIZE (GNRC_IPV6_EXT_FRAG_RBUF_SIZE * 2U)
#ifndef CONFIG_GNRC_IPV6_EXT_FRAG_LIMITS_POOL_SIZE
#define CONFIG_GNRC_IPV6_EXT_FRAG_LIMITS_POOL_SIZE (CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_SIZE * 2U)
#endif
/**
@ -84,8 +84,8 @@ extern "C" {
*
* @note Only applicable with [gnrc_ipv6_ext_frag](@ref net_gnrc_ipv6_ext_frag) module
*/
#ifndef GNRC_IPV6_EXT_FRAG_RBUF_TIMEOUT_US
#define GNRC_IPV6_EXT_FRAG_RBUF_TIMEOUT_US (10U * US_PER_SEC)
#ifndef CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_TIMEOUT_US
#define CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_TIMEOUT_US (10U * US_PER_SEC)
#endif
/** @} **/

View File

@ -182,7 +182,7 @@ static inline void gnrc_ipv6_ext_frag_rbuf_del(gnrc_ipv6_ext_frag_rbuf_t *rbuf)
*
* This calls @ref gnrc_ipv6_ext_frag_rbuf_del() for all reassembly buffer
* entries for which * gnrc_ipv6_ext_frag_rbuf_t::arrival is
* @ref GNRC_IPV6_EXT_FRAG_RBUF_TIMEOUT_US in the past.
* @ref CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_TIMEOUT_US in the past.
*/
void gnrc_ipv6_ext_frag_rbuf_gc(void);
/** @} */

View File

@ -34,9 +34,9 @@
#define ENABLE_DEBUG (0)
#include "debug.h"
static gnrc_ipv6_ext_frag_send_t _snd_bufs[GNRC_IPV6_EXT_FRAG_SEND_SIZE];
static gnrc_ipv6_ext_frag_rbuf_t _rbuf[GNRC_IPV6_EXT_FRAG_RBUF_SIZE];
static gnrc_ipv6_ext_frag_limits_t _limits_pool[GNRC_IPV6_EXT_FRAG_LIMITS_POOL_SIZE];
static gnrc_ipv6_ext_frag_send_t _snd_bufs[CONFIG_GNRC_IPV6_EXT_FRAG_SEND_SIZE];
static gnrc_ipv6_ext_frag_rbuf_t _rbuf[CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_SIZE];
static gnrc_ipv6_ext_frag_limits_t _limits_pool[CONFIG_GNRC_IPV6_EXT_FRAG_LIMITS_POOL_SIZE];
static clist_node_t _free_limits;
static xtimer_t _gc_xtimer;
static msg_t _gc_msg = { .type = GNRC_IPV6_EXT_FRAG_RBUF_GC };
@ -61,7 +61,7 @@ void gnrc_ipv6_ext_frag_init(void)
memset(_rbuf, 0, sizeof(_rbuf));
#endif
_last_id = random_uint32();
for (unsigned i = 0; i < GNRC_IPV6_EXT_FRAG_LIMITS_POOL_SIZE; i++) {
for (unsigned i = 0; i < CONFIG_GNRC_IPV6_EXT_FRAG_LIMITS_POOL_SIZE; i++) {
clist_rpush(&_free_limits, (clist_node_t *)&_limits_pool[i]);
}
}
@ -272,7 +272,7 @@ void gnrc_ipv6_ext_frag_send(gnrc_ipv6_ext_frag_send_t *snd_buf)
static gnrc_ipv6_ext_frag_send_t *_snd_buf_alloc(void)
{
for (unsigned i = 0; i < GNRC_IPV6_EXT_FRAG_SEND_SIZE; i++) {
for (unsigned i = 0; i < CONFIG_GNRC_IPV6_EXT_FRAG_SEND_SIZE; i++) {
gnrc_ipv6_ext_frag_send_t *snd_buf = &_snd_bufs[i];
if (snd_buf->pkt == NULL) {
return snd_buf;
@ -420,7 +420,7 @@ gnrc_pktsnip_t *gnrc_ipv6_ext_frag_reass(gnrc_pktsnip_t *pkt)
goto error_release;
}
rbuf->arrival = xtimer_now_usec();
xtimer_set_msg(&_gc_xtimer, GNRC_IPV6_EXT_FRAG_RBUF_TIMEOUT_US, &_gc_msg,
xtimer_set_msg(&_gc_xtimer, CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_TIMEOUT_US, &_gc_msg,
sched_active_pid);
nh = fh->nh;
offset = ipv6_ext_frag_get_offset(fh);
@ -538,7 +538,7 @@ gnrc_ipv6_ext_frag_rbuf_t *gnrc_ipv6_ext_frag_rbuf_get(ipv6_hdr_t *ipv6,
uint32_t id)
{
gnrc_ipv6_ext_frag_rbuf_t *res = NULL, *oldest = NULL;
for (unsigned i = 0; i < GNRC_IPV6_EXT_FRAG_RBUF_SIZE; i++) {
for (unsigned i = 0; i < CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_SIZE; i++) {
gnrc_ipv6_ext_frag_rbuf_t *tmp = &_rbuf[i];
if (tmp->ipv6 != NULL) {
if ((tmp->id == id) &&
@ -580,9 +580,9 @@ void gnrc_ipv6_ext_frag_rbuf_free(gnrc_ipv6_ext_frag_rbuf_t *rbuf)
void gnrc_ipv6_ext_frag_rbuf_gc(void)
{
uint32_t now = xtimer_now_usec();
for (unsigned i = 0; i < GNRC_IPV6_EXT_FRAG_RBUF_SIZE; i++) {
for (unsigned i = 0; i < CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_SIZE; i++) {
gnrc_ipv6_ext_frag_rbuf_t *rbuf = &_rbuf[i];
if ((now - rbuf->arrival) > GNRC_IPV6_EXT_FRAG_RBUF_TIMEOUT_US) {
if ((now - rbuf->arrival) > CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_TIMEOUT_US) {
gnrc_ipv6_ext_frag_rbuf_del(rbuf);
}
}

View File

@ -6,7 +6,7 @@ export TAP ?= tap0
CFLAGS += -DOUTPUT=TEXT
CFLAGS += -DTEST_SUITES="gnrc_ipv6_ext_frag"
CFLAGS += -DGNRC_IPV6_EXT_FRAG_LIMITS_POOL_SIZE=3
CFLAGS += -DCONFIG_GNRC_IPV6_EXT_FRAG_LIMITS_POOL_SIZE=3
ifeq (native,$(BOARD))
TERMFLAGS ?= $(TAP)

View File

@ -110,7 +110,7 @@ static void test_ipv6_ext_frag_rbuf_get(void)
TEST_ASSERT_MESSAGE(&ipv6 == rbuf->ipv6, "IPv6 header is not the same");
/* check that reassembly buffer never gets full */
for (unsigned i = 1; i < (2 * GNRC_IPV6_EXT_FRAG_RBUF_SIZE); i++) {
for (unsigned i = 1; i < (2 * CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_SIZE); i++) {
rbuf = gnrc_ipv6_ext_frag_rbuf_get(
&ipv6, TEST_ID + i
);
@ -171,7 +171,7 @@ static void test_ipv6_ext_frag_rbuf_gc(void)
TEST_ASSERT_NOT_NULL(rbuf->pkt);
TEST_ASSERT_MESSAGE(pkt->data == rbuf->ipv6, "IPv6 header is not the same");
rbuf->arrival -= GNRC_IPV6_EXT_FRAG_RBUF_TIMEOUT_US;
rbuf->arrival -= CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_TIMEOUT_US;
gnrc_ipv6_ext_frag_rbuf_gc();
TEST_ASSERT_NULL(rbuf->pkt);
TEST_ASSERT_NULL(rbuf->ipv6);
@ -410,7 +410,7 @@ static void test_ipv6_ext_frag_reass_out_of_order_rbuf_full(void)
static const uint32_t foreign_id = TEST_ID + 44U;
TEST_ASSERT_EQUAL_INT(1, GNRC_IPV6_EXT_FRAG_RBUF_SIZE);
TEST_ASSERT_EQUAL_INT(1, CONFIG_GNRC_IPV6_EXT_FRAG_RBUF_SIZE);
/* prepare fragment from a from a foreign datagram */
ipv6->nh = PROTNUM_IPV6_EXT_FRAG;
ipv6->hl = TEST_HL;