From nobody Mon Feb 14 23:04:21 2022 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 DBF1219C90B3; Mon, 14 Feb 2022 23:04:21 +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 4JyKY14wZLz3HFm; Mon, 14 Feb 2022 23:04:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644879861; 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=viHNVB4o2PTnhzIMainKTompS9LlDO9ceinG9Vw2Au4=; b=hYUIRi00NHga+DvgdGvqe+hNr8jlJtRnSc0WN7Tt4Kxg7hHrMuChLP29RmRM26xLqPGhmv Mj3iwZGP/ceGMyWYjJPT+30h041sh8aNEWj9NweBA6aSpq7MIbvPjgkwSHKS8cxwRm9Nzr O41YkQmHx+/ywC7OWtzaxRwQMxKVbnNagJ4FP7okjhrD5kn26oKqwROxvgp1YLBuLc+ZUV KEGqPGbqxQ8ImBUpxC80hjpiB42aIdhRFe1IvUxlATMd7VVzcX6QI/rrxPsmoYaL2fvnbE xfEKJygovzD/eEP1UTCWW9C9gbqAUGJu1EtnJhsZaoSpmmaTtdzjIqEV9Hxt+Q== 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 86F32178D3; Mon, 14 Feb 2022 23:04:21 +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 21EN4LIn005673; Mon, 14 Feb 2022 23:04:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21EN4LU8005672; Mon, 14 Feb 2022 23:04:21 GMT (envelope-from git) Date: Mon, 14 Feb 2022 23:04:21 GMT Message-Id: <202202142304.21EN4LU8005672@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 78bc3d5e1712 - main - vlan: allow net.link.vlan.mtag_pcp to be set per vnet 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 78bc3d5e1712bc1649aa5574d2b8d153f9665113 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644879861; 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=viHNVB4o2PTnhzIMainKTompS9LlDO9ceinG9Vw2Au4=; b=UGxqDaJMvKjqTiZmT0V8et1qbvGKtDYXFV0C086hToyd0WSdXW/i4xQh54Zz5zC3A36hNF osPSwhpk0qZdXvaNWYF5yV2xRHgiE/9Z37TPs18xwFdV5i+gFCN9F9/7DBLSLJ8EsDJ/D/ PJJ2hgx4YIOrP2SNF1sLpRbdXS1f5sCg6VScwVooWu0tqtefJ9KUYnPztdKr3jW9vo8uFd ZnUtTVmRZRmEk8gjXsy9kqTJVz3y8jecYndYzPD5YsCIohbNLjYP2/0XcPxFPqaMrJyZtO 3ME1yWRgqJuE2YqSvqQlRD/36dr86ng6ECWk4loBW6Wzzb1HAeB6Nu4/4ynznw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644879861; a=rsa-sha256; cv=none; b=QtpZCcv2jymB2+7EP/p5zXOV9ahl7jReXb0WqeH+b3vOGVJGt1nPoupPfRZTNjIj/hBjxa 7DM1zDEDajjDwYCc4gUA09WZ/aIt6YDc67it2dfI1TxJtC7g0+hB+zIqIwIgf2eY5bvHCk Kz+uuVAlbpbslGUphxOpuF+i8cMhVlw33f3ri1YDAkTizXOeG9GWp38hzYfGi+Q7WyXzAl 2ed23b7dASMk50kojI5GJ7jn/TnrQKObiAau+ahWjNo/2VbbQCqe1mXK1HhlCCup9fcfzs 0HwmwHz9SwD+D8kvL/I9ToDPAF5XRfaylRGlHg9/I1uq6sZisRgv9Fx1/muQcg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=78bc3d5e1712bc1649aa5574d2b8d153f9665113 commit 78bc3d5e1712bc1649aa5574d2b8d153f9665113 Author: Kristof Provost AuthorDate: 2022-02-14 19:09:54 +0000 Commit: Kristof Provost CommitDate: 2022-02-14 21:51:10 +0000 vlan: allow net.link.vlan.mtag_pcp to be set per vnet The primary reason for this change is to facilitate testing. MFC after: 1 week --- sys/net/if_ethersubr.c | 9 +++++---- sys/net/if_vlan.c | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 3209e8a82978..0427e1352ab1 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1357,9 +1357,10 @@ SYSCTL_INT(_net_link_vlan, OID_AUTO, soft_pad, CTLFLAG_RW | CTLFLAG_VNET, * per-packet memory allocations and frees. In the future, it would be * preferable to reuse ether_vtag for this, or similar. */ -int vlan_mtag_pcp = 0; -SYSCTL_INT(_net_link_vlan, OID_AUTO, mtag_pcp, CTLFLAG_RW, - &vlan_mtag_pcp, 0, +VNET_DEFINE(int, vlan_mtag_pcp) = 0; +#define V_vlan_mtag_pcp VNET(vlan_mtag_pcp) +SYSCTL_INT(_net_link_vlan, OID_AUTO, mtag_pcp, CTLFLAG_RW | CTLFLAG_VNET, + &VNET_NAME(vlan_mtag_pcp), 0, "Retain VLAN PCP information as packets are passed up the stack"); bool @@ -1411,7 +1412,7 @@ ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, struct ifnet *p, * knows how to find the VLAN tag to use, so we attach a * packet tag that holds it. */ - if (vlan_mtag_pcp && (mtag = m_tag_locate(*mp, MTAG_8021Q, + if (V_vlan_mtag_pcp && (mtag = m_tag_locate(*mp, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL)) != NULL) tag = EVL_MAKETAG(qtag->vid, *(uint8_t *)(mtag + 1), 0); else diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 07c325d0cb12..c8256dc087a5 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -213,7 +213,8 @@ static struct { {0, NULL} }; -extern int vlan_mtag_pcp; +VNET_DECLARE(int, vlan_mtag_pcp); +#define V_vlan_mtag_pcp VNET(vlan_mtag_pcp) static const char vlanname[] = "vlan"; static MALLOC_DEFINE(M_VLAN, vlanname, "802.1Q Virtual LAN Interface"); @@ -1430,7 +1431,7 @@ vlan_input(struct ifnet *ifp, struct mbuf *m) return; } - if (vlan_mtag_pcp) { + if (V_vlan_mtag_pcp) { /* * While uncommon, it is possible that we will find a 802.1q * packet encapsulated inside another packet that also had an