diff --git a/makefiles/pseudomodules.inc.mk b/makefiles/pseudomodules.inc.mk index 1aa702b266ae..40ad9fa7bfd0 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_reno gnrc_sixlowpan_frag_sfr_congure_reno: TCP Reno +## @brief Congestion control for SFR using the [TCP Reno congestion control algorithm](@ref sys_congure_reno) +## @{ +PSEUDOMODULES += gnrc_sixlowpan_frag_sfr_congure_reno +## @} ## @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) ## @{ diff --git a/sys/include/net/gnrc/sixlowpan/frag/sfr/congure.h b/sys/include/net/gnrc/sixlowpan/frag/sfr/congure.h index b960e95b04b8..38ebbe24842a 100644 --- a/sys/include/net/gnrc/sixlowpan/frag/sfr/congure.h +++ b/sys/include/net/gnrc/sixlowpan/frag/sfr/congure.h @@ -17,6 +17,7 @@ * * - @ref net_gnrc_sixlowpan_frag_sfr_congure_sfr (the default) * - @ref net_gnrc_sixlowpan_frag_sfr_congure_quic + * - @ref net_gnrc_sixlowpan_frag_sfr_congure_reno * @{ * * @file diff --git a/sys/net/gnrc/Makefile.dep b/sys/net/gnrc/Makefile.dep index b578d2d4b2e7..dd8e8dc58875 100644 --- a/sys/net/gnrc/Makefile.dep +++ b/sys/net/gnrc/Makefile.dep @@ -248,6 +248,10 @@ ifneq (,$(filter gnrc_sixlowpan_frag_sfr_congure_quic,$(USEMODULE))) USEMODULE += congure_quic endif +ifneq (,$(filter gnrc_sixlowpan_frag_sfr_congure_reno,$(USEMODULE))) + USEMODULE += congure_reno +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_reno.c b/sys/net/gnrc/network_layer/sixlowpan/frag/sfr/congure_reno.c new file mode 100644 index 000000000000..6eca41496e16 --- /dev/null +++ b/sys/net/gnrc/network_layer/sixlowpan/frag/sfr/congure_reno.c @@ -0,0 +1,69 @@ +/* + * 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/reno.h" +#include "net/gnrc/sixlowpan/config.h" + +#include "net/gnrc/sixlowpan/frag/sfr/congure.h" + +typedef congure_reno_snd_t _sfr_congure_snd_t; + +#define SFR_CONGURE_RENO_CONSTS { \ + .fr = _fr, \ + .same_wnd_adv = _same_wnd_adv, \ + .init_mss = 1, \ + .cwnd_lower = CONFIG_GNRC_SIXLOWPAN_SFR_MIN_WIN_SIZE, \ + .cwnd_upper = CONFIG_GNRC_SIXLOWPAN_SFR_MAX_WIN_SIZE, \ + /* TODO make those configurable via Kconfig? */ \ + .init_ssthresh = 32U, \ + .frthresh = 1U, \ + } + +static void _fr(congure_reno_snd_t *c); +static bool _same_wnd_adv(congure_reno_snd_t *c, congure_snd_ack_t *ack); + +static _sfr_congure_snd_t _sfr_congures[CONFIG_GNRC_SIXLOWPAN_FRAG_FB_SIZE]; +static const congure_reno_snd_consts_t _sfr_congure_reno_consts = SFR_CONGURE_RENO_CONSTS; + +congure_snd_t *gnrc_sixlowpan_frag_sfr_congure_snd_get(void) +{ + for (unsigned i = 0; i < ARRAY_SIZE(_sfr_congures); i++) { + if (_sfr_congures[i].super.driver == NULL) { + congure_reno_snd_setup(&_sfr_congures[i], + &_sfr_congure_reno_consts); + return &_sfr_congures[i].super; + } + } + return NULL; +} + +static void _fr(congure_reno_snd_t *c) +{ + (void)c; + /* SFR resends when fast retransmits needs to be done anyways so + * do nothing */ + return; +} + +static bool _same_wnd_adv(congure_reno_snd_t *c, congure_snd_ack_t *ack) +{ + (void)c; + (void)ack; + /* Window size is not advertised with SFR, so always true */ + return true; +} + +/** @} */ diff --git a/tests/gnrc_sixlowpan_frag_sfr_congure_impl/Makefile b/tests/gnrc_sixlowpan_frag_sfr_congure_impl/Makefile index 2e7f40701705..cc65b52781a5 100644 --- a/tests/gnrc_sixlowpan_frag_sfr_congure_impl/Makefile +++ b/tests/gnrc_sixlowpan_frag_sfr_congure_impl/Makefile @@ -34,12 +34,16 @@ ifeq (congure_quic,$(CONGURE_IMPL)) USEMODULE += gnrc_sixlowpan_frag_sfr_congure_quic USEMODULE += ztimer_msec else +ifeq (congure_reno,$(CONGURE_IMPL)) + USEMODULE += gnrc_sixlowpan_frag_sfr_congure_reno +else ifeq (congure_sfr,$(CONGURE_IMPL)) USEMODULE += gnrc_sixlowpan_frag_sfr_congure_sfr else $(error "Unknown CongURE implementation `$(CONGURE_IMPL)`") endif endif +endif .PHONY: zep_dispatch