mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: netdev-bot+sashiko@kernel.org
Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, linusw@kernel.org,
	luizluca@gmail.com, alvin.sipraga@analog.com, andrew@lunn.ch,
	olteanv@gmail.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de
Subject: Re: [PATCH net-next v2 08/10] net: dsa: realtek: rtl8365mb: program the PCP of untagged frames
Date: Mon, 16 Nov 2026 14:49:46 +0100	[thread overview]
Message-ID: <avsJ-gmYVHqx48ON@pengutronix.de> (raw)
In-Reply-To: <179478369746.3136.10805769576309531848@kernel.org>

On Sun, Nov 15, 2026 at 11:01:37PM +0000, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue(s) to consider.
>
> Critical: 0 · High: 0 · Medium: 1 · Low: 0
>
> 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] rtl8365mb_qos_set_port_prio()
>   (drivers/net/dsa/realtek/rtl8365mb_qos.c) now does two separate…
>
> --
>
> net: dsa: realtek: rtl8365mb: program the PCP of untagged frames
>
> With this patch, setting the port default priority also programs the PCP
> the switch gives to untagged frames. Under PCP trust, that value decides
> how untagged frames are classified. It is also what the switch writes into
> the tag it adds on egress.
>
> > diff --git a/drivers/net/dsa/realtek/rtl8365mb_qos.c b/drivers/net/dsa/realtek/rtl8365mb_qos.c
> > index 378cd6ed7fe64..2a849d0e4898a 100644
> > --- a/drivers/net/dsa/realtek/rtl8365mb_qos.c
> > +++ b/drivers/net/dsa/realtek/rtl8365mb_qos.c
>
> [ ... ]
>
> > @@ -192,6 +201,13 @@ int rtl8365mb_qos_set_port_prio(struct realtek_priv *priv, int port, u8 iprio)
> >  	if (ret)
> >  		return ret;
> >
> > +	ret = rtl8365mb_qos_regmap_update_field(priv,
> > +						RTL8365MB_QOS_PORT_UNTAG_PCP_REG(port),
> > +						rtl8365mb_qos_sel_mask(port),
> > +						untag_pcp);
> > +	if (ret)
> > +		return ret;
> > +
> >  	return rtl8365mb_qos_regmap_update_field(priv,
> >  						 RTL8365MB_QOS_PORT_PRI_REG(port),
> >  						 rtl8365mb_qos_sel_mask(port),
>
> [Severity: Medium]
> What happens to the untagged PCP field if the second write fails?
>
> In rtl8365mb_qos_set_port_prio(), the UNTAG_PCP write goes to the hardware
> before the PORT_PRI write. If the PORT_PRI regmap_update_bits() then fails,
> for example with an SMI ACK timeout from realtek_smi_wait_for_ack() or a
> bus->write() error in realtek_mdio_write(), the error is returned. The
> untagged PCP is not restored.
>
> On that error, the DSA core rolls back the software state:
>
> net/dsa/user.c:dsa_user_dcbnl_set_default_prio() {
>     ...
> 	err = ds->ops->port_set_default_prio(ds, port, new_prio);
> 	if (err) {
> 		dcb_ieee_delapp(dev, app);
> 		return err;
> 	}
>     ...
> }
>
> dsa_user_dcbnl_del_default_prio() does the same with dcb_ieee_setapp().
>
> After that, dcbnl reports the old default priority. So does
> rtl83xx_port_get_default_prio(), because rtl8365mb_qos_get_port_prio()
> reads back only RTL8365MB_QOS_PORT_PRI_REG. The switch, however, keeps
> using the new untagged PCP: it tags untagged frames on egress with it and,
> with PCP trust enabled, classifies them by it.
>
> Could this leave untagged frames tagged and classified by a priority whose
> request failed, with no way for software to see it, until a later set
> succeeds?
>
> Elsewhere the series avoids this kind of state. For example,
> rtl8365mb_qos_set_apptrust() batches its writes "so a failed write cannot
> leave the trusted table half programmed". Would it make sense to restore
> the previous untagged PCP when the PORT_PRI write fails, or to order the
> writes so that a failure cannot leave the two fields out of step?

Restoring the old PCP does not help here. A write can fail for two
reasons. One is a register access the regmap configuration rejects;
that is a driver bug and shows up on every call, not something to
recover from at runtime. The other is an MDIO bus error, and then the
restore goes over the same failing bus, and the state of the switch is
unknown whatever the driver does. Reordering the writes does not help
either: either order leaves one field new and one old on failure. So
v3 keeps the code as it is.

The other review comments on this series are valid, so a v3 will
follow.

pw-bot: cr

  reply	other threads:[~2026-11-16 13:49 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  8:37 [PATCH net-next v2 00/10] net: dsa: realtek: rtl8365mb: DCB ingress QoS offload Oleksij Rempel
2026-11-12  8:37 ` [PATCH net-next v2 01/10] net: ieee8021q: print traffic type and queue count with %u Oleksij Rempel
2026-11-12  8:37 ` [PATCH net-next v2 02/10] net: ieee8021q: add pcp_to_tt() Oleksij Rempel
2026-11-14 19:56   ` Luiz Angelo Daros de Luca
2026-11-12  8:37 ` [PATCH net-next v2 03/10] net: ieee8021q: clarify the tt_to_tc() traffic-class mapping Oleksij Rempel
2026-11-12  8:37 ` [PATCH net-next v2 04/10] net: ieee8021q: add tt_to_pcp() Oleksij Rempel
2026-11-14 19:59   ` Luiz Angelo Daros de Luca
2026-11-12  8:37 ` [PATCH net-next v2 05/10] net: dsa: realtek: rtl8365mb: describe the ports of each chip Oleksij Rempel
2026-11-12 15:08   ` Alvin Šipraga
2026-11-16 13:36     ` Oleksij Rempel
2026-11-12 20:38   ` Linus Walleij
2026-11-15 23:01   ` netdev-bot+sashiko
2026-11-12  8:37 ` [PATCH net-next v2 06/10] net: dsa: realtek: rtl8365mb: store the egress queue count per chip Oleksij Rempel
2026-11-12  8:37 ` [PATCH net-next v2 07/10] net: dsa: realtek: rtl8365mb: add QoS baseline and DCB default prio Oleksij Rempel
2026-11-12 20:31   ` Linus Walleij
2026-11-14 20:15     ` Luiz Angelo Daros de Luca
2026-11-12  8:37 ` [PATCH net-next v2 08/10] net: dsa: realtek: rtl8365mb: program the PCP of untagged frames Oleksij Rempel
2026-11-12 20:33   ` Linus Walleij
2026-11-14 20:18   ` Luiz Angelo Daros de Luca
2026-11-15 23:01   ` netdev-bot+sashiko
2026-11-16 13:49     ` Oleksij Rempel [this message]
2026-11-16 14:06       ` Andrew Lunn
2026-11-12  8:37 ` [PATCH net-next v2 09/10] net: dsa: realtek: rtl8365mb: offload DCB apptrust Oleksij Rempel
2026-11-12 20:35   ` Linus Walleij
2026-11-14 20:26     ` Luiz Angelo Daros de Luca
2026-11-12  8:37 ` [PATCH net-next v2 10/10] net: dsa: realtek: rtl8365mb: report the DCB DSCP-to-priority map Oleksij Rempel
2026-11-12 20:36   ` Linus Walleij
2026-11-14 20:28   ` Luiz Angelo Daros de Luca
2026-11-13 12:24 ` [PATCH net-next v2 00/10] net: dsa: realtek: rtl8365mb: DCB ingress QoS offload Alvin Šipraga
2026-11-14 20:39   ` Luiz Angelo Daros de Luca

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=avsJ-gmYVHqx48ON@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --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-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --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®