git: f5abdb03119a - main - tcp: fix a bug where unshifting should be put last in tcp_get_srtt()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 26 May 2023 10:35:18 UTC
The branch main has been updated by cc:
URL: https://cgit.FreeBSD.org/src/commit/?id=f5abdb03119a7e6608f0cfee0e7a28c94b9b0ca1
commit f5abdb03119a7e6608f0cfee0e7a28c94b9b0ca1
Author: Cheng Cui <cc@FreeBSD.org>
AuthorDate: 2023-05-25 13:14:38 +0000
Commit: Cheng Cui <cc@FreeBSD.org>
CommitDate: 2023-05-26 06:30:52 +0000
tcp: fix a bug where unshifting should be put last in tcp_get_srtt()
Reported by: Bhaskar Pardeshi from VMware.
Reviewers: rscheff, tuexen, #transport!
Approved by: tuexen (mentor)
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D40267
---
sys/netinet/tcp_subr.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 8636ff4cefeb..52222d7c1634 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -4660,8 +4660,9 @@ tcp_get_srtt(struct tcpcb *tp, int granularity)
/*
* The user wants useconds and internally
* its kept in ticks, convert to useconds.
+ * Put unshift at last improves precision.
*/
- srtt = TICKS_2_USEC(srtt);
+ srtt = TICKS_2_USEC(tp->t_srtt) >> TCP_RTT_SHIFT;
} else if (granularity == TCP_TMR_GRANULARITY_TICKS) {
/*
* The user wants ticks and internally its