diff --git a/makefiles/pseudomodules.inc.mk b/makefiles/pseudomodules.inc.mk index b2d4457ea585..1aa702b266ae 100644 --- a/makefiles/pseudomodules.inc.mk +++ b/makefiles/pseudomodules.inc.mk @@ -236,6 +236,11 @@ PSEUDOMODULES += gnrc_sixlowpan_frag_sfr_stats ## @{ ## PSEUDOMODULES += gnrc_sixlowpan_frag_sfr_congure +## @defgroup net_gnrc_sixlowpan_frag_sfr_congure_quic gnrc_sixlowpan_frag_sfr_congure_quic: QUIC CC +## @brief Congestion control for SFR using the [congestion control algorithm of QUIC](@ref sys_congure_quic) +## @{ +PSEUDOMODULES += gnrc_sixlowpan_frag_sfr_congure_quic +## @} ## @defgroup net_gnrc_sixlowpan_frag_sfr_congure_sfr gnrc_sixlowpan_frag_sfr_congure_sfr: Appendix C ## @brief Basic congestion control for 6LoWPAN SFR as proposed in Appendix C of RFC 8931 ## @see [RFC 8931, Appendix C](https://tools.ietf.org/html/rfc8931#section-appendix.c) diff --git a/sys/include/net/gnrc/sixlowpan/frag/sfr/congure.h b/sys/include/net/gnrc/sixlowpan/frag/sfr/congure.h index 6345e3e3367d..b960e95b04b8 100644 --- a/sys/include/net/gnrc/sixlowpan/frag/sfr/congure.h +++ b/sys/include/net/gnrc/sixlowpan/frag/sfr/congure.h @@ -16,6 +16,7 @@ * (SFR). The flavor of congestion control can be selected using the following sub-modules: * * - @ref net_gnrc_sixlowpan_frag_sfr_congure_sfr (the default) + * - @ref net_gnrc_sixlowpan_frag_sfr_congure_quic * @{ * * @file diff --git a/sys/net/gnrc/Makefile.dep b/sys/net/gnrc/Makefile.dep index fdec26addd54..b578d2d4b2e7 100644 --- a/sys/net/gnrc/Makefile.dep +++ b/sys/net/gnrc/Makefile.dep @@ -244,6 +244,10 @@ ifneq (,$(filter gnrc_sixlowpan_frag_sfr_congure_%,$(USEMODULE))) USEMODULE += gnrc_sixlowpan_frag_sfr_congure endif +ifneq (,$(filter gnrc_sixlowpan_frag_sfr_congure_quic,$(USEMODULE))) + USEMODULE += congure_quic +endif + ifneq (,$(filter gnrc_sixlowpan_frag_sfr_congure,$(USEMODULE))) USEMODULE += gnrc_sixlowpan_frag_sfr ifeq (,$(filter gnrc_sixlowpan_frag_sfr_congure_% congure_mock,$(USEMODULE))) diff --git a/sys/net/gnrc/network_layer/sixlowpan/frag/sfr/congure_quic.c b/sys/net/gnrc/network_layer/sixlowpan/frag/sfr/congure_quic.c new file mode 100644 index 000000000000..14aa23819807 --- /dev/null +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/sfr/congure_quic.c @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2021 Freie Universität Berlin + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @{ + * + * @file + * @author Martine Lenders + */ + +#include "kernel_defines.h" +#include "congure/quic.h" +#include "net/gnrc/sixlowpan/config.h" + +#include "net/gnrc/sixlowpan/frag/sfr/congure.h" + +static congure_quic_snd_t _sfr_congures_quic[CONFIG_GNRC_SIXLOWPAN_FRAG_FB_SIZE]; +static const congure_quic_snd_consts_t _sfr_congure_quic_consts = { + /* cong_event_cb to resend a fragment is not needed since SFR always + * resends fragments lost or timed out immediately. In case of a reported + * ECN, it will also continue with the remaining fragments */ + .init_wnd = CONFIG_GNRC_SIXLOWPAN_SFR_OPT_WIN_SIZE, + .min_wnd = CONFIG_GNRC_SIXLOWPAN_SFR_MIN_WIN_SIZE, + /* TODO make those configurable via Kconfig? */ + .init_rtt = 333U, + .max_msg_size = 1, + .pc_thresh = 3000, + .granularity = 1, + .loss_reduction_numerator = 1, + .loss_reduction_denominator = 2, + .inter_msg_interval_numerator = 5, + .inter_msg_interval_denominator = 4, +}; + +congure_snd_t *gnrc_sixlowpan_frag_sfr_congure_snd_get(void) +{ + for (unsigned i = 0; i < ARRAY_SIZE(_sfr_congures_quic); i++) { + if (_sfr_congures_quic[i].super.driver == NULL) { + congure_quic_snd_setup(&_sfr_congures_quic[i], + &_sfr_congure_quic_consts); + return &_sfr_congures_quic[i].super; + } + } + return NULL; +} + +/** @} */ diff --git a/tests/gnrc_sixlowpan_frag_sfr_congure_impl/Makefile b/tests/gnrc_sixlowpan_frag_sfr_congure_impl/Makefile index 4e97854f3a1b..2e7f40701705 100644 --- a/tests/gnrc_sixlowpan_frag_sfr_congure_impl/Makefile +++ b/tests/gnrc_sixlowpan_frag_sfr_congure_impl/Makefile @@ -30,11 +30,16 @@ endif CONGURE_IMPL ?= congure_sfr +ifeq (congure_quic,$(CONGURE_IMPL)) + USEMODULE += gnrc_sixlowpan_frag_sfr_congure_quic + USEMODULE += ztimer_msec +else ifeq (congure_sfr,$(CONGURE_IMPL)) USEMODULE += gnrc_sixlowpan_frag_sfr_congure_sfr else $(error "Unknown CongURE implementation `$(CONGURE_IMPL)`") endif +endif .PHONY: zep_dispatch