From 1312034c37c6f389f65bfb2f6cee05260d751848 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 1 Apr 2022 21:10:57 +0200 Subject: lib: Fix delayed ACK under high load The delayed ACK was wrongly measuring the delay against the receiver activity instead of the sender activity. Also fixed receiver activity not being updated for non-data packets (and duplicates and other dropped traffic). Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/lib/frct.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lib/frct.c b/src/lib/frct.c index 4effad3b..d6db6fea 100644 --- a/src/lib/frct.c +++ b/src/lib/frct.c @@ -302,7 +302,13 @@ static void send_frct_pkt(struct frcti * frcti) rwe = frcti->rcv_cr.rwe; diff = ts_diff_ns(&frcti->rcv_cr.act, &now); - if (diff > frcti->a || diff < TICTIME) { + if (diff > frcti->a) { + pthread_rwlock_unlock(&frcti->lock); + return; + } + + diff = ts_diff_ns(&frcti->snd_cr.act, &now); + if (diff < TICTIME) { pthread_rwlock_unlock(&frcti->lock); return; } @@ -828,6 +834,8 @@ static void __frcti_rcv(struct frcti * frcti, } } + rcv_cr->act = now; + /* For now, just send an immediate window update. */ if (pci->flags & FRCT_RDVS) { fd = frcti->fd; @@ -914,8 +922,6 @@ static void __frcti_rcv(struct frcti * frcti, frcti->rq[pos] = idx; - rcv_cr->act = now; - pthread_rwlock_unlock(&frcti->lock); if (fd != -1) -- cgit v1.2.3