From a5541ee04ff9313b47b6007cb310a657588730db Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Wed, 10 Feb 2021 17:33:31 +0100 Subject: [PATCH] gnrc_sixlowpan_frag_sfr_congure: add congure_quic support --- makefiles/pseudomodules.inc.mk | 5 ++ .../net/gnrc/sixlowpan/frag/sfr/congure.h | 1 + sys/net/gnrc/Makefile.dep | 4 ++ .../sixlowpan/frag/sfr/congure_quic.c | 52 +++++++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 sys/net/gnrc/network_layer/sixlowpan/frag/sfr/congure_quic.c diff --git a/makefiles/pseudomodules.inc.mk b/makefiles/pseudomodules.inc.mk index 0f539bb0dfff8..89bfd9c96478b 100644 --- a/makefiles/pseudomodules.inc.mk +++ b/makefiles/pseudomodules.inc.mk @@ -235,6 +235,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 d4c91b959b8e2..a0fbd76ab725b 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 c963e45935e60..217b9086f9436 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_%,$(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 0000000000000..14aa238198075 --- /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; +} + +/** @} */