From nobody Sun Oct 08 10:05:30 2023 X-Original-To: dev-commits-src-main@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 4S3Hpy6CvLz4w6qn; Sun, 8 Oct 2023 10:05:30 +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 4S3Hpy5l7lz3TWT; Sun, 8 Oct 2023 10:05:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696759530; 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=3g0AGXVpe9Eh9x15t2WOHt/UjhKpNBfe9JG0RNWx3+4=; b=Wam0D+f2qvR9q0Fcp2pIVFWe3ckQhXpDlDpozGPJ7cWUlhwlRpx0N8tzF12OTy6TqzJ0CV 79G7A6WgabiAvU2DjxEY5HaX546vjF9LTdvb6zQPu/eiSgr75mwa7lBuDrhHTzFTnMppsN 59WrRE778FSGyCA7dbA3TFEVeaIDYwm++JBX7oh2b1Jvat4WK2L0xu5T0+R3acBSHozTP1 +tR58slzqMhZeEaF6hPrwPYCMaatbje31iuJZqmGsMUn8H1o5jeivhknMOPOXPQenTyp6Y 1wjC0LlxHlPeSotfOIqMnGqIXJ4t95pNLcpv1yWYHn/Qtd2cxBMYLWpOaVvj0w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696759530; a=rsa-sha256; cv=none; b=YY96Obun7G0GbFvGGisT9DtVgoKVtJCMtGcOvk+jOcD0WdAQ79zsVBo5a2jnozDC8MiFfZ aF/EO64SFeJN32WNmM7iieUpVee2OQnZ5hx6eVX1wpSNW9rzt3vm9ORWFwCKZtyR9WOEVq nMwcMJxuHGSrteTDtu5Zw3TVU3N+biO/cEeG9pGsybMjntgf9A+8A0WpeFUjpLQ5/gbM3g dfYfNqpO7iUF3R1p5VUOavUTuItYOUyFALjTnfyaxi5V9G3IrU8flTZjmaoYbCRm3Wv0UG ewEsfomDQvvNDR5cbsBuiPlr671RZFKU/pCdyUVRiyXePmxFwGAy8bsLvmd0WA== 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=1696759530; 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=3g0AGXVpe9Eh9x15t2WOHt/UjhKpNBfe9JG0RNWx3+4=; b=SrAT3CRsKR8gW50/sISCUM/DkwN7goGJtF2QOaGE973tpnQYSlPh3ju4hQLwwK8p6JXPUY eh8wm0JBWgNVeNPbdqZerf4Xp/QBVF7przjO08x7mxx0Cb+Ssa+bwzmn99OQWjK9j883ma Z+VAoY1KajTI0d2IcOBnvkdBfmV3MJxpmTODVNpgyB3W7XZVtsnvWENoF7zZ0OO5mUvxUq 2wj1L8cgoorQ8NNNONKb7mOK/WsEhSo6CWlPxmWm3XuKTb/PiXotDPMxVSBkSyDaFUBX7J f07B4iStlaAm2IzaBSyJaGVlHYglrnt285OTd0VWPy+bZCewzgUd/Cp6bxsKXw== 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 4S3Hpy4gydz18B1; Sun, 8 Oct 2023 10:05:30 +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 398A5U12052682; Sun, 8 Oct 2023 10:05:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 398A5UGM052679; Sun, 8 Oct 2023 10:05:30 GMT (envelope-from git) Date: Sun, 8 Oct 2023 10:05:30 GMT Message-Id: <202310081005.398A5UGM052679@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 38ecc80b2a4e - main - tcp: Simplify the initialization of loader tunable 'net.inet.tcp.tcbhashsize' List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 38ecc80b2a4e5e11ece83ca4df63632f0b6fa394 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=38ecc80b2a4e5e11ece83ca4df63632f0b6fa394 commit 38ecc80b2a4e5e11ece83ca4df63632f0b6fa394 Author: Zhenlei Huang AuthorDate: 2023-10-08 10:03:59 +0000 Commit: Zhenlei Huang CommitDate: 2023-10-08 10:03:59 +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 --- 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.