From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=66.163.188.146 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796264310; b=sJXnAaMVITKg4l5Dwo/nOz0MrvK4PWEpVQL22vODXgsZMLSeMhqi/uxG0DRndyhT63pK EhU4F479bIG6TnzEqW8vu7wbdMB9BbIxpeYkmgmbr0oScGwRnrkZkw6zyZiu/izG1DRyj DIqnlWNNDMcZd09owDutjRclPOf6g0BW0WcgqVJRL+0d5mTGptKrX9K31VnNebZlwhGpv bWL/oOpYKQ8vLiKElgBG2MNbIm90QCxMPJaaHLu0K70pfdx4fTsAlWg6ZpcHtdPv/5tPX wIcx855fjeKfSdHp4XW1/hQ6g31AhF62RSczv85q3DC0k8jn1d94YtCubTLXey3tzHQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796264310; 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=rbrlKGcK24Q0d0qNQ2tKnNcfQ+hdC5Is+HjcBeibLKk=; b=VMTkDtyp2tp9hZtkv7TrX1p6fhs03b7zYGldpEALM8Eb/VPW+AKGidpA9gKiR/ATeUvi +WEehOslrke3J3BJdaUvRLxIwfkcg/DnlDp2kZ/SJRiZxj1ccjvFLDG3QQ2DaQGjjVV/E cJUNJzo9KgOAuS70+Ai81OoKGQi1DycoN46R6wCiY4dRBO0bmB/cNcEB6tWr/0DDrna7U D0rIfk3rVNacemAuJnqR5x59gFV3nf7/1SGFB7Lo/E0OjTnft6KGnErzdA94dWFmc2xaB kwi5mS1RfuhaIEv4zvvpRIADG+xoOhG8QPIVyS88KXFLmbEpkmSOm8M/ymqsGdXTOxA== 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=UBm29PF1; arc=none smtp.remote-ip=66.163.188.146 Received: from sonic303-20.consmr.mail.ne1.yahoo.com (sonic303-20.consmr.mail.ne1.yahoo.com [66.163.188.146]) (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 7B71B606A334 for ; Thu, 3 Dec 2026 02:18:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7B71B606A334 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=UBm29PF1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1796264308; bh=rbrlKGcK24Q0d0qNQ2tKnNcfQ+hdC5Is+HjcBeibLKk=; h=Date:Subject:To:References:In-Reply-To:From:Content-Type:From:Subject:Reply-To:Content-Type; b=UBm29PF1c+0FZ61uAcoFjbBVt8Kw/AqVyo8vE1gujbLErkbCuTeFT9yoSJLzseiQa3j2L0Mh00gB3KK6l4677KjOQ8VzTAfEErtu0MhyhZslNYFkzRBChM39AEDcdAKi/00KgqrBF+mWXtGs1Rr75mA49DfYYbCsCqb+fyL8dk3YjVo1mzGgNLGY/KcdC1CzRSFKYUuWbbgxmWFpk+MLHdmoIOp32IBNYCa+QCD617ZpPxzST7RxblxGjzKDVMwOIuTyYuZbB/rXgTbqSpT1lz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uDwMj1GJvYpay_yOGymJm9SjzSawMsDdvqqBfpJgtjr_XavowVXSKMfc6NzqvtPDeTEz Eqk4XwULi_dOmQVYfqI.8qk41gVe2wWhCz6rdWJv9VjUBuNCbN7HSr2iCKdHCWx3XOIIK8Zzr2y0 cc9QkWXYlZi_REOJhYA_AIfYyp.v4dua82dKznFUSPBsqaMAfyfUEOFmB_tClV6U6X7AajdjMgoL N.BgKV1i_l.HCG5jGnOpAbAc818c_eSOLtyXW6FfmYMjAW_Io.aFFbJMqRFUUKZLPg4fiKqpTEfb MIJ2uncpzevBOc2Si6qkRmfvJLbdOYEYq92.HhAQieOXRpImO_v7RwYecHJWZwRw2ITXRM_uweH2 3dxpdDpfkHhYbwUZQFOfDdMQ3g1hGcD34OCkjqoDgwoTyaTcJuHy_W4lHiDyxC_MeB3dF05vyElw oTWgotYH4Dx9vbAXYw0LH9WrlGCrHlpmJKgFXJPKJqBwIAYeRHNE2OatQ5mFNA.bMb7N5FpPCHg_ oGpzR4DjdrE57s3Afp1Yhz9O.HvIOTSVttJcgE1w.Y0z3yCqPc6MAtsPG5qPregNCasTPrNsYqcG 3cYEBbluZIx1hfRD7iH0oe1tRDJwIAEinAldcSJcAlYKvt9ByG8bCW.u670N0NOkwt.S5mo7ldQM viwES2kaat4FxbaJgEBmZkjE9EdDltEMwFfVmzxdQmubb.rE1cLzEB4TPu_PCKO_PxSGKQUJG1m9 FtreVIKqICM7NrSHz08OdRCiso8Xs5Ji6COWuxlMR9kVd7vE- X-Sonic-MF: X-Sonic-ID: 1d62cbf0-e3ea-4214-828c-76e832808fc5 Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.ne1.yahoo.com with HTTP; Thu, 3 Dec 2026 02:18:28 +0000 Received: by hermes--production-ir2-7c4859dc89-4b5bc (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID d865ca6b4bfcf749f41f974a32a8a893; Thu, 03 Dec 2026 02:18:25 +0000 (UTC) Message-ID: <74fdb96e-7e81-415f-8a23-0b4ac25100db@yahoo.com> Date: Thu, 3 Dec 2026 03:18:22 +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 v19 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: <59c7992d-1c83-4bf1-a2f4-c853d4777190@yahoo.com> Content-Language: pl In-Reply-To: <59c7992d-1c83-4bf1-a2f4-c853d4777190@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, 52 insertions(+), 18 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 b87b7bc..0ada87b 100644 --- a/drivers/net/dsa/realtek/rtl8365mb.h +++ b/drivers/net/dsa/realtek/rtl8365mb.h @@ -36,7 +36,8 @@ struct rtl8365mb_l2_mc; * @l2_mc_to_data: pack a multicast L2 table entry * @qos_iprio_to_hw: convert a traffic type to a hardware priority * @qos_hw_to_iprio: convert a hardware priority to a traffic type - * @qos_set_untag_pcp: program the per-port untagged PCP where supported + * @qos_set_untag_pcp: program the per-port untagged PCP, or NULL if the + * family has no configurable untagged PCP (family D) */ struct rtl8365mb_family_info { enum rtl8365mb_family family; 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