From nobody Thu Sep 21 04:54:35 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 4Rrjk34dJFz4tVdj; Thu, 21 Sep 2023 04:54:35 +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 4Rrjk346hpz3S4H; Thu, 21 Sep 2023 04:54:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695272075; 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=HJMDKsp+kLtD0/9qNxCVJ/WvBKNnkHX94EG7V7HfN4I=; b=HazA4TH/bX04e4sWU6oG5qRggGltLej06ENVNAETAQAERhr5s+VZBzEfHyVQdPWNO0vPPW TJaPHDs+1ULbjVy/9+5TzwHdBCZoHDedpxuV6CNxAUZJhqDPKI4eG8QWqwIdDAlhy4MT4H 3OfognPBSh2dOF3imKpmcP2OmG5SYZWqWqExhuAr6Nmrb2Wmf56ta8g6LE0ygdMvAw4KTd gDJ+XTH+dMboh2VLQVVie6MZLECVpDK5oM4uH5j2U7iFc4kmyeduYzda69o1zYDmMAbUOB 7aMM9sPm+LKrDW4vNkydtn/Rwd4XNYG3NJZTZBUwZyl4/UFMfQSBO55Lnw08og== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695272075; a=rsa-sha256; cv=none; b=py66a8aYePFvcXPHcY/KXFNLNEAlQsd/eIJhsp1uu2xKZCL1FKL1v2k5GvaBfU0T0rPt62 WDoaE43sYhkP1z6JB/Hq4MaBXAPIMD9pRFaldfign4y8mKPLskV0D8J7Gnk9AnqULqsDnW m9baetZQHsZbez2s3f8D623O/aofPKuiiFVnFbkfOBc3FJmenJkndtPjkXjLx/xUJZKaYq fCUn7Bl120TqPZ4EWAhCwmUoIvsKZGIFJOU1Vx/sGiQRHP8kFUXOXfIzdSAIcUi+0piDqJ ErM41nk4un20KsJGspkdykEjWZgUQVECZxzFLCqEtEU4lQ3YI2ZmTjezLaRUzQ== 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=1695272075; 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=HJMDKsp+kLtD0/9qNxCVJ/WvBKNnkHX94EG7V7HfN4I=; b=jwpc5C4uYcNBNVaK7D28aC44INVSVxlHph8tG4pK26IDPWFey9Iivejks5RE4AuA4WWhCN 3uEe1lAR7tf7ZMRLJxEtU5PwLN7Tz1/HwrSdAyegoa3QFamVoIgO0TQseyMv6mZebI05LG 2SX9j2ICgvYlcRyqJZqstKkI7AP75N9ax2RCIyVaGvNI+SqOg5GooJiSeuA1oo2g/pVV6x yEjowip6/mJ/9ddpse6gCI/9SFIuVnwdcNGIbeSpgikdYYJLoAMQr+5NQSC1l21FOHCjuR mQO4fir+ejQ0jZYovNXFxAQ3tUszc4xiUntyz2AV4FAYJ9TGMK+oaoAT8T7dOQ== 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 4Rrjk339TFz9bF; Thu, 21 Sep 2023 04:54:35 +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 38L4sZTc042163; Thu, 21 Sep 2023 04:54:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38L4sZJ9042160; Thu, 21 Sep 2023 04:54:35 GMT (envelope-from git) Date: Thu, 21 Sep 2023 04:54:35 GMT Message-Id: <202309210454.38L4sZJ9042160@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: 0d648a59fced - releng/14.0 - net: Check per-flow priority code point for untagged traffic 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/releng/14.0 X-Git-Reftype: branch X-Git-Commit: 0d648a59fceda79106fe66347b1df5cc11a7fa00 Auto-Submitted: auto-generated The branch releng/14.0 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=0d648a59fceda79106fe66347b1df5cc11a7fa00 commit 0d648a59fceda79106fe66347b1df5cc11a7fa00 Author: Zhenlei Huang AuthorDate: 2023-09-06 10:15:14 +0000 Commit: Zhenlei Huang CommitDate: 2023-09-21 04:49:53 +0000 net: Check per-flow priority code point for untagged traffic Commit 868aabb4708d introduced per-flow priority. There's a defect in the logic for untagged traffic, it does not check M_VLANTAG set in the mbuf packet header or MTAG_8021Q/MTAG_8021Q_PCP_OUT tag set by firewall, then can result missing desired priority in the outbound packets. For mbuf packet with M_VLANTAG in header, some interfaces happen to work due to bug in the drivers mentioned in D39499. As modern interfaces have VLAN hardware offloading, the defect is barely noticeable unless the feature per-flow priority is widely tested. As a side effect of this defect, the soft padding to work around buggy bridges is bypassed. That may result in regression if soft padding is requested. PR: 273431 Approved by: re (cperciva) Discussed with: kib Fixes: 868aabb4708d Add IP(V6)_VLAN_PCP to set 802.1 priority per-flow MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D39536 (cherry picked from commit 49d6743da15fe378782e43776df8b4fd4f84c8d0) (cherry picked from commit c750055382f73db964c20f8eba855a9ac9e19591) --- sys/net/if_ethersubr.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index ab274eeb88bf..2cbe0ea98f27 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -123,6 +123,8 @@ static int ether_resolvemulti(struct ifnet *, struct sockaddr **, struct sockaddr *); static int ether_requestencap(struct ifnet *, struct if_encap_req *); +static inline bool ether_do_pcp(struct ifnet *, struct mbuf *); + #define senderr(e) do { error = (e); goto bad;} while (0) static void @@ -470,11 +472,7 @@ ether_set_pcp(struct mbuf **mp, struct ifnet *ifp, uint8_t pcp) int ether_output_frame(struct ifnet *ifp, struct mbuf *m) { - uint8_t pcp; - - pcp = ifp->if_pcp; - if (pcp != IFNET_PCP_NONE && ifp->if_type != IFT_L2VLAN && - !ether_set_pcp(&m, ifp, pcp)) + if (ether_do_pcp(ifp, m) && !ether_set_pcp(&m, ifp, ifp->if_pcp)) return (0); if (PFIL_HOOKED_OUT(V_link_pfil_head)) @@ -1400,6 +1398,19 @@ 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"); +static inline bool +ether_do_pcp(struct ifnet *ifp, struct mbuf *m) +{ + if (ifp->if_type == IFT_L2VLAN) + return (false); + if (ifp->if_pcp != IFNET_PCP_NONE || (m->m_flags & M_VLANTAG) != 0) + return (true); + if (V_vlan_mtag_pcp && + m_tag_locate(m, MTAG_8021Q, MTAG_8021Q_PCP_OUT, NULL) != NULL) + return (true); + return (false); +} + bool ether_8021q_frame(struct mbuf **mp, struct ifnet *ife, struct ifnet *p, const struct ether_8021q_tag *qtag)