mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
gnrc_sixlowpan_frag_sfr: make ARQ timer mockable
This commit is contained in:
parent
30f990f789
commit
b92e90f7b5
@ -383,6 +383,17 @@ extern "C" {
|
||||
#ifndef CONFIG_GNRC_SIXLOWPAN_SFR_ECN_FQUEUE_DEN
|
||||
#define CONFIG_GNRC_SIXLOWPAN_SFR_ECN_FQUEUE_DEN 2U
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Deactivate automatic handling of ARQ timer
|
||||
*
|
||||
* This requires an external source (e.g. a test application) to call
|
||||
* @ref gnrc_sixlowpan_frag_sfr_arq_timeout() for
|
||||
* @ref net_gnrc_sixlowpan_frag_sfr to still work properly.
|
||||
*/
|
||||
#ifndef CONFIG_GNRC_SIXLOWPAN_SFR_MOCK_ARQ_TIMER
|
||||
#define CONFIG_GNRC_SIXLOWPAN_SFR_MOCK_ARQ_TIMER 0U
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
|
@ -169,4 +169,12 @@ config GNRC_SIXLOWPAN_SFR_ECN_FQUEUE_DEN
|
||||
@ref CONFIG_GNRC_SIXLOWPAN_SFR_ECN_FQUEUE_NUM / @ref CONFIG_GNRC_SIXLOWPAN_SFR_ECN_FQUEUE_DEN
|
||||
endif
|
||||
|
||||
config GNRC_SIXLOWPAN_SFR_MOCK_ARQ_TIMER
|
||||
bool "Deactivate automatic handling of ARQ timer"
|
||||
default n
|
||||
help
|
||||
This requires an external source (e.g. a test application) to call
|
||||
@ref gnrc_sixlowpan_frag_sfr_arq_timeout() for
|
||||
@ref net_gnrc_sixlowpan_frag_sfr to still work properly.
|
||||
|
||||
endif
|
||||
|
@ -507,6 +507,10 @@ void gnrc_sixlowpan_frag_sfr_arq_timeout(gnrc_sixlowpan_frag_fb_t *fbuf)
|
||||
|
||||
DEBUG("6lo sfr: ARQ timeout for datagram %u\n", fbuf->tag);
|
||||
fbuf->sfr.arq_timeout_event.msg.content.ptr = NULL;
|
||||
if (IS_ACTIVE(CONFIG_GNRC_SIXLOWPAN_SFR_MOCK_ARQ_TIMER)) {
|
||||
/* mock-up to emulate time having passed beyond (1us) the ARQ timeout */
|
||||
now -= (fbuf->sfr.arq_timeout * US_PER_MS) + 1;
|
||||
}
|
||||
if (IS_USED(MODULE_GNRC_SIXLOWPAN_FRAG_SFR_CONGURE) && frag_desc) {
|
||||
/* report timeout to CongURE state */
|
||||
gnrc_sixlowpan_frag_sfr_congure_snd_report_frags_timeout(fbuf);
|
||||
@ -1706,6 +1710,10 @@ static void _sched_next_frame(gnrc_sixlowpan_frag_fb_t *fbuf)
|
||||
|
||||
static void _sched_arq_timeout(gnrc_sixlowpan_frag_fb_t *fbuf, uint32_t offset)
|
||||
{
|
||||
if (IS_ACTIVE(CONFIG_GNRC_SIXLOWPAN_SFR_MOCK_ARQ_TIMER)) {
|
||||
/* mock does not need to be scheduled */
|
||||
return;
|
||||
}
|
||||
if (fbuf->sfr.arq_timeout_event.msg.content.ptr != NULL) {
|
||||
DEBUG("6lo sfr: ARQ timeout for datagram %u already scheduled\n",
|
||||
(uint8_t)fbuf->tag);
|
||||
|
Loading…
Reference in New Issue
Block a user