From 04b5a939c6a29cdbc733b1113ee8baf400b601bb Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Thu, 30 Apr 2020 21:21:36 +0200 Subject: lib: Fix updating retransmission wheel Fixes infinite rescheduling with RTO getting lower than the timerwheel resolution. For very low RTO values we'd need a big packet buffer with the current memory allocator implementation (rdrbuff). Setting a (configurable) minimum RTO (250 us) reduces this need. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/lib/frct.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/lib/frct.c') diff --git a/src/lib/frct.c b/src/lib/frct.c index bc07be5a..0e9d64c7 100644 --- a/src/lib/frct.c +++ b/src/lib/frct.c @@ -25,7 +25,7 @@ #define DELT_A 3000 /* ms */ #define DELT_R 20000 /* ms */ -#define RQ_SIZE 64 +#define RQ_SIZE 1024 #define TW_ELEMENTS 6000 #define TW_RESOLUTION 1 /* ms */ @@ -119,9 +119,9 @@ static struct frcti * frcti_create(int fd) frcti->rttseq = 0; frcti->probe = false; - frcti->srtt_us = 0; /* updated on first ACK */ - frcti->mdev_us = 100000; /* initial rxm will be after 200 ms */ - frcti->rto = 200000; /* initial rxm will be after 200 ms */ + frcti->srtt_us = 0; /* updated on first ACK */ + frcti->mdev_us = 10000; /* initial rxm will be after 20 ms */ + frcti->rto = 20000; /* initial rxm will be after 20 ms */ if (ai.flows[fd].qs.loss == 0) { frcti->snd_cr.cflags |= FRCTFRTX; @@ -304,7 +304,7 @@ static void rtt_estimator(struct frcti * frcti, frcti->srtt_us = MAX(1U, srtt); frcti->mdev_us = MAX(1U, rttvar); - frcti->rto = srtt + (rttvar >> 2); + frcti->rto = MAX(RTO_MIN, srtt + (rttvar >> 2)); } /* Returns 0 when idx contains a packet for the application. */ @@ -391,6 +391,6 @@ static int __frcti_rcv(struct frcti * frcti, drop_packet: pthread_rwlock_unlock(&frcti->lock); shm_rdrbuff_remove(ai.rdrb, idx); - rxmwheel_move(); + return -EAGAIN; } -- cgit v1.2.3