From nobody Fri Dec 17 18:51:28 2021 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 3877518F8F84; Fri, 17 Dec 2021 18:51:29 +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 4JFykS6xgrz4rvw; Fri, 17 Dec 2021 18:51:28 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 C4EC721349; Fri, 17 Dec 2021 18:51:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BHIpSkS058141; Fri, 17 Dec 2021 18:51:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BHIpS31058140; Fri, 17 Dec 2021 18:51:28 GMT (envelope-from git) Date: Fri, 17 Dec 2021 18:51:28 GMT Message-Id: <202112171851.1BHIpS31058140@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 75add59a8ee2 - main - tcp: allocate statistics in the main tcp_init() 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 75add59a8ee2e24cb76a2f0fcbf9aa6d740e3bb6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639767089; 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=2RFTEjIFR2vYyNlkxYXKsLUx/JmibRnybqjG2Mu3e00=; b=YZPst5rzDvbOmFjKYFMZNpLSr+HngkSSRU8rGgyhRQv0IK2Pf0VzAAFxkVVbFP8JIrUi3S /1Ist+c3H9XRVR+ERUWaXNDpLWGc/UBDx1zuIW4uFJHjFINZMkg7kKhPL/okwwB/ObEuN5 89N8gNi7l9dJ7Ci4q0HuhErajVmnbJrYXyJh8cYhZkM6yvbuMPNleL7RhGAAk6H19tj2ny LWFH942/GYYVnlOXA94w+YN6SMGGxpk2hsrfBLaG6kt+3s/H8Q1bSHz4zzJBkLQavqIh8Q kdr1sRqpqlya0z3mmMjH23pkHSJP+WHbptJlPDmK6V/kWOouZtqb6zQxN+LJDA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639767089; a=rsa-sha256; cv=none; b=txP2DW6ifrBEd1ydfMzG/TP5wCMX3NiCFHqUbkcw5vh1dLigekNJny13cxVXqYzWjw2mZg Lb56T65JCVQV2J/v9vK4n84ehFYOFNmChKxyEFPglyiTw30Ltheec6kQ+R1BRsEDm6d9s0 1KMnohm4YL6T3dD4ST0sgrWlS9qvs68XyDMmViCv/Kfs9HQwEH0A4aeYiRi2FWSFqdP/3m uvfK6TcZAinCE/mmwG3BTZ48koy9KfSMofjMx0xHapWMuCMLbL16QUeH7g1QSuN8+HgvzZ O5lfkDdyyPNNHU+y6qJfZgNNfz/5B7fvxnsfT7FLvHyiCSeTscgN9zuviiHj3w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=75add59a8ee2e24cb76a2f0fcbf9aa6d740e3bb6 commit 75add59a8ee2e24cb76a2f0fcbf9aa6d740e3bb6 Author: Gleb Smirnoff AuthorDate: 2021-12-17 18:50:56 +0000 Commit: Gleb Smirnoff CommitDate: 2021-12-17 18:50:56 +0000 tcp: allocate statistics in the main tcp_init() No reason to have a separate SYSINIT. --- sys/netinet/tcp_input.c | 22 ---------------------- sys/netinet/tcp_subr.c | 6 ++++++ 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index ee514a11eef6..9332bf16235f 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -258,28 +258,6 @@ SYSCTL_COUNTER_U64_ARRAY(_net_inet_tcp, TCPCTL_STATES, states, CTLFLAG_RD | CTLFLAG_VNET, &VNET_NAME(tcps_states)[0], TCP_NSTATES, "TCP connection counts by TCP state"); -static void -tcp_vnet_init(const void *unused) -{ - - COUNTER_ARRAY_ALLOC(V_tcps_states, TCP_NSTATES, M_WAITOK); - VNET_PCPUSTAT_ALLOC(tcpstat, M_WAITOK); -} -VNET_SYSINIT(tcp_vnet_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, - tcp_vnet_init, NULL); - -#ifdef VIMAGE -static void -tcp_vnet_uninit(const void *unused) -{ - - COUNTER_ARRAY_FREE(V_tcps_states, TCP_NSTATES); - VNET_PCPUSTAT_FREE(tcpstat); -} -VNET_SYSUNINIT(tcp_vnet_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, - tcp_vnet_uninit, NULL); -#endif /* VIMAGE */ - /* * Kernel module interface for updating tcpstat. The first argument is an index * into tcpstat treated as an array. diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 1ce8cddc30e1..232163fe9fe5 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1503,6 +1503,9 @@ tcp_init(void) tcp_fastopen_init(); + COUNTER_ARRAY_ALLOC(V_tcps_states, TCP_NSTATES, M_WAITOK); + VNET_PCPUSTAT_ALLOC(tcpstat, M_WAITOK); + /* Skip initialization of globals for non-default instances. */ if (!IS_DEFAULT_VNET(curvnet)) return; @@ -1614,6 +1617,9 @@ tcp_destroy(void *unused __unused) */ tcp_fastopen_destroy(); + COUNTER_ARRAY_FREE(V_tcps_states, TCP_NSTATES); + VNET_PCPUSTAT_FREE(tcpstat); + #ifdef TCP_HHOOK error = hhook_head_deregister(V_tcp_hhh[HHOOK_TCP_EST_IN]); if (error != 0) {