Re: [PATCH net-next v14 13/15] net: dsa: realtek: rtl8365mb: refactor QoS priority handling
From: netdev-bot+sashiko
Date: Thu Nov 26 2026 - 22:00:54 EST
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] This patch splits the QoS code into two value spaces.
--
net: dsa: realtek: rtl8365mb: refactor QoS priority handling
This patch moves two pieces of QoS handling behind three new
rtl8365mb_family_info hooks: the conversion between an 802.1Q traffic
type and the chip's priority, and the programming of the untagged-frame
PCP. The hooks are qos_iprio_to_hw, qos_hw_to_iprio and
qos_set_untag_pcp. Family C keeps its existing behaviour through an
identity mapping, and rtl8365mb_qos_qmap_init() now iterates over chip
priorities and converts each one back to a traffic type.
> diff --git a/drivers/net/dsa/realtek/rtl8365mb_qos.c b/drivers/net/dsa/realtek/rtl8365mb_qos.c
> index 5b9e1abe75c8b..b61ffdb4073ac 100644
> --- a/drivers/net/dsa/realtek/rtl8365mb_qos.c
> +++ b/drivers/net/dsa/realtek/rtl8365mb_qos.c
[ ... ]
> +/* Convert an internal priority (an 802.1Q traffic type) to the value the
> + * chip uses. Return the value or a negative errno.
> + */
> +static int rtl8365mb_qos_iprio_to_hw(struct realtek_priv *priv, u8 iprio)
> +{
> + return rtl8365mb_get_family_info(priv)->qos_iprio_to_hw(iprio);
> +}
[ ... ]
> @@ -306,19 +366,27 @@ int rtl8365mb_qos_qmap_init(struct realtek_priv *priv)
> {
> unsigned int nq = priv->ds.num_tx_queues;
> struct dsa_port *dp;
> - int iprio, ret;
> + int prio, ret;
>
> - for (iprio = 0; iprio < RTL8365MB_NUM_INTERNAL_PRIOS; iprio++) {
> - int tc = ieee8021q_tt_to_tc(iprio, nq);
> + /* The table is indexed by the chip's priority, not by the traffic
> + * type.
> + */
> + for (prio = 0; prio < RTL8365MB_NUM_INTERNAL_PRIOS; prio++) {
> + int tt = rtl8365mb_qos_hw_to_iprio(priv, prio);
> + int tc;
> u8 qid;
>
> + if (tt < 0)
> + return tt;
> +
> + tc = ieee8021q_tt_to_tc(tt, nq);
> if (tc < 0)
> return tc;
>
> qid = rtl8365mb_qos_tc_to_qid(nq, tc);
> ret = rtl8365mb_qos_set_qmap_qid(priv,
> RTL8365MB_QOS_QMAP_DEFAULT,
> - iprio, qid);
> + prio, qid);
[Severity: Low]
This isn't a bug, but should the remaining names and comments be updated
to match the new split between iprio (traffic type) and hw (chip
priority)?
The loop now passes the chip priority to rtl8365mb_qos_set_qmap_qid().
The callee still calls that argument iprio, and so does the register
macro it uses:
static int rtl8365mb_qos_set_qmap_qid(struct realtek_priv *priv, int qmap,
u8 iprio, u8 qid)
{
u32 reg = RTL8365MB_QOS_QMAP_TBL_REG(qmap, iprio);
#define RTL8365MB_QOS_QMAP_TBL_REG(_m, _iprio) \
In the same file, rtl8365mb_qos_set_pcp_prio() and
rtl8365mb_qos_set_dscp_prio() use iprio for the traffic type before
converting it, so the same parameter name now means two different
things.
A few register comments also still describe their contents as an
internal priority, although after this patch they hold the converted hw
value:
/* qmaps: the queue id of each internal priority, one table per qmap */
/* 802.1p (PCP) -> internal priority remap */
/* DSCP -> internal priority, one table for the whole chip */
rtl8365mb_qos.h has the same wording:
/* Internal priority -> queue id tables (qmaps) */
At this commit, the comment at the top of rtl8365mb_qos.c ("The chip's
eight internal priorities carry 802.1Q traffic types") also conflicts
with the new "not by the traffic type" comment above.
The later patch "net: dsa: realtek: rtl8365mb: use PCP numbering on
family D" rewrites the top-of-file comment. It leaves the
rtl8365mb_qos_set_qmap_qid() parameter, the RTL8365MB_QOS_QMAP_TBL_REG()
argument and the register and header comments unchanged.
On family D the two value spaces really are different, so would renaming
these (for example to hw_prio, matching qos_set_untag_pcp) make it
harder to pass the wrong one later?
> if (ret)
> return ret;
> }
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/874b29a3-f47f-4bf2-a0f6-2f9fea712f4c%40yahoo.com