From: netdev-bot+sashiko@kernel.org
To: o.rempel@pengutronix.de
Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, linusw@kernel.org, luizluca@gmail.com,
andrew@lunn.ch, olteanv@gmail.com, alvin.sipraga@analog.com,
horms@kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH net-next v2 2/2] net: dsa: realtek: rtl8365mb: offload ETS strict priority scheduling
Date: Tue, 01 Dec 2026 13:26:19 +0000 [thread overview]
Message-ID: <179613157942.3146.15452909686182465491@kernel.org> (raw)
In-Reply-To: <20261130-rtl8365mb-ets-strict-v2-2-9639f6f40499@pengutronix.de>
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 2
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] In drivers/net/dsa/realtek/rtl83xx-qos.c,
rtl83xx_port_setup_tc() keeps only one ETS handle per port…
- [Low] rtl83xx_setup_tc_ets_replace() in
drivers/net/dsa/realtek/rtl83xx-qos.c accepts TC_ETS_REPLACE and…
- [Low] The commit body, which is the part that stays in git history
(everything after the first '---' is dropped by git am), describes the…
--
net: dsa: realtek: rtl8365mb: offload ETS strict priority scheduling
This commit adds ETS qdisc offload for rtl8365mb user ports. Installing
a root ETS qdisc with one strict band per queue switches the port from
the default equal-weight WFQ scheduler to strict priority. Deleting the
qdisc, or a refused offload, puts the port back on WFQ, and the priomap
is not offloaded.
> Offload the ETS qdisc so a user port can be switched from the WFQ
> default to strict priority. With WFQ (weighted fair queuing) the
> switch serves all queues of a port in turn, by their weights. By
> default the driver sets equal weights, so no queue is served before
> another. With strict priority a higher queue is always sent first.
> Deleting the qdisc puts the port back on WFQ.
[Severity: Low]
Is the last sentence accurate in all cases? With hw-tc-offload off,
ets_offload_destroy() returns early on !tc_can_offload(dev), so deleting
the qdisc leaves the port strict. The comment in the TC_ETS_DESTROY case
says so, but the commit body does not.
A few other user-visible details appear only in the Q&A below the ---
line, which git am drops:
rtl83xx_port_setup_tc() returns -EOPNOTSUPP for TC_ETS_STATS on purpose.
So qdisc_offload_dump_helper() never sets TCQ_F_OFFLOADED, even while
the QTYPE register is set to strict. Nothing reports whether the port
runs strict or WFQ.
If a replacement root qdisc fails after its REPLACE was accepted, the
port goes back to WFQ while the old strict qdisc stays root.
Could these details go into the commit message itself?
> diff --git a/drivers/net/dsa/realtek/rtl83xx-qos.c b/drivers/net/dsa/realtek/rtl83xx-qos.c
> index f294222987eff..d2b21521b6de4 100644
> --- a/drivers/net/dsa/realtek/rtl83xx-qos.c
> +++ b/drivers/net/dsa/realtek/rtl83xx-qos.c
[ ... ]
> @@ -208,3 +209,110 @@ int rtl83xx_port_set_apptrust(struct dsa_switch *ds, int port, const u8 *sel,
> ARRAY_SIZE(trust));
> }
> EXPORT_SYMBOL_NS_GPL(rtl83xx_port_set_apptrust, "REALTEK_DSA");
> +
> +static int
> +rtl83xx_setup_tc_ets_replace(struct dsa_switch *ds, int port,
> + struct tc_ets_qopt_offload_replace_params *p)
> +{
> + struct realtek_priv *priv = ds->priv;
> + unsigned int nq = ds->num_tx_queues;
> + int i;
> +
> + /* The qdisc must have one band per queue. */
> + if (p->bands != nq) {
[ ... ]
> + /* The switch does not use the priomap. */
> + return priv->ops->qos_set_port_sched(priv, port, nq, true);
> +}
[Severity: Low]
Should a non-default priomap be refused here, or programmed into the
switch?
rtl83xx_setup_tc_ets_replace() checks only p->bands and p->quanta[]. A
priomap that sends every skb->priority to a single band is accepted,
and the port still switches to strict priority based on the switch's
own traffic-type-to-queue map.
ksz_tc_ets_add() in drivers/net/dsa/microchip/ksz_common.c programs the
priomap into the switch's priority-to-queue map
(KSZ9477_PORT_MRI_TC_MAP__4). This chip has a per-port qmap
(rtl8365mb_qos_set_qmap_qid() and rtl8365mb_qos_set_port_qmap()) that
might do the same job.
The commit message documents this limitation, and the qdisc is never
reported as offloaded. The hardware scheduler still changes, though.
> +
> +/* Forget the offloaded ETS qdisc of @port and put the port back on WFQ */
> +static int rtl83xx_setup_tc_ets_restore_wfq(struct dsa_switch *ds, int port)
> +{
> + struct realtek_priv *priv = ds->priv;
> + int ret;
> +
> + priv->ets_handle[port] = 0;
[ ... ]
> + switch (ets->command) {
> + case TC_ETS_REPLACE:
> + /* sch_ets keeps the qdisc when the offload fails. Put the
> + * port back on WFQ so an earlier strict setup does not stay
> + * active.
> + */
> + ret = rtl83xx_setup_tc_ets_replace(ds, port,
> + &ets->replace_params);
> + if (ret) {
> + rtl83xx_setup_tc_ets_restore_wfq(ds, port);
> + return ret;
> + }
> +
> + priv->ets_handle[port] = ets->handle;
> +
> + return 0;
> +
> + case TC_ETS_DESTROY:
> + /* sch_ets offloads a new root qdisc before it destroys the
> + * old one. Put the port back on WFQ only when DESTROY carries
> + * the handle that was offloaded last. The new qdisc can fail
> + * after the driver has offloaded it, for example in its rate
> + * estimator. In that case qdisc_create() destroys the new
> + * qdisc. Its DESTROY carries the handle offloaded last, so the
> + * port goes back to WFQ. The old qdisc keeps running in
> + * software.
> + *
> + * With hw-tc-offload off, sch_ets sends no DESTROY, so the
> + * port stays strict.
> + */
> + if (ets->handle != priv->ets_handle[port])
> + return 0;
> +
> + return rtl83xx_setup_tc_ets_restore_wfq(ds, port);
[Severity: Medium]
Can this leave the port on WFQ while an accepted all-strict root qdisc
is still installed?
Only one handle is tracked per port. So a DESTROY for a new qdisc that
failed after its REPLACE looks the same as a delete of the active
qdisc.
Consider this sequence:
1. Root ETS qdisc 1: with nq strict bands is offloaded. The port is
strict and ets_handle[port] = 1:.
2. tc qdisc replace dev lanX root handle 2: ets bands N strict N ...
3. qdisc_create()->ets_qdisc_init()->ets_qdisc_change()->
ets_offload_change() sends TC_ETS_REPLACE for 2:, which is
accepted, and ets_handle[port] = 2:.
4. qdisc_create() then fails in gen_new_estimator() for TCA_RATE, or
qdisc_graft() fails in tc_modify_qdisc() and calls qdisc_put(q).
5. ets_qdisc_destroy()->ets_offload_destroy() sends TC_ETS_DESTROY
for 2:. That matches ets_handle[port], so
rtl83xx_setup_tc_ets_restore_wfq() clears the handle and writes
WFQ.
The tc command fails and qdisc 1: stays root, but the port now runs
WFQ. Nothing sends the REPLACE for 1: again. A later DESTROY for 1: no
longer matches the cleared handle, so it is ignored.
The comment above describes this outcome. Could the driver remember
the previously offloaded handle and put the port back to strict here?
The two cases look different from the driver's side. On a successful
replace, the old qdisc's DESTROY arrives after the new REPLACE. On a
failed replace, the new qdisc's DESTROY arrives and the old qdisc is
never destroyed.
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-rtl8365mb-ets-strict-v2-0-9639f6f40499%40pengutronix.de
prev parent reply other threads:[~2026-12-01 13:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 13:23 [PATCH net-next v2 0/2] net: dsa: realtek: rtl8365mb: offload ETS strict priority Oleksij Rempel
2026-11-30 13:23 ` [PATCH net-next v2 1/2] net: dsa: realtek: rtl8365mb: default the egress scheduler to WFQ Oleksij Rempel
2026-11-30 13:23 ` [PATCH net-next v2 2/2] net: dsa: realtek: rtl8365mb: offload ETS strict priority scheduling Oleksij Rempel
2026-12-01 13:26 ` netdev-bot+sashiko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179613157942.3146.15452909686182465491@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=alvin.sipraga@analog.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luizluca@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®