git: 72ae93825244 - main - Add a comment to the new tcp_get_srtt method to clarify that ticks are kept in a shifted form and need to be un-shifted before use.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 19 May 2023 19:54:43 UTC
The branch main has been updated by rrs:
URL: https://cgit.FreeBSD.org/src/commit/?id=72ae938252446ce6c716cb51e3f27737b137900e
commit 72ae938252446ce6c716cb51e3f27737b137900e
Author: Randall Stewart <rrs@FreeBSD.org>
AuthorDate: 2023-05-19 19:53:26 +0000
Commit: Randall Stewart <rrs@FreeBSD.org>
CommitDate: 2023-05-19 19:53:26 +0000
Add a comment to the new tcp_get_srtt method to clarify that ticks
are kept in a shifted form and need to be un-shifted before use.
Suggested by: rpokala@
---
sys/netinet/tcp_subr.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index db0b3b76088e..7e156bcd5355 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -4649,8 +4649,10 @@ tcp_get_srtt(struct tcpcb *tp, int granularity)
if (tp->t_tmr_granularity == TCP_TMR_GRANULARITY_USEC)
srtt = tp->t_srtt;
- else if (tp->t_tmr_granularity == TCP_TMR_GRANULARITY_TICKS)
+ else if (tp->t_tmr_granularity == TCP_TMR_GRANULARITY_TICKS) {
+ /* TICKS are stored shifted; unshift for the real TICKS */
srtt = tp->t_srtt >> TCP_RTT_SHIFT;
+ }
if (tp->t_tmr_granularity == granularity)
return (srtt);
/* If we reach here they are oppsite what the caller wants */