1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #11442 from miri64/gnrc_sixlowpan_frag/enh/aggressive-config

gnrc_sixlowpan_frag: make aggresive override configurable
This commit is contained in:
Cenk Gündoğan 2019-05-24 17:25:20 +02:00 committed by GitHub
commit 650ee83e90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 4 deletions

View File

@ -68,6 +68,22 @@ extern "C" {
#define GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_MS (3U * US_PER_SEC)
#endif
/**
* @brief Aggressively override reassembly buffer when full
*
* @note Only applicable with
* [gnrc_sixlowpan_frag](@ref net_gnrc_sixlowpan_frag) 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
* entry that is older than @ref GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_MS will be
* overwritten (they will still timeout normally if reassembly buffer is not
* full).
*/
#ifndef GNRC_SIXLOWPAN_FRAG_RBUF_AGGRESSIVE_OVERRIDE
#define GNRC_SIXLOWPAN_FRAG_RBUF_AGGRESSIVE_OVERRIDE (1)
#endif
/**
* @brief Registration lifetime in minutes for the address registration option
*

View File

@ -322,11 +322,18 @@ static rbuf_t *_rbuf_get(const void *src, size_t src_len,
/* if oldest is not empty, res must not be NULL (because otherwise
* oldest could have been picked as res) */
assert(!rbuf_entry_empty(oldest));
if (GNRC_SIXLOWPAN_FRAG_RBUF_AGGRESSIVE_OVERRIDE ||
((now_usec - oldest->arrival) >
GNRC_SIXLOWPAN_FRAG_RBUF_TIMEOUT_MS)) {
DEBUG("6lo rfrag: reassembly buffer full, remove oldest entry\n");
gnrc_pktbuf_release(oldest->super.pkt);
rbuf_rm(oldest);
res = oldest;
}
else {
return NULL;
}
}
/* now we have an empty spot */