Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Fix RTT values reported by TCP_INFO.



details:   https://anonhg.NetBSD.org/src/rev/4cc5ef60219d
branches:  trunk
changeset: 955927:4cc5ef60219d
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sat Oct 17 08:50:38 2020 +0000

description:
Fix RTT values reported by TCP_INFO.

diffstat:

 sys/netinet/tcp_usrreq.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r c7d2f19db2ab -r 4cc5ef60219d sys/netinet/tcp_usrreq.c
--- a/sys/netinet/tcp_usrreq.c  Sat Oct 17 08:46:02 2020 +0000
+++ b/sys/netinet/tcp_usrreq.c  Sat Oct 17 08:50:38 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_usrreq.c,v 1.226 2020/04/13 15:54:45 maxv Exp $    */
+/*     $NetBSD: tcp_usrreq.c,v 1.227 2020/10/17 08:50:38 mlelstv Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -99,7 +99,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.226 2020/04/13 15:54:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.227 2020/10/17 08:50:38 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -258,8 +258,10 @@
        ti->tcpi_rto = tp->t_rxtcur * tick;
        ti->tcpi_last_data_recv = (long)(getticks() -
                                         (int)tp->t_rcvtime) * tick;
-       ti->tcpi_rtt = ((u_int64_t)tp->t_srtt * tick) >> TCP_RTT_SHIFT;
-       ti->tcpi_rttvar = ((u_int64_t)tp->t_rttvar * tick) >> TCP_RTTVAR_SHIFT;
+       ti->tcpi_rtt = ((u_int64_t)tp->t_srtt * tick / PR_SLOWHZ)
+                          >> (TCP_RTT_SHIFT + 2);
+       ti->tcpi_rttvar = ((u_int64_t)tp->t_rttvar * tick / PR_SLOWHZ)
+                          >> (TCP_RTTVAR_SHIFT + 2);
 
        ti->tcpi_snd_ssthresh = tp->snd_ssthresh;
        /* Linux API wants these in # of segments, apparently */



Home | Main Index | Thread Index | Old Index