From nobody Mon Oct 16 15:44:37 2023 X-Original-To: dev-commits-src-branches@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 4S8LyY4TvPz4xW3j; Mon, 16 Oct 2023 15:44:37 +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 4S8LyY3wtwz4bcG; Mon, 16 Oct 2023 15:44:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697471077; 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=SZURxd2brG8uf3YvfVsf+PQNfLvLi2tyz+KxArjxCZ8=; b=mBb1uZqh5VNQDSR9+mhII9x7flKCEd+SEqg7hZhEj6kyVHg1nj3ii2k/eXD+DWV0Qxo7gv de+j1tRpFP+nWaUzV0VTJZ6ji8aw6rwVAEG11vPEJdgQAn+TW/yA7BAClYfH/imhE7rZv2 2yWiy51H44bT2S6GSGa6FnOWNuKuA25WNWSZR2/i0zdw0R1f3agyt9LPGrzSJEDsgfgcE9 2CneiB+ezEeS4KwdYc4MeluSCUtGVA0CdcyXSlJj2CDaB8F2b7gcX9PilLqa5fhy1DDvVe Y3NsmXLL4ikLy9IJ9paKYksyq5NdHs5m+G9gVl9ck2HK2nU8vgzCHWqRlp+BIA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697471077; a=rsa-sha256; cv=none; b=N6HQ8YWJr0jgZzxZVdKHDxLbf2D4tie7URmiKSRbPM6hY42B0e5U81a9FrtHtRkM9iNEmk Ui85r/w3NPcZWwVG4/PPjkSQcmVgx4dlSu5j45gAJp0+VMdhJtOBsgQPOd7iRbL/nQmjVT sfCfBnJdY6ZjSV1it6K+/GEKp1jIA+cMqcSKduAF2GSgg/w4cVZM+VTBAqvXOuCaptwmS/ zYq7kSINjMKzx2Ibjfcxz7C4jCw3SG2RoTEFSjXdMgi2CxnmxJqTOnnXtUF64F9VsQ0Qr6 m6wpxCKWwDiqxZncunFQ8Ju/EExMebCoWYxhUWykJ+TbZ5u/+g4q+H46pU7nRg== 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=1697471077; 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=SZURxd2brG8uf3YvfVsf+PQNfLvLi2tyz+KxArjxCZ8=; b=mNPvXxXwComuJ3ncvi3BZ70Vv32cwolu8MPI94YqXKB/V3DxrMAzxNBOMItKyVu8jyMPe8 ZTbNPXKEQvRXEwKOrICR9bOUK7wrRpHmPJlm3gDgJxhYcMiRqq556UeA4qSOkr18W0K9wJ CVgsVQ2JeNnv+Cx+qzWW/rAp1Y8HCcqk/IeY/W7eabO2QMQf/x487+8qL4GtAi2X9ynB0V Asj5OZU68H5W2L3lXeNZOQviE9BsSVfXPhtM4qlCwckfNdKd4+E9mh+Zg60A+t02PHG3OI dXIBSqyyZgdnK6ktVU6qZ2tzYqJJ5c567Ycg+Mo2WbfGnV63f3uH4GW9f3R3nQ== 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 4S8LyY2gDfzmXV; Mon, 16 Oct 2023 15:44:37 +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 39GFib0g003922; Mon, 16 Oct 2023 15:44:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39GFibEn003919; Mon, 16 Oct 2023 15:44:37 GMT (envelope-from git) Date: Mon, 16 Oct 2023 15:44:37 GMT Message-Id: <202310161544.39GFibEn003919@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: 379f41a117eb - stable/13 - tcp: Simplify the initialization of loader tunable 'net.inet.tcp.tcbhashsize' List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 379f41a117eb8aaf1dd43414658606d2ef0534a7 Auto-Submitted: auto-generated The branch stable/13 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=379f41a117eb8aaf1dd43414658606d2ef0534a7 commit 379f41a117eb8aaf1dd43414658606d2ef0534a7 Author: Zhenlei Huang AuthorDate: 2023-10-08 10:03:59 +0000 Commit: Zhenlei Huang CommitDate: 2023-10-16 15:38:26 +0000 tcp: Simplify the initialization of loader tunable 'net.inet.tcp.tcbhashsize' No functional change intended. Reviewed by: cc, rscheff, #transport MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D41998 (cherry picked from commit 38ecc80b2a4e5e11ece83ca4df63632f0b6fa394) (cherry picked from commit 3a97686fc11ae51ceb4004c07702a8a20f71410d) --- sys/netinet/tcp_subr.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 905a72dd1f91..9bf02d21a307 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -299,8 +299,17 @@ static int tcp_log_debug = 0; SYSCTL_INT(_net_inet_tcp, OID_AUTO, log_debug, CTLFLAG_RW, &tcp_log_debug, 0, "Log errors caused by incoming TCP segments"); -static int tcp_tcbhashsize; -SYSCTL_INT(_net_inet_tcp, OID_AUTO, tcbhashsize, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, +/* + * Target size of TCP PCB hash tables. Must be a power of two. + * + * Note that this can be overridden by the kernel environment + * variable net.inet.tcp.tcbhashsize + */ +#ifndef TCBHASHSIZE +#define TCBHASHSIZE 0 +#endif +static int tcp_tcbhashsize = TCBHASHSIZE; +SYSCTL_INT(_net_inet_tcp, OID_AUTO, tcbhashsize, CTLFLAG_RDTUN, &tcp_tcbhashsize, 0, "Size of TCP control-block hashtable"); static int do_tcpdrain = 1; @@ -1052,16 +1061,6 @@ tcp_default_fb_fini(struct tcpcb *tp, int tcb_is_purged) return; } -/* - * Target size of TCP PCB hash tables. Must be a power of two. - * - * Note that this can be overridden by the kernel environment - * variable net.inet.tcp.tcbhashsize - */ -#ifndef TCBHASHSIZE -#define TCBHASHSIZE 0 -#endif - /* * XXX * Callouts should be moved into struct tcp directly. They are currently @@ -1374,11 +1373,8 @@ deregister_tcp_functions(struct tcp_function_block *blk, bool quiesce, void tcp_init(void) { - const char *tcbhash_tuneable; int hashsize; - tcbhash_tuneable = "net.inet.tcp.tcbhashsize"; - #ifdef TCP_HHOOK if (hhook_head_register(HHOOK_TYPE_TCP, HHOOK_TCP_EST_IN, &V_tcp_hhh[HHOOK_TCP_EST_IN], HHOOK_NOWAIT|HHOOK_HEADISINVNET) != 0) @@ -1392,8 +1388,7 @@ tcp_init(void) printf("%s: WARNING: unable to initialise TCP stats\n", __func__); #endif - hashsize = TCBHASHSIZE; - TUNABLE_INT_FETCH(tcbhash_tuneable, &hashsize); + hashsize = tcp_tcbhashsize; if (hashsize == 0) { /* * Auto tune the hash size based on maxsockets. @@ -1410,7 +1405,7 @@ tcp_init(void) hashsize = 512; if (bootverbose && IS_DEFAULT_VNET(curvnet)) printf("%s: %s auto tuned to %d\n", __func__, - tcbhash_tuneable, hashsize); + "net.inet.tcp.tcbhashsize", hashsize); } /* * We require a hashsize to be a power of two.