summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2020-12-06 14:24:51 +0100
committerSander Vrijders <sander@ouroboros.rocks>2020-12-07 18:39:45 +0100
commite5fdcfb3cfee29385c44bf487638ac5a535ee5d6 (patch)
treef47593caaaf93e573a4d2a37907d0e380ab14e8b
parentf52e231e3e71fa97276260d87f192701e2232614 (diff)
downloadouroboros-e5fdcfb3cfee29385c44bf487638ac5a535ee5d6.tar.gz
ouroboros-e5fdcfb3cfee29385c44bf487638ac5a535ee5d6.zip
ipcpd: Fix slow start in multi-bit (F)ECN policy
There is a check not to rapidly double the window to astronomical sizes when there is no congestion experienced for long periods of time, but the if-else logic was botched and it still grew to astronomical sizes (albeit linear instead of exponential). I also lowered the ECN threshold a bit. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
-rw-r--r--src/ipcpd/unicast/pol/ca-mb-ecn.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/ipcpd/unicast/pol/ca-mb-ecn.c b/src/ipcpd/unicast/pol/ca-mb-ecn.c
index 31a646b2..1baaca7a 100644
--- a/src/ipcpd/unicast/pol/ca-mb-ecn.c
+++ b/src/ipcpd/unicast/pol/ca-mb-ecn.c
@@ -46,7 +46,7 @@
#define CA_IWL 1 << 16 /* Initial limit ~4MiB/s */
#define CA_MINPS 8 /* Mimimum pkts / slot */
#define CA_MAXPS 64 /* Maximum pkts / slot */
-#define ECN_Q_SHFT 5
+#define ECN_Q_SHFT 4
#define ts_to_ns(ts) (ts.tv_sec * BILLION + ts.tv_nsec)
struct mb_ecn_ctx {
@@ -127,13 +127,16 @@ ca_wnd_t mb_ecn_ctx_update_snd(void * _ctx,
if (slot > ctx->tx_slot) {
ctx->tx_slot = slot;
- if (!ctx->tx_cav && ctx->tx_wbc > ctx->tx_wbl) /* Slow start */
- ctx->tx_wbl <<= 1;
- else if (ctx->tx_ece) /* Multiplicative Decrease */
- ctx->tx_wbl -= (ctx->tx_wbl * ctx->tx_ece)
- >> (CA_SHFT + 8);
- else /* Additive Increase */
- ctx->tx_wbl = ctx->tx_wbl + ctx->tx_inc;
+ if (!ctx->tx_cav) { /* Slow start */
+ if (ctx->tx_wbc > ctx->tx_wbl)
+ ctx->tx_wbl <<= 1;
+ } else {
+ if (ctx->tx_ece) /* Mult. Decrease */
+ ctx->tx_wbl -= (ctx->tx_wbl * ctx->tx_ece)
+ >> (CA_SHFT + 8);
+ else if (ctx->tx_wbc > ctx->tx_wbl) /* Add. Increase */
+ ctx->tx_wbl = ctx->tx_wbl + ctx->tx_inc;
+ }
/* Window scaling */
if (ctx->tx_wpc < CA_MINPS) {