git: 04831efd9f6b - main - tcp: Rack idle reduce not working.

From: Randall Stewart <rrs_at_FreeBSD.org>
Date: Tue, 10 May 2022 13:47:53 UTC
The branch main has been updated by rrs:

URL: https://cgit.FreeBSD.org/src/commit/?id=04831efd9f6b1426c160befdc9f7e6b8e1f3e272

commit 04831efd9f6b1426c160befdc9f7e6b8e1f3e272
Author:     Randall Stewart <rrs@FreeBSD.org>
AuthorDate: 2022-05-10 13:46:05 +0000
Commit:     Randall Stewart <rrs@FreeBSD.org>
CommitDate: 2022-05-10 13:46:05 +0000

    tcp: Rack idle reduce not working.
    
    Rack converted to micro-seconds quite some time ago, but in testing
    we have found a miss in that work. The idle reduce time is still based
    in ticks, so it must be converted to microseconds before any comparisons
    else you will likely not do idle reduce.
    
    Reviewed by: tuexen, thj
    Sponsored by: Netflix Inc
    Differential Revision: https://reviews.freebsd.org/D35066
---
 sys/netinet/tcp_stacks/rack.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c
index 30a23a578dd4..cda6bd1fcf84 100644
--- a/sys/netinet/tcp_stacks/rack.c
+++ b/sys/netinet/tcp_stacks/rack.c
@@ -13467,7 +13467,7 @@ rack_do_compressed_ack_processing(struct tcpcb *tp, struct socket *so, struct mb
 		/* Update the rcv time and perform idle reduction possibly */
 		if  (tp->t_idle_reduce &&
 		     (tp->snd_max == tp->snd_una) &&
-		     ((ticks - tp->t_rcvtime) >= tp->t_rxtcur)) {
+		     (TICKS_2_USEC(ticks - tp->t_rcvtime) >= tp->t_rxtcur)) {
 			counter_u64_add(rack_input_idle_reduces, 1);
 			rack_cc_after_idle(rack, tp);
 		}
@@ -14232,7 +14232,7 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr *th, struct socket *so,
 	 */
 	if  (tp->t_idle_reduce &&
 	     (tp->snd_max == tp->snd_una) &&
-	     ((ticks - tp->t_rcvtime) >= tp->t_rxtcur)) {
+	     (TICKS_2_USEC(ticks - tp->t_rcvtime) >= tp->t_rxtcur)) {
 		counter_u64_add(rack_input_idle_reduces, 1);
 		rack_cc_after_idle(rack, tp);
 	}
@@ -16783,7 +16783,7 @@ rack_output(struct tcpcb *tp)
 	 */
 	idle = (tp->t_flags & TF_LASTIDLE) || (tp->snd_max == tp->snd_una);
 	if (tp->t_idle_reduce) {
-		if (idle && ((ticks - tp->t_rcvtime) >= tp->t_rxtcur))
+		if (idle && (TICKS_2_USEC(ticks - tp->t_rcvtime) >= tp->t_rxtcur))
 			rack_cc_after_idle(rack, tp);
 	}
 	tp->t_flags &= ~TF_LASTIDLE;