🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16815

Re: [PATCH net-next v2 08/10] net: dsa: realtek: rtl8365mb: program the PCP of untagged frames

#16815
From: netdev-bot+sashiko
Date: Sun, 15 Nov 2026 23:01
89 lines
11270 bytes
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?

The code is still the same at the end of the series.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112-rtl8365mb-dcb-ingress-v2-0-f8e6fbdf8c99%40pengutronix.de
Technical Details
Message-ID: <179478369746.3136.10805769576309531848@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363900-linux-kernel-netdev=dewy.ru
References: <20261112-rtl8365mb-dcb-ingress-v2-8-f8e6fbdf8c99@pengutronix.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363900-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2 08/10] net: dsa: realtek: rtl8365mb: program
 the PCP of untagged frames
Date: Sun, 15 Nov 2026 23:01:37 +0000
Organization: Usenet Network
Message-ID: <179478369746.3136.10805769576309531848@kernel.org>
References: <20261112-rtl8365mb-dcb-ingress-v2-8-f8e6fbdf8c99@pengutronix.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1923146"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:fhGeRBCauhytPDKJSFSF9fbi27A= sha256:vQdqIXQr4jWSJiOZd0x2XgKHGoocVEJS1svJXsiChBQ=
	sha1:xhnKCF+E4ZE+MXZrwmQmUVWytdk= sha256:YB1sRTwyFA72gnIUILyvEYMTKR3pcoSwqiktYJ0KdxI=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 0D952114A91; Mon, 16 Nov 2026 02:02:07 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id s1BA_G0-8CpD;
	Mon, 16 Nov 2026 02:02:03 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-363900-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 48209114A67; Mon, 16 Nov 2026 02:01:55 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 309E02E6CC; Sun, 15 Nov 2026 23:01:51 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794783704;
	b=lEVR0aCBliy0wnNSSA+Ff700zbcZ+OyQ1um639mVU066lJBnimQnyuNUmo2ZPTmeXzGY
	 JKInFalqzOp7BDiNbtTaAkZk7YBtfowZWQnpQkcxW01UJgn0LCJ/Q/epEO2srM/qgo4Zz
	 fD1gR2P9EXfIy7rf0kKSfpNhCqN/QlgjqyKIXJSWiBM/jPch5k18vhzXlKnnDXHttXIq4
	 Gf0AYzAFbfFg5PhdEoNstBQH4bfim8NPvWiCSGNEOS7rDZnbb4ORw/kG2hBoq48f1v6mJ
	 sVtRsxfGHW+HAo4Bhb9hjXDlnik3qH7vuHRcs9M3m8cSlIghsI0nQYHUExRpEXfnfTA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794783704;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=IVGnRXoqXBiU7ETbvXoL7R64i/p8KMatzMxEBMeIuV0=;
	b=PYmT0dL6c7yxRq/GELTWTJ5GKqXEWIseWB+HB6QnWWD1sDhS9eroZsxjKCRdvqk7qDQU
	 ie2/OqJN/ttxLFdOUgZW+1n/ue/RVMbccB21rIEjiTjrWJ2Dx1YMcl1sfAy9RAIdW3YDh
	 fYtSevOAFwgBaH6n+749bbnDWEfVcz3HlIxAgoO0ubqUPFW+M7XjOWqCSySpq/ztHI1SA
	 wnuGA6ijW149IfGsSU8pegqG9yYF09jV6Dv4R+g79iIvG2bezgGrS24VMnDFUq4yt8MQ8
	 yjr/HB+NeU7nLgDUM6wLKHvo0BiqwIeCfxZmjWCCVNQnfIkrX9shyCQB80OlPw6RanQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KWruc7n7;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D54F606A32C;
	Sun, 15 Nov 2026 23:01:44 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KWruc7n7
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794783698;
	b=gjxnyZa2YbhZotlGmEI/kaOljSuwbJZY3O2ugvd8QLK1PtOYx/KryUTxb7CHiyFEy7Hm
	 Job4Nq71qIzeeimtmNfTJ0Lh6wAunOpchDnBpkMoL3t4g8JhON58lK7e8N/ck77gWl7oX
	 59uA4eMEtvzKs/wXXl4s8GETJzzl45VJzHqXqBv55crBMN8U8zP0REWtvVPeuHomkMsRx
	 FJhwPPoUym1YFXD/GpR5DHQxQFUcTFUCGqdtRfvVLkN9E68Ll1j3GLD8cSXq7m7JGx39s
	 ZX94WnkDNykWFAwFjvocyXBU/CXD5y/A3HUpEIbix+xChmc1Y75WpuLyPsWFp3Ed+KA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794783698;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=IVGnRXoqXBiU7ETbvXoL7R64i/p8KMatzMxEBMeIuV0=;
	b=wPWDNzQTkZf2upS51Bq10PP3HilbXoM+oVhcpfAHIcR4HfolAR3DW0L1+E75HHgcepzo
	 XBq/xR1S40EKnmneajHo9MKCfx+rWCorMUWPLJycLVuj2d+DFZLtG0H3U3ICt079Ue/ke
	 rWHd7yYCCVTnPIBTEvYfKn8zVnFExNaLvi2ovkj8e2yMSlVJI46xUyAlvhAN3UNRiu2ib
	 w+z6MGbfJW7lN4ZgS3JvYLYk1hb7+0suFdoafXCoHYl9VHwjp2mQ+zzgwOovoU7vA5DWK
	 KjfiL8QAijfW+9Zj9cRZ30ymilWZ0oV8lvGJqA53DLqt5yhqUCdP7TxUVPMkUZBBw/g==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KWruc7n7;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA9D7606A88B;
	Sun, 15 Nov 2026 23:01:38 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA31B1F000CA;
	Sun, 15 Nov 2026 23:01:37 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794783698;
	bh=IVGnRXoqXBiU7ETbvXoL7R64i/p8KMatzMxEBMeIuV0=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=KWruc7n7sYbh5ua3RvNfycysbM5WxTlN0iuAlSD7iob8wTwtgGq2w865X0kicICZ1
	 KXiqGMlhoCMlW4dbqiZjSERc9Dp9uo/T0+Q+4RfIsWXKwYMCmasEBNpTkQOjlKcdTB
	 u2W6IWq+Tzp8hPCScypnp48LYy9RAGdJ2rMrPhRwtpP95JHlh4Pt3F2MhwFSh8MQui
	 saGJL5KcVnBi61zup90PZobWcMPZEua7jK0ggtYX1Htd5HbIVqmsvbCsRp225Sbovt
	 DlnKwsfPu22o3YblNKpb+6Ib4v5sDdCNXdBMBu1xt9vcb9ExWb1ZL6y7ax4cKh9/U2
	 WMeeXhanq2Mbw==
X-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
X-In-Reply-To: <20261112-rtl8365mb-dcb-ingress-v2-8-f8e6fbdf8c99@pengutronix.de>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list