From nobody Wed Sep 06 04:09:29 2023 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 4RgTQy1wqKz4rxWt; Wed, 6 Sep 2023 04:09: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 4RgTQx735qz3HlR; Wed, 6 Sep 2023 04:09:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693973370; 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=NXzrFAPIhNxCGPXH8Gm/VWLSuO1nD4iJquascAdrY0w=; b=dyTf6abNbezsP5y5n1egGIQCPakyarymZ9pim+KBBU+aTpcyvgoFuuGDz2ER4tK17+H78G 2vKgiTxEK4QCCTbP1olSWHQGbO0Hte82s5KouXflyZ6TbqOmSVh6fnkiozjSXsJT7unXY2 9j2t3mOdg+1+wgLeBUhBYCVGK/9frjFoxIXk0Y4HWq8Gn59Wu/Ngxy7yLV3u7f+ZMyJrJr Xh/cPW5B1S3XH9JJpWefCZOebCcwyNZO/0YwUVl+USVFEJF+D+LK8DvtIgC8Np5/2K5BZF w6i9aXVkfCzZ5MpkkcZfCFxaYjqd3pLlnOXYr7X92A4z1+gLAFx2LcAzOSadvg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1693973370; a=rsa-sha256; cv=none; b=jUT3RcSTocFMWGOUxnX+O9TfR/OFAh5hwcHbm9uAlffPphWS7cqfl37Sw2s5UTwI4w+K6F dWMH4JreUAc8jqEehSELy7AFL4/75uEDjR4Qpi3Zg6kvm1bik0pihcK4xFG2y0GnrHFAGq j9tTfNnHRmoPQSd9XHn0VViWkQqTmJvl24dh6c6JIk7JOzCfWX94457GyoaNc/ZXN9gG2Z rZpLlvDRJKtJZ37x55Zchcw1hNHWizj6Go0rwXCAZrxd2agOkwyDbUwbfaumdwAKtr85fs oe0ceNRzHLT8c4H3Y5+/b+GRhAe54VLb6FfJa1s48p3jeXp1+T5EPJHg08Gbdw== 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=1693973370; 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=NXzrFAPIhNxCGPXH8Gm/VWLSuO1nD4iJquascAdrY0w=; b=VlQroZcPRDgeh4z7hTE53aEUrji3H7GF7QP53GsbKGyHezoOVHlm+MSiE/3GvY2UbA387B v9EpR5RKPaOOrWS22b2Cy9mxkjzgAFtGI9vRAPK6sVPcjSZvG1hunSE7WGGYUTo7a9wY1D 0M/eOt6Mqct+50LWefEbTWkeSg/EGpde7RURX9vpty77WRg4aHq/AT0stJQXZzhCkZhbIP Z+6WGOh//KWd42OnPHCXvDZnybTR1TJDvUZbvrn897J7lassgYPNh5V8AXyZnMmc8s9LuY ASvd0Iix4geaMvGMCYBQQnoLthienih4HUgh+5f4PPaMGoNXYr/Uj876PWCk+w== 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 4RgTQx63f7z11Sv; Wed, 6 Sep 2023 04:09:29 +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 38649TZB040378; Wed, 6 Sep 2023 04:09:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38649TQu040375; Wed, 6 Sep 2023 04:09:29 GMT (envelope-from git) Date: Wed, 6 Sep 2023 04:09:29 GMT Message-Id: <202309060409.38649TQu040375@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: 494de30b63de - stable/14 - net: Remove vlan metadata on pcp / vlan encapsulation 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 494de30b63de9ef31587dcc3fb8e7249535e840a Auto-Submitted: auto-generated The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=494de30b63de9ef31587dcc3fb8e7249535e840a commit 494de30b63de9ef31587dcc3fb8e7249535e840a Author: Zhenlei Huang AuthorDate: 2023-08-30 09:36:38 +0000 Commit: Zhenlei Huang CommitDate: 2023-09-06 04:07:21 +0000 net: Remove vlan metadata on pcp / vlan encapsulation For oubound traffic, the flag M_VLANTAG is set in mbuf packet header to indicate the underlaying interface do hardware VLAN tag insertion if capable, otherwise the net stack will do 802.1Q encapsulation instead. Commit 868aabb4708d introduced per-flow priority which set the priority ID in the mbuf packet header. There's a corner case that when the driver is disabled to do hardware VLAN tag insertion, and the net stack do 802.1Q encapsulation, then it will result double tagged packets if the driver do not check the enabled capability (hardware VLAN tag insertion). Unfortunately some drivers, currently known cxgbe(4) re(4) ure(4) igc(4) and vmx(4), have this issue. From a quick review for other interface drivers I believe a lot more drivers have the same issue. It makes more sense to fix in net stack than to try to change every single driver. PR: 270736 Reviewed by: kp Approved by: re (gjb) Fixes: 868aabb4708d Add IP(V6)_VLAN_PCP to set 802.1 priority per-flow MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D39499 (cherry picked from commit b22aae410bc7e4e9a6b43e556dc34be72deadb65) --- sys/net/if_ethersubr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 63ea5e7591c2..ab274eeb88bf 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -446,9 +446,11 @@ ether_set_pcp(struct mbuf **mp, struct ifnet *ifp, uint8_t pcp) struct ether_header *eh; eh = mtod(*mp, struct ether_header *); - if (ntohs(eh->ether_type) == ETHERTYPE_VLAN || - ntohs(eh->ether_type) == ETHERTYPE_QINQ) + if (eh->ether_type == htons(ETHERTYPE_VLAN) || + eh->ether_type == htons(ETHERTYPE_QINQ)) { + (*mp)->m_flags &= ~M_VLANTAG; return (true); + } qtag.vid = 0; qtag.pcp = pcp; @@ -1463,6 +1465,7 @@ ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, struct ifnet *p, if_printf(ife, "unable to prepend 802.1Q header"); return (false); } + (*mp)->m_flags &= ~M_VLANTAG; } return (true); }