From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=66.163.187.33 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796169413; b=o6qWnA2ut01a8hTKPQA424g/fX7Eh6iGYXE5dOK+iBCUG/6YaB0YIaQDF8HK/V4KiJxG ogSHjTr5RyaLyMPJBwBRkH17wvO47PwXdKfa8Ll50aCCTldToY/e4/e48z4O1DzDXVwUC 5Fynk9Aq/TUNVJeuZD9omlYxaRY2yHGiH4tThI1zaFkQ+qs0MAoO0vJ1KwZ2GY9V7X8iB etDBgZllSAd+C3/QyvYhzOKrOpacEozN11mMkh6pDfyFwa6IAERNPZgQz+wxVEIMnWULu uL5dCzUCYlO8T+Ob7lufsS16rXlEzT4uAwM1tOVN0BdgVQy2ZXrWkFAibjFsqQkbUwQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796169413; h=DMARC-Filter:DKIM-Signature:X-SONIC-DKIM-SIGN:X-YMail-OSG:X-Sonic-MF: X-Sonic-ID:Received:Received:Message-ID:Date:MIME-Version:User-Agent: Subject:To:References:Content-Language:In-Reply-To:From:Content-Type: Content-Transfer-Encoding:X-Mailer; bh=yjGuwxcmtVLXNJtFJKqgnPBziBp+47R0lyCVuCFHgrA=; b=gqLN2k6ZZQDEtkrwm0fyrKO0/OLcYWi7ja4j5UJnJK1kSLqp7Xut35azQ6KUBgdpwCyb sybUUz3xR/Oupodxssr+XIU5R0cR5QUAigd+9/DF/zX+Rn3Jv2h7x4eT3cNFHXT9KllxP 8acNujzjMs3Zuc0AGuN7DQS4HK0pC+tcCUvkb4e6RrZK8niWnq1ExFKnVVedmN6Y3gQ9F 0LRmTR3axQRdcXOFqPirAOxANv1Mk6hHbngi+ljI2enws+m21XYt0juKn0/evhWPoP/Y9 8MnFA9TB9aKsWquUYTX5kHYYhmXqLUQjuCM0yxisAJhW2mz6/dPwaslMvMbiKN5xygA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=yahoo.com; spf=pass smtp.mailfrom=yahoo.com; dkim=pass header.d=yahoo.com header.i=@yahoo.com header.a=rsa-sha256 header.s=s2048 header.b=gyIUi7QR; arc=none smtp.remote-ip=66.163.187.33 Received: from sonic308-10.consmr.mail.ne1.yahoo.com (sonic308-10.consmr.mail.ne1.yahoo.com [66.163.187.33]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3C95606A31A for ; Tue, 1 Dec 2026 23:56:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F3C95606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=yahoo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yahoo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.a=rsa-sha256 header.s=s2048 header.b=gyIUi7QR DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1796169412; bh=yjGuwxcmtVLXNJtFJKqgnPBziBp+47R0lyCVuCFHgrA=; h=Date:Subject:To:References:In-Reply-To:From:Content-Type:From:Subject:Reply-To:Content-Type; b=gyIUi7QRDwjbH3EkZ518nOfT2diuJKlkX2Kvf6h1Y44PNjR2Vju3WHr2pKpYDNyHXa3dKVBr27joTipEvkX5qg9iLr99UhQhdthSaBVriYijm6NZK0KWLZDBkrZrGSKAfxcrB0LHDx3bm5tqu2QVcasuvorctDo9eHIARAJziJQ1ORJ1BEnMbeJI7KrFoH6xNXP/Uv6WxnIzcGzYVQOzjMhw1h9X/S7PZG8v6kYxkkIanwrimW4ZvUI/UrNKFWj3AexMazYCh1HoaUucvgLslytVLr73NqONwgY+YsZDEFn92cX7xVAnMw8rgGBHk4N5p90GwtGVTu8iXadZ+2Wu9g== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1796169412; bh=E6MCWegO3iWsPn1rynFdGUD7AVHwQrHFG5FDfbYE6sK=; h=X-Sonic-MF:Date:Subject:To:From:From:Subject; b=MP+/STTio/LnuL7+k9w7XGO3Ty91l94PuTRbU9+01/E9CpGSv4Z3mP01CAkNc6/n1mUs8QEnyTx0ZqOOCIjac9UfYeCHQHZrDLu7ij51AGFNCHgyubObJq5ZM7ujdHxxC3GfVK+/8HiIW5A9MBzecpQvVfG6MjY+Cc+tVNjsGR4I02AvzkE9S3IyA4zcBvNgnXd3AMl0UFkBTBWKQguK3MTvXoiRp8wANXHjza85iIfDkGx6HFthMe8Ala6XWhVDMFgvds3S1XdcmIJ389ejIzlnxK/SJZOHWib3Fjdtz4dK1VhTqnKzmtDc0TmVrojZKyEcoqQC42Ah0dWd7YJQRg== X-YMail-OSG: dkky80MVM1mTBXSEMB3z.9fZsGBOQU_6WW34bmY8A_P6vk3Aa.o1Cnu3RGvVon5 ZB3WosbBerHshyZGPNw3F8qvm4Q806PjRUUpPsELcmgyMBI91Ny_L.E6j3brN2vPkQzKAUJlILN2 g2gWy2oJyMdS0NTpFAeGxuAdYHtmPThhyGG2IjSDs0qODTJIGL2FbnAVvNDWBauhvZd8lylP8pD2 480h9.JJfrzvvXJN8OTryu9uMbbFfmm_PuJFXeOrm7_zSxet2Dgex.8umQfG00L8MjmVTLTZ57zR vzuwVrX3OZG17O2D3EbPxx5Gr1BHGeg9hlLu7C0tE54IazivhcLVgFuXoyT9G9reDIwFKeZZY8ro DYqglBOFBQSe49WHnOdsBQa5VOGyYhjX2o81unApbDK7mHVdUGSqYqnQIt96EzuvN3lXfsG0KwR4 ZFYGvF2XpyHdG60Xu6Ksr1L6Xvp3mZ9uElHtBCJ604UeEsRRIPQQ11153fxVG5d9sYgIXAKRCGrO 4bkO265685r4X23aynE4bO3FsB1U7sdGZJdlA7ZNCekuqVlIuCsYjBbyaHUka3w5Xm24wLLUQ4pW jREGpqPRWglc8uofSlcN9z7kuOJPKacn5SfF9pXF28c4kLQg331EHvHhqo3PzqtX24UiAwsQueEU vvjni2abQlul1tnHnB1WgzUVS5_tg.FMDBh2NeBmY8c4L3olZPNZucYYJtPlm0.t9h_KPbpVfvA1 DMVQMJKpgStXTUy17z3mM7xkPvQ9DxdZdvQkWkn3g1FABpg7ARjSJInS7UdiLmch.3t2GklVdqoK izPend9qDrVtz.1w2ij7GZAkrJkMLSDZbghrSDcLtQa0lGQDRF8wD0B93pEtHsY5OL0DOfF0DoXY 0Ebx38fhAKLEh.eleb7kMCT7HruHuYyp1q88xEICF07jJCblOmriPyaTft4b_1rOGcQiRe3YB_GX Svtn6QUznenfg_U5zCHRCTsvo5gYGDYPeFJxhqr3wM2GHAfCOMiJHXwmB64.qFCh5LXLxC2Llo5R SBdjOowQHXHf_NcC4MGZNFb1kXbl2PIjsCoVK7x1KDF_4MmQIRT57AMFT6dX5c1qyUdyc5jgWpin _JQJ_mowQxKGI5Lvbjj7sfU6bSDxCpmdqLY8ut_cjyQUvrU6eHq8Gta27QECBsjnElmm1A99sxwQ IL.OcPkmaoNSDnenrxvv1aOwCLfoaRCO3EwqFIx8WMTS2nSbKfdHS0PHCaEQe.lLJYiYZ0L.vq9_ P4U5DhVIRZBlbTxif4ML5fMwL8fRRy45TjtMAW16li2UXO8C9CgmVS0GZNGymDb3a_xFOMaFuct4 wBPxe9EZjWLQiOaxbtaI49ErHeJcZu9Ep0.rECsIV6xmxwS6DzGgBrVZHvuy8D1.C2tlK7jQFCbq hfU_.a67FC4y4n0LxR2NF0rMntrKMY5Xqx752KwtYO2s3txh7IBImsV5_kRM5EbM44sGAFV.Fcj0 X0y5sp_Aa8WDeteeNXC9MlLsOZ.weJ51vgq9NHkmUAbEH._g5c0aavjOfqFVDO4ekVgDgFnNYNJa zTST46cDuUGrcViPGVeB0QNXDEh17pSlddPBlNYbsvHnHMVeHedLWwGWhFRbmsMPPlC4EyMTc2oq ALhm9SbhVnrOPYyOEzXHWW.n2HgrJdJ1ssTmE_XHe4QjS.J2suVvn3lqbUwNjU2BCZCLWbhHZovb abBu6.9_XKkaIjmFxKFy_OeGshJTrB4c8b.1cG3ttnjt7NZ3Soa62AKpZpINwy8gPI0pF_D6gu.9 an4JWFm6XJ_vKE.hX0XRcjbTygRrFsLDOB9wPaej0yKaZzId.xuPP1sjrifqMLUyXZ3pawlNVNSE mtJRYdmhlfsZxaLoQpdJDpcsDudL72oljKJVktc4T4q3zCZqynmt4S7DiIU7p9swdZ8L2RITBAkq MeXWxtBkBD93m2v3LegnBW2hIbFIvmq0bblfHZGEj1nwXDw1ImXqckbv_lnJPEFxOB74W84UAC1j Yy6b1MH2u.9Oz9nVGtwjU2oJYy4_QoXps9kJWe2q87I4L7b8UX1xkSOyG5OI8m1BqzZuOsz6MM3T 085FXkqTEtN4PPbqtO2C71QmQwQmDTx_Wzkyx.SJ5TcraI0gcNqreZqLTNKnxACAZX.QRleQbCHW xMoqP.wAPWGXRuFjUwJY3uU6Q.70YcKUI4PndTW7dtCWnNvkHUV0EwTWZrPdEx_LiHtSZXgGFmTn .4v43pS4ONLoEHW5gtVs4fEoouCGgDt9BNDofzI.6kgyazAWnwfWZJSGSoJ553OUYCvXV2tchdkf FLmeeNbqH5dl8O5AMmETxdl7_7MkEkgdwqzPwPRnlOXRyCQGxXfW5 X-Sonic-MF: X-Sonic-ID: 586d2a45-4cbd-4dc5-bd4f-3929bf98b75a Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.ne1.yahoo.com with HTTP; Tue, 1 Dec 2026 23:56:52 +0000 Received: by hermes--production-ir2-7c4859dc89-4wlgf (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 8d951569cac3e11b1472f6967ced9755; Tue, 01 Dec 2026 23:56:49 +0000 (UTC) Message-ID: Date: Wed, 2 Dec 2026 00:56:46 +0100 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH net-next v18 14/15] net: dsa: realtek: rtl8365mb: use PCP numbering on family D To: linusw@kernel.org, andrew@lunn.ch, olteanv@gmail.com, kuba@kernel.org, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, linux@armlinux.org.uk, luizluca@gmail.com, maxime.chevallier@bootlin.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, alvin.sipraga@analog.com, gusfmora@gmail.com, kuncy7@gmail.com, fabianotassotti@gmail.com, gabonpivovich@gmail.com, contact@c127.dev, o.rempel@pengutronix.de References: <1383a67b-15e4-4c76-8bbf-65d3cbfa1fc1@yahoo.com> Content-Language: pl In-Reply-To: <1383a67b-15e4-4c76-8bbf-65d3cbfa1fc1@yahoo.com> From: Mieczyslaw Nalewaj Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Mailer: WebService/1.1.27100 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Family C has separate per-port registers for the 802.1p PCP given to untagged frames (0x0851-0x0852) and for the port's default internal priority (0x0877-0x0878). The shared QoS layer hands the backend internal priorities that are 802.1Q traffic types (Best Effort is 1, Background is 0) and writes the untagged PCP separately. Family D has no 0x0851-0x0852 registers: its per-port PVID register at 0x0700 + port holds only the 12-bit VID, and dal_rtl8367d_vlan_portPvid_set() rejects any priority != 0. On an RTL8367S-VB the PCP of a newly inserted 802.1Q tag follows the frame's internal priority, so writing the traffic type as is made untagged frames leave an egress-tagged port with PCP 1 (Background) instead of PCP 0 (Best Effort). The vendor API numbers family D internal priorities like PCP values: dal_rtl8367d_qos_init() maps each PCP to the same internal priority, sets the port priority to 0 and leaves 1p remarking disabled at reset. Do the same for the PCP mapping and port priority, relying on the hardware default for remarking. On family D, convert between traffic types and the chip's numbering at the register boundary: for the port priority, the PCP-to-priority and DSCP-to-priority tables, and the priority-to-queue table. The PCP of a newly inserted tag then matches the traffic type whichever source classified the frame, and each traffic type still lands in the same queue as before. Add the family D implementations of the qos_iprio_to_hw and qos_hw_to_iprio hooks introduced by the previous patch. Make the qos_set_untag_pcp hook optional and leave it unset on family D, which cannot assign a configurable PCP to untagged ingress frames. Use the absence of that capability to reject PCP trust, while keeping port-based default priority and DSCP trust supported. The family D hooks are wired up by the patch that adds the first family D chip, so this patch changes no behaviour yet. Also reword the apptrust error message in rtl83xx-qos.c to "unsupported apptrust selector or order; dscp must precede pcp": the error is also returned for a selector other than dscp or pcp and for a repeated one, not only for a wrong order. This changes only the message text. Gustavo Foletto Mora, who reported the issue, confirmed on a TP-Link EX511 v2 with the baseline QoS configuration (no CONFIG_DCB) that untagged frames leave tagged with PCP 0, tagged frames keep their PCP, and the QoS registers read back in PCP numbering. Neither the rejection of PCP trust nor DSCP trust was exercised on hardware, as both need CONFIG_DCB. Reported-by: Gustavo Foletto Mora Closes: https://github.com/openwrt/openwrt/pull/19644#issuecomment-7067296792 Signed-off-by: Mieczyslaw Nalewaj Reviewed-by: Linus Walleij --- drivers/net/dsa/realtek/realtek.h | 7 ++-- drivers/net/dsa/realtek/rtl8365mb.h | 3 ++ drivers/net/dsa/realtek/rtl8365mb_qos.c | 56 +++++++++++++++++++------ drivers/net/dsa/realtek/rtl8365mb_qos.h | 2 + drivers/net/dsa/realtek/rtl83xx-qos.c | 2 +- 5 files changed, 53 insertions(+), 17 deletions(-) diff --git a/drivers/net/dsa/realtek/realtek.h b/drivers/net/dsa/realtek/realtek.h index cee8e65..3dadc47 100644 --- a/drivers/net/dsa/realtek/realtek.h +++ b/drivers/net/dsa/realtek/realtek.h @@ -185,9 +185,10 @@ struct realtek_ops { * priority. A *_prio getter returns an iprio or a negative errno. */ int (*qos_get_port_prio)(struct realtek_priv *priv, int port); - /* Set the priority of @port to @iprio, and make @untag_pcp the PCP - * given to untagged frames on @port. @untag_pcp is an 802.1p - * priority, not an iprio. + /* Set the priority of @port to @iprio. Where supported, also make + * @untag_pcp the PCP given to untagged frames on @port. Hardware without + * a separately configurable untagged PCP must reject PCP trust. + * @untag_pcp is an 802.1p priority, not an iprio. */ int (*qos_set_port_prio)(struct realtek_priv *priv, int port, u8 iprio, u8 untag_pcp); diff --git a/drivers/net/dsa/realtek/rtl8365mb.h b/drivers/net/dsa/realtek/rtl8365mb.h index 7fb1a46..4ebc46d 100644 --- a/drivers/net/dsa/realtek/rtl8365mb.h +++ b/drivers/net/dsa/realtek/rtl8365mb.h @@ -61,6 +61,9 @@ struct rtl8365mb_family_info { void (*l2_mc_to_data)(const struct rtl8365mb_l2_mc *mc, u16 *data); int (*qos_iprio_to_hw)(u8 iprio); int (*qos_hw_to_iprio)(u8 hw); + /* Optional. A NULL callback means that the family cannot assign a + * configurable PCP to untagged ingress frames. + */ int (*qos_set_untag_pcp)(struct realtek_priv *priv, int port, u8 untag_pcp); }; diff --git a/drivers/net/dsa/realtek/rtl8365mb_qos.c b/drivers/net/dsa/realtek/rtl8365mb_qos.c index d422955..a525fab 100644 --- a/drivers/net/dsa/realtek/rtl8365mb_qos.c +++ b/drivers/net/dsa/realtek/rtl8365mb_qos.c @@ -22,8 +22,11 @@ #include "rtl8365mb_qos.h" /* The shared rtl83xx-qos.c layer hands this backend internal priorities - * that are 802.1Q traffic types. The chip's own priority is derived from - * them through the qos_* hooks of struct rtl8365mb_family_info. + * that are 802.1Q traffic types, one per traffic type. Family C stores them + * as they are. Family D numbers its internal priorities like PCP values, as + * its vendor API does, and takes the PCP of a newly inserted 802.1Q tag from + * the internal priority, so it converts them at the register boundary + * through the qos_* hooks of struct rtl8365mb_family_info. */ static_assert(RTL8365MB_NUM_INTERNAL_PRIOS == IEEE8021Q_TT_MAX); @@ -63,11 +66,11 @@ static_assert(RTL8365MB_QOS_PORT_QMAP_SEL_REG(RTL8365MB_QOS_MAX_PORTS - 1) <= static_assert(RTL8365MB_QOS_QMAP_DEFAULT < RTL8365MB_QOS_NUM_QMAPS); -/* 802.1p (PCP) -> internal priority remap */ +/* 802.1p (PCP) -> hardware priority remap */ #define RTL8365MB_QOS_1Q_REMAP_REG(_pcp) \ (0x0865 + (_pcp) / RTL8365MB_QOS_SELS_PER_REG) -/* PCP given to untagged frames, one 3-bit field per port */ +/* PCP given to untagged frames, one 3-bit field per port (family C only) */ #define RTL8365MB_QOS_PORT_UNTAG_PCP_REG(_p) \ (0x0851 + (_p) / RTL8365MB_QOS_SELS_PER_REG) @@ -83,7 +86,7 @@ static_assert(RTL8365MB_QOS_PORT_UNTAG_PCP_REG(RTL8365MB_QOS_MAX_PORTS - 1) <= static_assert(RTL8365MB_QOS_PORT_PRI_REG(RTL8365MB_QOS_MAX_PORTS - 1) <= 0x0878); -/* DSCP -> internal priority, one table for the whole chip */ +/* DSCP -> hardware priority, one table for the whole chip */ #define RTL8365MB_QOS_DSCP_PRI_REG(_d) \ (0x0867 + (_d) / RTL8365MB_QOS_SELS_PER_REG) @@ -152,8 +155,9 @@ static const u8 rtl8365mb_qos_apptrust_src[] = { [RTL83XX_APPTRUST_PCP] = RTL8365MB_QOS_PRIDEC_1Q, }; -/* The 1Q source also classifies untagged frames, by the PCP given to untagged - * frames. Ranked above DSCP, it would hide DSCP from untagged IP frames. +/* On family C the 1Q source also classifies untagged frames by their configured + * PCP. Ranked above DSCP, it would hide DSCP from untagged IP frames. Family D + * has no configurable untagged PCP and rejects PCP trust. */ static_assert(RTL83XX_APPTRUST_DSCP < RTL83XX_APPTRUST_PCP); @@ -240,6 +244,17 @@ int rtl8365mb_c_qos_set_untag_pcp(struct realtek_priv *priv, int port, untag_pcp); } +/* Family D numbers its internal priorities like PCP values */ +int rtl8365mb_d_qos_iprio_to_hw(u8 iprio) +{ + return ieee8021q_tt_to_pcp(iprio); +} + +int rtl8365mb_d_qos_hw_to_iprio(u8 hw) +{ + return ieee8021q_pcp_to_tt(hw); +} + /* Convert an internal priority (an 802.1Q traffic type) to the value the * chip uses. Return the value or a negative errno. */ @@ -270,10 +285,13 @@ int rtl8365mb_qos_get_port_prio(struct realtek_priv *priv, int port) int rtl8365mb_qos_set_port_prio(struct realtek_priv *priv, int port, u8 iprio, u8 untag_pcp) { + const struct rtl8365mb_family_info *fi; u32 reg = RTL8365MB_QOS_PORT_PRI_REG(port); u32 mask = rtl8365mb_qos_sel_mask(port); int hw, ret; + fi = rtl8365mb_get_family_info(priv); + ret = rtl8365mb_qos_check_port(priv, port); if (ret) return ret; @@ -282,10 +300,11 @@ int rtl8365mb_qos_set_port_prio(struct realtek_priv *priv, int port, u8 iprio, if (hw < 0) return hw; - ret = rtl8365mb_get_family_info(priv)->qos_set_untag_pcp(priv, port, - untag_pcp); - if (ret) - return ret; + if (fi->qos_set_untag_pcp) { + ret = fi->qos_set_untag_pcp(priv, port, untag_pcp); + if (ret) + return ret; + } return rtl8365mb_qos_regmap_update_field(priv, reg, mask, hw); } @@ -369,8 +388,8 @@ int rtl8365mb_qos_qmap_init(struct realtek_priv *priv) struct dsa_port *dp; int hw_prio, ret; - /* The table is indexed by the chip's priority, not by the traffic - * type. + /* The table is indexed by the chip's priority, which is the traffic + * type on family C and the PCP on family D. */ for (hw_prio = 0; hw_prio < RTL8365MB_NUM_INTERNAL_PRIOS; hw_prio++) { int tt = rtl8365mb_qos_hw_to_iprio(priv, hw_prio); @@ -523,6 +542,7 @@ static int rtl8365mb_qos_apptrust_check_shared(struct realtek_priv *priv, int rtl8365mb_qos_set_apptrust(struct realtek_priv *priv, int port, const bool *trust, unsigned int n) { + const struct rtl8365mb_family_info *fi; u32 reg = RTL8365MB_QOS_APPTRUST_REG(rtl8365mb_qos_apptrust_src[0]); u32 mask = 0, val = 0; bool any = false; @@ -531,10 +551,20 @@ int rtl8365mb_qos_set_apptrust(struct realtek_priv *priv, int port, if (n != ARRAY_SIZE(rtl8365mb_qos_apptrust_src)) return -EINVAL; + fi = rtl8365mb_get_family_info(priv); + ret = rtl8365mb_qos_check_port(priv, port); if (ret) return ret; + /* Without a configurable PCP for untagged frames, the switch cannot + * assign the requested PCP before 802.1Q priority classification. + */ + if (!fi->qos_set_untag_pcp && trust[RTL83XX_APPTRUST_PCP]) { + dev_err(priv->dev, "PCP apptrust is not supported on this chip\n"); + return -EOPNOTSUPP; + } + for (i = 0; i < n; i++) any |= trust[i]; diff --git a/drivers/net/dsa/realtek/rtl8365mb_qos.h b/drivers/net/dsa/realtek/rtl8365mb_qos.h index 70c50ab..70608fa 100644 --- a/drivers/net/dsa/realtek/rtl8365mb_qos.h +++ b/drivers/net/dsa/realtek/rtl8365mb_qos.h @@ -35,5 +35,7 @@ int rtl8365mb_c_qos_iprio_to_hw(u8 iprio); int rtl8365mb_c_qos_hw_to_iprio(u8 hw); int rtl8365mb_c_qos_set_untag_pcp(struct realtek_priv *priv, int port, u8 untag_pcp); +int rtl8365mb_d_qos_iprio_to_hw(u8 iprio); +int rtl8365mb_d_qos_hw_to_iprio(u8 hw); #endif /* _REALTEK_RTL8365MB_QOS_H */ diff --git a/drivers/net/dsa/realtek/rtl83xx-qos.c b/drivers/net/dsa/realtek/rtl83xx-qos.c index f294222..37b8450 100644 --- a/drivers/net/dsa/realtek/rtl83xx-qos.c +++ b/drivers/net/dsa/realtek/rtl83xx-qos.c @@ -196,7 +196,7 @@ int rtl83xx_port_set_apptrust(struct dsa_switch *ds, int port, const u8 *sel, if (slot < 0 || slot <= prev) { dev_err(priv->dev, - "unsupported apptrust order; supported: dscp, pcp, dscp pcp\n"); + "unsupported apptrust selector or order; dscp must precede pcp\n"); return -EOPNOTSUPP; } -- 2.53.0