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

gnrc/nib: Move GNRC_IPV6_NIB_OFFL_NUMOF to 'CONFIG_' namespace

This commit is contained in:
Leandro Lanzieri 2020-03-12 17:24:26 +01:00
parent f6ee712e98
commit a77d0dd9c5
No known key found for this signature in database
GPG Key ID: 39607DE6080007A3
8 changed files with 41 additions and 41 deletions

View File

@ -26,7 +26,7 @@ USEMODULE += prng_minstd
CFLAGS += -DLOG_LEVEL=LOG_NONE # disable log output
CFLAGS += -DGNRC_PKTBUF_SIZE=512 -DCONFIG_GNRC_NETIF_IPV6_ADDRS_NUMOF=2 \
-DGNRC_NETIF_IPV6_GROUPS_NUMOF=2 -DCONFIG_GNRC_IPV6_NIB_NUMOF=1 \
-DGNRC_IPV6_NIB_OFFL_NUMOF=1 # be able to configure at least one route
-DCONFIG_GNRC_IPV6_NIB_OFFL_NUMOF=1 # be able to configure at least one route
# Enable single interface optimization. Set to 0 if more than one interface is
# present

View File

@ -255,7 +255,7 @@ extern "C" {
* neighbors and duplicate address detection table entries
*/
#ifndef CONFIG_GNRC_IPV6_NIB_NUMOF
#define CONFIG_GNRC_IPV6_NIB_NUMOF (4)
#define CONFIG_GNRC_IPV6_NIB_NUMOF (4)
#endif
/**
@ -264,8 +264,8 @@ extern "C" {
* @attention This number is equal to the maximum number of forwarding table
* and prefix list entries in NIB
*/
#ifndef GNRC_IPV6_NIB_OFFL_NUMOF
#define GNRC_IPV6_NIB_OFFL_NUMOF (8)
#ifndef CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF
#define CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF (8)
#endif
#if CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C || defined(DOXYGEN)

View File

@ -37,7 +37,7 @@ _nib_dr_entry_t *_prime_def_router = NULL;
static clist_node_t _next_removable = { NULL };
static _nib_onl_entry_t _nodes[CONFIG_GNRC_IPV6_NIB_NUMOF];
static _nib_offl_entry_t _dsts[GNRC_IPV6_NIB_OFFL_NUMOF];
static _nib_offl_entry_t _dsts[CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF];
static _nib_dr_entry_t _def_routers[CONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF];
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C)
@ -480,7 +480,7 @@ _nib_offl_entry_t *_nib_offl_alloc(const ipv6_addr_t *next_hop, unsigned iface,
iface);
DEBUG("pfx = %s/%u)\n", ipv6_addr_to_str(addr_str, pfx,
sizeof(addr_str)), pfx_len);
for (unsigned i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
_nib_offl_entry_t *tmp = &_dsts[i];
_nib_onl_entry_t *tmp_node = tmp->next_hop;
@ -519,7 +519,7 @@ _nib_offl_entry_t *_nib_offl_alloc(const ipv6_addr_t *next_hop, unsigned iface,
static inline bool _in_dsts(const _nib_offl_entry_t *dst)
{
return (dst < (_dsts + GNRC_IPV6_NIB_OFFL_NUMOF));
return (dst < (_dsts + CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF));
}
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C)
@ -662,7 +662,7 @@ void _nib_pl_remove(_nib_offl_entry_t *nib_offl)
_nib_offl_remove(nib_offl, _PL);
#if IS_ACTIVE(CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C)
unsigned idx = _idx_dsts(nib_offl);
if (idx < GNRC_IPV6_NIB_OFFL_NUMOF) {
if (idx < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF) {
for (_nib_abr_entry_t *abr = _abrs; _in_abrs(abr); abr++) {
if (bf_isset(abr->pfxs, idx)) {
DEBUG("nib: Removing prefix %s/%u ",
@ -717,7 +717,7 @@ void _nib_abr_remove(const ipv6_addr_t *addr)
sizeof(addr_str)));
for (_nib_abr_entry_t *abr = _abrs; _in_abrs(abr); abr++) {
if (ipv6_addr_equal(addr, &abr->addr)) {
for (int i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
if (bf_isset(abr->pfxs, i)) {
_nib_pl_remove(&_dsts[i]);
}
@ -744,7 +744,7 @@ void _nib_abr_add_pfx(_nib_abr_entry_t *abr, const _nib_offl_entry_t *offl)
offl->pfx_len);
DEBUG("came from border router %s\n", ipv6_addr_to_str(addr_str, &abr->addr,
sizeof(addr_str)));
if (idx < GNRC_IPV6_NIB_OFFL_NUMOF) {
if (idx < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF) {
bf_set(abr->pfxs, idx);
}
}
@ -753,7 +753,7 @@ _nib_offl_entry_t *_nib_abr_iter_pfx(const _nib_abr_entry_t *abr,
const _nib_offl_entry_t *last)
{
if ((last == NULL) ||
(_idx_dsts(last) < GNRC_IPV6_NIB_OFFL_NUMOF)) {
(_idx_dsts(last) < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF)) {
/* we don't change `ptr`, so dropping const qualifier for now is okay */
_nib_offl_entry_t *ptr = (_nib_offl_entry_t *)last;

View File

@ -234,7 +234,7 @@ typedef struct {
* @brief Bitfield marking the prefixes in the NIB's off-link entries
* disseminated by _nib_abr_entry_t::addr
*/
BITFIELD(pfxs, GNRC_IPV6_NIB_OFFL_NUMOF);
BITFIELD(pfxs, CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF);
/**
* @brief Bitfield marking the contexts disseminated by
* _nib_abr_entry_t::addr

View File

@ -3,7 +3,7 @@ USEMODULE += gnrc_sixlowpan_nd # required for CONFIG_GNRC_IPV6_NIB_MULTIHOP_P6C
CFLAGS += -DCONFIG_GNRC_IPV6_NIB_ROUTER=1
CFLAGS += -DCONFIG_GNRC_IPV6_NIB_NUMOF=16
CFLAGS += -DGNRC_IPV6_NIB_OFFL_NUMOF=25
CFLAGS += -DCONFIG_GNRC_IPV6_NIB_OFFL_NUMOF=25
CFLAGS += -DCONFIG_GNRC_IPV6_NIB_DEFAULT_ROUTER_NUMOF=4
CFLAGS += -DGNRC_IPV6_NIB_ABR_NUMOF=4
CFLAGS += -DCONFIG_GNRC_IPV6_NIB_6LBR=1

View File

@ -212,10 +212,10 @@ static void test_nib_ft_add__EINVAL_iface0(void)
&next_hop, 0, 0));
}
#if CONFIG_GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF
#if CONFIG_GNRC_IPV6_NIB_NUMOF < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF
#define MAX_NUMOF (CONFIG_GNRC_IPV6_NIB_NUMOF)
#else /* CONFIG_GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF */
#define MAX_NUMOF (GNRC_IPV6_NIB_OFFL_NUMOF)
#else /* CONFIG_GNRC_IPV6_NIB_NUMOF < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF */
#define MAX_NUMOF (CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF)
#endif
/*
@ -238,7 +238,7 @@ static void test_nib_ft_add__ENOMEM_diff_def_router(void)
}
/*
* Creates GNRC_IPV6_NIB_OFFL_NUMOF routes with different destinations of same
* Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF routes with different destinations of same
* prefix lengths to the same next hop and then tries to create another one
* Expected result: gnrc_ipv6_nib_ft_add() returns -ENOMEM
*/
@ -246,7 +246,7 @@ static void test_nib_ft_add__ENOMEM_diff_dst(void)
{
ipv6_addr_t dst = { .u64 = { { .u8 = GLOBAL_PREFIX } } };
for (unsigned i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_ft_add(&dst, GLOBAL_PREFIX_LEN,
NULL, IFACE, 0));
dst.u16[0].u16--;
@ -256,7 +256,7 @@ static void test_nib_ft_add__ENOMEM_diff_dst(void)
}
/*
* Creates GNRC_IPV6_NIB_OFFL_NUMOF routes with destinations of different
* Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF routes with destinations of different
* prefix lengths to the same next hop and then tries to create another one
* Expected result: gnrc_ipv6_nib_ft_add() returns -ENOMEM
*/
@ -265,7 +265,7 @@ static void test_nib_ft_add__ENOMEM_diff_dst_len(void)
static const ipv6_addr_t dst = { .u64 = { { .u8 = GLOBAL_PREFIX } } };
unsigned dst_len = GLOBAL_PREFIX_LEN;
for (unsigned i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_ft_add(&dst, dst_len,
NULL, IFACE, 0));
dst_len--;
@ -275,7 +275,7 @@ static void test_nib_ft_add__ENOMEM_diff_dst_len(void)
}
/*
* Creates GNRC_IPV6_NIB_OFFL_NUMOF routes with different destination of
* Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF routes with different destination of
* different prefix lengths to the same next hop and then tries to create
* another one
* Expected result: gnrc_ipv6_nib_ft_add() returns -ENOMEM
@ -285,7 +285,7 @@ static void test_nib_ft_add__ENOMEM_diff_dst_dst_len(void)
ipv6_addr_t dst = { .u64 = { { .u8 = GLOBAL_PREFIX } } };
unsigned dst_len = GLOBAL_PREFIX_LEN;
for (unsigned i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_ft_add(&dst, dst_len,
NULL, IFACE, 0));
dst.u16[0].u16--;

View File

@ -1021,10 +1021,10 @@ static void test_nib_drl_get_dr__success4(void)
TEST_ASSERT(nib_res != node2);
}
#if CONFIG_GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF
#if CONFIG_GNRC_IPV6_NIB_NUMOF < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF
#define MAX_NUMOF (CONFIG_GNRC_IPV6_NIB_NUMOF)
#else /* CONFIG_GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF */
#define MAX_NUMOF (GNRC_IPV6_NIB_OFFL_NUMOF)
#else /* CONFIG_GNRC_IPV6_NIB_NUMOF < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF */
#define MAX_NUMOF (CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF)
#endif
/*
@ -1099,7 +1099,7 @@ static void test_nib_offl_alloc__no_space_left_diff_next_hop_iface(void)
}
/*
* Creates GNRC_IPV6_NIB_OFFL_NUMOF off-link entries with different prefixes
* Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF off-link entries with different prefixes
* of the same length and then tries to add another.
* Expected result: should return NULL
*/
@ -1109,7 +1109,7 @@ static void test_nib_offl_alloc__no_space_left_diff_pfx(void)
{ .u64 = TEST_UINT64 } } };
ipv6_addr_t pfx = { .u64 = { { .u8 = GLOBAL_PREFIX } } };
for (int i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
_nib_offl_entry_t *dst;
TEST_ASSERT_NOT_NULL((dst = _nib_offl_alloc(&next_hop, IFACE, &pfx,
@ -1198,7 +1198,7 @@ static void test_nib_offl_alloc__no_space_left_diff_next_hop_iface_pfx(void)
}
/*
* Creates GNRC_IPV6_NIB_OFFL_NUMOF off-link entries with different prefix
* Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF off-link entries with different prefix
* lengths and then tries to add another.
* Expected result: should return NULL
*/
@ -1209,7 +1209,7 @@ static void test_nib_offl_alloc__no_space_left_diff_pfx_len(void)
static const ipv6_addr_t pfx = { .u64 = { { .u8 = GLOBAL_PREFIX } } };
unsigned pfx_len = GLOBAL_PREFIX_LEN;
for (int i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
_nib_offl_entry_t *dst;
TEST_ASSERT_NOT_NULL((dst = _nib_offl_alloc(&next_hop, IFACE, &pfx,
pfx_len)));
@ -1294,7 +1294,7 @@ static void test_nib_offl_alloc__no_space_left_diff_next_hop_iface_pfx_len(void)
}
/*
* Creates GNRC_IPV6_NIB_OFFL_NUMOF off-link entries with different prefixes
* Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF off-link entries with different prefixes
* and then tries to add another.
* Expected result: should return NULL
*/
@ -1305,7 +1305,7 @@ static void test_nib_offl_alloc__no_space_left_diff_pfx_pfx_len(void)
ipv6_addr_t pfx = { .u64 = { { .u8 = GLOBAL_PREFIX } } };
unsigned pfx_len = GLOBAL_PREFIX_LEN;
for (int i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
for (int i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
_nib_offl_entry_t *dst;
TEST_ASSERT_NOT_NULL((dst = _nib_offl_alloc(&next_hop, IFACE, &pfx,

View File

@ -96,10 +96,10 @@ static void test_nib_pl_set__EINVAL_pfx_len(void)
UINT32_MAX));
}
#if CONFIG_GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF
#if CONFIG_GNRC_IPV6_NIB_NUMOF < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF
#define MAX_NUMOF (CONFIG_GNRC_IPV6_NIB_NUMOF)
#else /* CONFIG_GNRC_IPV6_NIB_NUMOF < GNRC_IPV6_NIB_OFFL_NUMOF */
#define MAX_NUMOF (GNRC_IPV6_NIB_OFFL_NUMOF)
#else /* CONFIG_GNRC_IPV6_NIB_NUMOF < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF */
#define MAX_NUMOF (CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF)
#endif
/*
@ -126,7 +126,7 @@ static void test_nib_pl_set__ENOMEM_diff_iface(void)
}
/*
* Creates GNRC_IPV6_NIB_OFFL_NUMOF prefix list entries with different prefix of
* Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF prefix list entries with different prefix of
* the same length and then tries to create another one
* Expected result: gnrc_ipv6_nib_pl_set() returns -ENOMEM
*/
@ -135,7 +135,7 @@ static void test_nib_pl_set__ENOMEM_diff_pfx(void)
ipv6_addr_t pfx = { .u64 = { { .u8 = GLOBAL_PREFIX },
{ .u64 = TEST_UINT64 } } };
for (unsigned i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_pl_set(IFACE, &pfx,
GLOBAL_PREFIX_LEN,
UINT32_MAX, UINT32_MAX));
@ -148,7 +148,7 @@ static void test_nib_pl_set__ENOMEM_diff_pfx(void)
}
/*
* Creates GNRC_IPV6_NIB_OFFL_NUMOF prefix list entries with different prefix of
* Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF prefix list entries with different prefix of
* the same length and different interfaces and then tries to create another one
* Expected result: gnrc_ipv6_nib_pl_set() returns -ENOMEM
*/
@ -172,7 +172,7 @@ static void test_nib_pl_set__ENOMEM_diff_iface_pfx(void)
}
/*
* Creates GNRC_IPV6_NIB_OFFL_NUMOF prefix list entries with prefixes of
* Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF prefix list entries with prefixes of
* different length and then tries to create another one
* Expected result: gnrc_ipv6_nib_pl_set() returns -ENOMEM
*/
@ -182,7 +182,7 @@ static void test_nib_pl_set__ENOMEM_diff_pfx_len(void)
{ .u64 = TEST_UINT64 } } };
unsigned pfx_len = GLOBAL_PREFIX_LEN;
for (unsigned i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_pl_set(IFACE, &pfx, pfx_len,
UINT32_MAX, UINT32_MAX));
pfx_len--;
@ -215,7 +215,7 @@ static void test_nib_pl_set__ENOMEM_diff_iface_pfx_len(void)
}
/*
* Creates GNRC_IPV6_NIB_OFFL_NUMOF prefix list entries with different prefixes
* Creates CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF prefix list entries with different prefixes
* and then tries to create another one
* Expected result: gnrc_ipv6_nib_pl_set() returns -ENOMEM
*/
@ -225,7 +225,7 @@ static void test_nib_pl_set__ENOMEM_diff_pfx_pfx_len(void)
{ .u64 = TEST_UINT64 } } };
unsigned pfx_len = GLOBAL_PREFIX_LEN;
for (unsigned i = 0; i < GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
for (unsigned i = 0; i < CONFIG_GNRC_IPV6_NIB_OFFL_NUMOF; i++) {
TEST_ASSERT_EQUAL_INT(0, gnrc_ipv6_nib_pl_set(IFACE, &pfx, pfx_len,
UINT32_MAX, UINT32_MAX));
pfx_len--;