From nobody Wed Apr 03 16:42:59 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4V8rCS0fgnz5FNhl; Wed, 3 Apr 2024 16:43:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4V8rCS0C9Yz4sl5; Wed, 3 Apr 2024 16:43:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712162580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4c87JOffUneX1sx9CQX8GynSfXsCoERXSLyvcV6w4YY=; b=ou7fJCBtOJItiMaJn8DBHx71R+fZ8NZBPA4UQXxmkGlncyT7NTrkOeBsuNRQvekqVef271 vfd3JFRrrfvF6Ke5oL9A936GsDmuz/2H67FTSJp8rZq7JfkD0zzspfISlbwSS6KIkE9bXq AlLXvRvHqhSsRNB6cIyemtUpfMi/eWTqfw5rle7wzm/mggB+uLgFJVvB4TbbSy6VPfTsQi ospN4gLOGJ3UQimXrhK3sVNynS94kpuJQzytXjy121mLCbawv2jjANlTCyUt7O4p1TU3rs 8uNKb5+i+q6ci9AY1K1K0eB/god9V28hRMPu7le9awJDyF6N9TTjdwchbw7nWg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712162580; a=rsa-sha256; cv=none; b=xenNBOL0ooKSmLH2weCHema0nJAzsdpTvL44O64MKyg4YjleZJU18OywCunMOeBMBUhkxn eUZbfQ8dWNzemCC+ZzMtd164miqGVkIHoccCQsL9z4S4sWQLt/ofagFYEsAw5M6Mnt72tq /mmqJwJrSu+mdP1dCvb1nzoljO8zuU+2echNLdGvIxdWRZfIhI+oFrA4olMl9NoH1JSETR /P98BPZv2w1xizAeSDQsSRgTXHu4YWR0fiPs4Dv9crGadxUYCb1kqSYcqKZ6PUG6lDOayI z1lkRHpoqeainTtDUs/+1ohuBK3Iz8d3+VsjAdSEDWeyYuo70zxpGHSOo+3JSA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712162580; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4c87JOffUneX1sx9CQX8GynSfXsCoERXSLyvcV6w4YY=; b=PjM7xwfH6RqwdB5edqbC5lBNFJisFokZxV2KclMUm2KXaW3Ea5KqHhTwIheLJm2QbhXMLp 7U6/tO02/xJ9wofeMSwoE8akNGtimMexyMQw/H/hFiKdKF6r+SCz1dN3RW4RXAzeVXMJfE H2FabnBqUnjCRNe+8rTBGLNbUq5cW42/glZGYDEFFj/uANUUS415CYTOGS57HE+YeuIiUb ZkZ8ZfiQH/Gyb5xIIi2aBObNfwmOgj4fe3UD2QB1DvSzCJt06rsEwknW2EreJw6mCMDgMa zqtKOrhQEiArhxvSbO1mMp+u1dM2d4WiIRwvhRbmt8R4hYsoJ0B1s0AWLS/u+Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4V8rCR6xByzg1V; Wed, 3 Apr 2024 16:42:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 433Ggxg0046840; Wed, 3 Apr 2024 16:42:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 433GgxSw046837; Wed, 3 Apr 2024 16:42:59 GMT (envelope-from git) Date: Wed, 3 Apr 2024 16:42:59 GMT Message-Id: <202404031642.433GgxSw046837@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: e0bd180130b8 - main - tcp: fix conversion of rttvar List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e0bd180130b8c95f568483d0df6abff00d7d2153 Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=e0bd180130b8c95f568483d0df6abff00d7d2153 commit e0bd180130b8c95f568483d0df6abff00d7d2153 Author: Michael Tuexen AuthorDate: 2024-04-03 16:39:31 +0000 Commit: Michael Tuexen CommitDate: 2024-04-03 16:39:31 +0000 tcp: fix conversion of rttvar A wrong variable and wrong scaling factors were used. Reported by: Coverity Scan CID: 1508689 Reviewed by: rscheff MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D44612 --- sys/netinet/tcp_subr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index db335a890b28..860d65249148 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -4240,19 +4240,19 @@ tcp_change_time_units(struct tcpcb *tp, int granularity) uint32_t val, frac; val = USEC_2_TICKS(tp->t_rttvar); - frac = tp->t_srtt % (HPTS_USEC_IN_SEC / hz); + frac = tp->t_rttvar % (HPTS_USEC_IN_SEC / hz); tp->t_rttvar = val << TCP_RTTVAR_SHIFT; /* * frac is the fractional part here is left * over from converting to hz and shifting. - * We need to convert this to the 5 bit + * We need to convert this to the 4 bit * remainder. */ if (frac) { if (hz == 1000) { - frac = (((uint64_t)frac * (uint64_t)TCP_RTT_SCALE) / (uint64_t)HPTS_USEC_IN_MSEC); + frac = (((uint64_t)frac * (uint64_t)TCP_RTTVAR_SCALE) / (uint64_t)HPTS_USEC_IN_MSEC); } else { - frac = (((uint64_t)frac * (uint64_t)(hz) * (uint64_t)TCP_RTT_SCALE) /(uint64_t)HPTS_USEC_IN_SEC); + frac = (((uint64_t)frac * (uint64_t)(hz) * (uint64_t)TCP_RTTVAR_SCALE) /(uint64_t)HPTS_USEC_IN_SEC); } tp->t_rttvar += frac; }