From 33402296d3dc37b0b53ca012611ea8cb33bc2aac Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Tue, 9 Mar 2021 10:54:47 +0100 Subject: [PATCH] gnrc_sixlowpan_frag_sfr_congure: add congure_reno support --- makefiles/pseudomodules.inc.mk | 5 ++ .../net/gnrc/sixlowpan/frag/sfr/congure.h | 1 + sys/net/gnrc/Makefile.dep | 4 ++ .../sixlowpan/frag/sfr/congure_reno.c | 69 +++++++++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 sys/net/gnrc/network_layer/sixlowpan/frag/sfr/congure_reno.c diff --git a/makefiles/pseudomodules.inc.mk b/makefiles/pseudomodules.inc.mk index 1aa702b266..40ad9fa7bf 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 b960e95b04..38ebbe2484 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 b578d2d4b2..dd8e8dc588 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 0000000000..6eca41496e --- /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; +} + +/** @} */