From nobody Mon Dec 06 17:32:50 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 EEDC018C4D49; Mon, 6 Dec 2021 17:32:52 +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 4J79Vq3sVCz3jkZ; Mon, 6 Dec 2021 17:32:51 +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 027497D7A; Mon, 6 Dec 2021 17:32:51 +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 1B6HWoQ8068648; Mon, 6 Dec 2021 17:32:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B6HWoKc068647; Mon, 6 Dec 2021 17:32:50 GMT (envelope-from git) Date: Mon, 6 Dec 2021 17:32:50 GMT Message-Id: <202112061732.1B6HWoKc068647@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: 7e0bba4d8083 - main - ifnet: make V_if_index static to if.c 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: 7e0bba4d8083b6fac71180681b51aee9ed5fb664 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638811971; 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=V/PY62cWTkjPA9W/1V1sIC+E+U8fa72sHKW/5hnno2U=; b=kCtTmqK+uXRW24YL0oYvKJKDE5H3YvUzwz1tLIwTZh9EpDXfzZ3fpdnuvnyCVHPjIJzL+q RVuLhVPanERiDIdyMe4SNKJVF1oWq/wZVsmod0caKsB+ZnC3o1sSmDFCBPZh3Ne+E26l+f C6QFerOSa+Vu11u4Kv0rPNsorL8C9JzP9dkTD2qNX6g8nsMK1iEIKxhORXmT5fvPiN+pno 2R5wwZAZqz3IQJkM2rlj5p1LSFHDvi17VHwK19x1p9+l57PcQTruICsxm2AxmAKk7WmEEH /SC9+5VauSLJ8o0+IR0Msmn52FIybWL8aNaAtzzTugxcK/M8ojuSRLdr9OFhAw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638811971; a=rsa-sha256; cv=none; b=YPCPT9aM0JCfEe3Egz3vCtzIriuG+xHOFhtfidFiqRvqMRrlK6t/hDMaHiHuI45R+jP4/8 uy+YCR5irlyv80RvI4fBPX4nhEqgJVCgm6cEY8TN74k1CFNrO4XdmSalUy5wuPZR69K7ln mwsWDIUBSrCIjKNoi/zZOmzw6qwabttIpzEkSlt2PmoiXuKS+Lj3RiJM29bYn4LSyA2E6X uXsszvP40sZJvF3DDdl16rB5ugF4c/MdsTF2jeycHge4EuyVFfs/zb2ayrPTJ0uPR998BL 74CvTVvsBtXeSoEzKpKf6Fbt1VDjVzZJFPVVQ9jtU5o5AL3HyniyxFbOvwYumA== 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=7e0bba4d8083b6fac71180681b51aee9ed5fb664 commit 7e0bba4d8083b6fac71180681b51aee9ed5fb664 Author: Gleb Smirnoff AuthorDate: 2021-12-04 17:49:36 +0000 Commit: Gleb Smirnoff CommitDate: 2021-12-06 17:32:31 +0000 ifnet: make V_if_index static to if.c This requires moving net.link.generic sysctl declaration from if_mib.c to if.c. Ideally if_mib.c needs just to be merged to if.c, but they have different license texts. Differential revision: https://reviews.freebsd.org/D33263 --- sys/net/if.c | 17 ++++++++++++----- sys/net/if_mib.c | 10 +--------- sys/net/if_var.h | 2 -- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 87c3e4af4380..6543cee5ef5a 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -84,6 +84,7 @@ #include #include #include +#include #include #include #include @@ -305,19 +306,25 @@ extern void nd6_setmtu(struct ifnet *); VNET_DEFINE(struct hhook_head *, ipsec_hhh_in[HHOOK_IPSEC_COUNT]); VNET_DEFINE(struct hhook_head *, ipsec_hhh_out[HHOOK_IPSEC_COUNT]); -VNET_DEFINE(int, if_index); int ifqmaxlen = IFQ_MAXLEN; VNET_DEFINE(struct ifnethead, ifnet); /* depend on static init XXX */ VNET_DEFINE(struct ifgrouphead, ifg_head); -VNET_DEFINE_STATIC(int, if_indexlim) = 8; - /* Table of ifnet by index. */ -VNET_DEFINE_STATIC(struct ifnet **, ifindex_table); - +VNET_DEFINE_STATIC(int, if_index); +#define V_if_index VNET(if_index) +VNET_DEFINE_STATIC(int, if_indexlim) = 8; #define V_if_indexlim VNET(if_indexlim) +VNET_DEFINE_STATIC(struct ifnet **, ifindex_table); #define V_ifindex_table VNET(ifindex_table) +SYSCTL_NODE(_net_link_generic, IFMIB_SYSTEM, system, + CTLFLAG_RW | CTLFLAG_MPSAFE, 0, + "Variables global to all interfaces"); +SYSCTL_INT(_net_link_generic_system, IFMIB_IFCOUNT, ifcount, + CTLFLAG_VNET | CTLFLAG_RD, &VNET_NAME(if_index), 0, + "Number of configured interfaces"); + /* * The global network interface list (V_ifnet) and related state (such as * if_index, if_indexlim, and ifindex_table) are protected by an sxlock. diff --git a/sys/net/if_mib.c b/sys/net/if_mib.c index 27d7a87bdf84..abf983a02c79 100644 --- a/sys/net/if_mib.c +++ b/sys/net/if_mib.c @@ -64,15 +64,6 @@ * services stuff). */ -SYSCTL_DECL(_net_link_generic); -static SYSCTL_NODE(_net_link_generic, IFMIB_SYSTEM, system, - CTLFLAG_RW | CTLFLAG_MPSAFE, 0, - "Variables global to all interfaces"); - -SYSCTL_INT(_net_link_generic_system, IFMIB_IFCOUNT, ifcount, - CTLFLAG_VNET | CTLFLAG_RD, &VNET_NAME(if_index), 0, - "Number of configured interfaces"); - static int sysctl_ifdata(SYSCTL_HANDLER_ARGS) /* XXX bad syntax! */ { @@ -147,6 +138,7 @@ out: return error; } +SYSCTL_DECL(_net_link_generic); static SYSCTL_NODE(_net_link_generic, IFMIB_IFDATA, ifdata, CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_ifdata, "Interface table"); diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 1647eb351db3..f181780501fe 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -629,12 +629,10 @@ struct ifaddr *ifaddr_byindex(u_short idx); VNET_DECLARE(struct ifnethead, ifnet); VNET_DECLARE(struct ifgrouphead, ifg_head); -VNET_DECLARE(int, if_index); VNET_DECLARE(struct ifnet *, loif); /* first loopback interface */ #define V_ifnet VNET(ifnet) #define V_ifg_head VNET(ifg_head) -#define V_if_index VNET(if_index) #define V_loif VNET(loif) #ifdef MCAST_VERBOSE