From nobody Wed Aug 30 09:38:51 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 4RbK4C3Gmfz4rwdW; Wed, 30 Aug 2023 09:38:51 +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 4RbK4C2pR7z3Tb0; Wed, 30 Aug 2023 09:38:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1693388331; 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=uUIs/m5eyqs8dQy/QyASyF+4f/yfYPayvYXqtDSXqlo=; b=VJuC+7je56nhaw8+OBk7k74GkU1vQZnFQAVwgjM5Xe2QOUOphQ2e6SLt8xVdktWZqPhqME 1r1NERe9cVyVqclQ3WnR2NNY561QToeaugzs5AsfmGl+wi+SNI5rD48cZsPbcriKqEeVwR mXzyNbSb6R+NHebRl2Il6Vm6TYHIV5nLtL3QyhDo7+ef8HAqwuVTHdbf2g6i5qpvkFsfAf oB0VDCLX9xtxzKxG3Lyl+JJebuJnM/T3JbX6Tj8Hzsi7P3UUf+Ra0o2gR5Wj2K+si+0S4b qSOiKAD8xXPR55H7n6BihOsX7q+AcWrQpq3MglMf1SvHIV+lxJ9Gd7pF214ung== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1693388331; a=rsa-sha256; cv=none; b=V9Om5h+/ik6psI6LdZa3JqFuYZiZzROy9WAeL4j70bW5z8XYvcfANK/3ZtZ0PYMk1g7ANh oG8n/1YIn6pu1AOZQo0cEimqWpuKjYIAgrNXAUX1B6UNvkP2Q045aNz4aa8kqEzaDmUZ3L PhPJcE48lfBOW8Pb9cZvu1ud+SKZP/10EmF5eeTOZWErfLjcPnEV6ckoSCI3hj81pTo3be /FdKpfpCMMQZtFUctaJ3GqcRZOhIUgtWXsuZSvi89rYBMzkXrVgx5YN64i0m7iKWV3krpW iqX5q7pOZzcudD7YJ1cMRrpYQK9BWoEsJbOtwqKfJVZ/kq1Sm9xtI+NpKm+ihg== 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=1693388331; 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=uUIs/m5eyqs8dQy/QyASyF+4f/yfYPayvYXqtDSXqlo=; b=K0sHUI3HYlwE0hqODI8oKaLdXBbzpoePdqaYpxC2HEqpyavfoRUJ7rwiNehD2t39cN903W YiYxJAlc6xaxDe/iwAWRRqG6jYNxdvxV8+Br1ovhY+C/yUKy9/edk9SIFAFz0l7sG2VWoa mrYR8DFjGMUiMBWYlxJioaQ1XHjqSbjnTIc0l+pFSkYrgrTcT2V7XR6ftSYejtEQfUx0Ja JkCSabHl6H7r9P9y6G92nwPhlN1N7QYpbQn3sSY63Krno9Tx54k2EzsJiLTE823QhmruiT UdKR1lAQnbJb+uX+KY8IlKHojfliDjftB75oUzA05gd1rQYQTyiiMTm4EcDxJw== 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 4RbK4C1vXmzTVd; Wed, 30 Aug 2023 09:38:51 +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 37U9cpQ4065422; Wed, 30 Aug 2023 09:38:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37U9cpuv065419; Wed, 30 Aug 2023 09:38:51 GMT (envelope-from git) Date: Wed, 30 Aug 2023 09:38:51 GMT Message-Id: <202308300938.37U9cpuv065419@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: b22aae410bc7 - main - net: Remove vlan metadata on pcp / vlan encapsulation 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: b22aae410bc7e4e9a6b43e556dc34be72deadb65 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=b22aae410bc7e4e9a6b43e556dc34be72deadb65 commit b22aae410bc7e4e9a6b43e556dc34be72deadb65 Author: Zhenlei Huang AuthorDate: 2023-08-30 09:36:38 +0000 Commit: Zhenlei Huang CommitDate: 2023-08-30 09:36:38 +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 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 --- 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); }