From nobody Mon Oct 16 15:18:13 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 4S8LN54H8Qz4xTsK; Mon, 16 Oct 2023 15:18:13 +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 4S8LN53mWMz4X8f; Mon, 16 Oct 2023 15:18:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697469493; 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=hESP2ZB7X30lacCeVxORB9HufXLVtLwNxeoT5ZR0a0U=; b=IeiEqmkyK5V8kn58nk9JANzX8u0TmGeR2OqLJVSwB1N5dICMx+/lnZFozmLK4XP3B3ZLOb Xxob/LWhHt3AON8dUo9K/tIAy3PQacTHc9EDDJyQvvIskJxjh4Z61V5us/WhetztFGS0vw Eeop0vsl7ABZlliQILXXSnPjtafyUMbSzi/KcofeZWrQKA88PwMg+mXekK7anXk4xfPxjP N5yCwnpn8HRRHHxbjn337tHn8sxxvZi5UTMPoBweeoh60TgtQosswVFAAxYmHv0cACg22A JhGlk2cMGW/xuL/kG3mU0Q3OqfgyO5D1qFWePy4nRtl9gNsVJNAz7p1LNF6tUA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697469493; a=rsa-sha256; cv=none; b=PlQnyMspeP8yPQB8YawT74DvuUglCXK+NDBMrPdJVpoMkkVIFuP/K71sXwbX56n8X7KHid 88eAk4A8fObi5ni301w2JDqleMGJt7S9nC1EjOCxz6vMDdio1BLig+a9fnanZzcirQ7WSt Verg34N8ywASWSBo8LMI0LYClLTvxOr2xPq3xiCwpTKXR0jPpWKEl6RK2rAYhiiifKqDZt t0Nbi/mYaa3T3jHOVP8RbIJTYkcF3FllRGh280mcA4AgWMB1zVRa2DWqzUW9eYcID7qRb1 0h8ONKDKgULjwXXhlR6dPvshdr/f4+2LfZntocrBZ+kLNN+Qp4g0SYbtYis9vg== 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=1697469493; 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=hESP2ZB7X30lacCeVxORB9HufXLVtLwNxeoT5ZR0a0U=; b=QhyQEpzsaQpjcNv23tkvZ5Lpu/K4KHKLJwkxy0wlFszRPpj7PEOKEz/1Nu/doX6EcDT83o apzlFc0zDkBK9B23jQRv3D4zpwXR5Iw+cg6AEVrIuWQ0ab5coMQSlqN5cjMIWJ9Ma/vfKV anbD/0+hvb2lFDQX0LnfVQqDVaM4TdTFWklhlk/ygy2jC2G07yxAeeDxyZF1vBDMLRKIFr Z3Nsp6/mTp03rDGqsHVRRR3yrKDBet4RQ32QCn6rwk1CDC8cEI10G1mbTiyLuIRHb5/ixq DWSQKw8wj7mwQnvKSKmPM3b/WQlzq2WFiU0O4eyVVAAqAW200v15IgK8ba3cyw== 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 4S8LN52Ywszlfn; Mon, 16 Oct 2023 15:18:13 +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 39GFIDlE054289; Mon, 16 Oct 2023 15:18:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39GFIDL7054286; Mon, 16 Oct 2023 15:18:13 GMT (envelope-from git) Date: Mon, 16 Oct 2023 15:18:13 GMT Message-Id: <202310161518.39GFIDL7054286@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: 3a97686fc11a - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 3a97686fc11ae51ceb4004c07702a8a20f71410d Auto-Submitted: auto-generated The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=3a97686fc11ae51ceb4004c07702a8a20f71410d commit 3a97686fc11ae51ceb4004c07702a8a20f71410d Author: Zhenlei Huang AuthorDate: 2023-10-08 10:03:59 +0000 Commit: Zhenlei Huang CommitDate: 2023-10-16 15:15:37 +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) --- sys/netinet/tcp_subr.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 696bd40f7ada..27b0eae83837 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -305,8 +305,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; @@ -1152,16 +1161,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 - MALLOC_DEFINE(M_TCPLOG, "tcplog", "TCP address and flags print buffers"); MALLOC_DEFINE(M_TCPFUNCTIONS, "tcpfunc", "TCP function set memory"); @@ -1508,7 +1507,6 @@ VNET_SYSINIT(tcp_vnet_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_FOURTH, static void tcp_init(void *arg __unused) { - const char *tcbhash_tuneable; int hashsize; tcp_reass_global_init(); @@ -1576,9 +1574,7 @@ tcp_init(void *arg __unused) tcp_pcap_init(); #endif - hashsize = TCBHASHSIZE; - tcbhash_tuneable = "net.inet.tcp.tcbhashsize"; - TUNABLE_INT_FETCH(tcbhash_tuneable, &hashsize); + hashsize = tcp_tcbhashsize; if (hashsize == 0) { /* * Auto tune the hash size based on maxsockets. @@ -1595,7 +1591,7 @@ tcp_init(void *arg __unused) hashsize = 512; if (bootverbose) 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.