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
This commit is contained in:
Cheng Cui 2023-05-25 09:14:38 -04:00
parent e4a905d1e0
commit f5abdb0311
No known key found for this signature in database
GPG key ID: F9BE886D1486EF98

View file

@ -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