๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23299

Re: [PATCH net-next v14 13/15] net: dsa: realtek: rtl8365mb: refactor QoS priority handling

#23299
From: netdev-bot+sashiko
Date: Fri, 27 Nov 2026 03:00
120 lines
12192 bytes
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
Technical Details
Message-ID: <179574842763.3135.17585827427222955504@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372420-linux-kernel-netdev=dewy.ru
References: <5540b093-3ecf-4ba8-99ee-84197a037f11@yahoo.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372420-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v14 13/15] net: dsa: realtek: rtl8365mb: refactor
 QoS priority handling
Date: Fri, 27 Nov 2026 03:00:27 +0000
Organization: Usenet Network
Message-ID: <179574842763.3135.17585827427222955504@kernel.org>
References: <5540b093-3ecf-4ba8-99ee-84197a037f11@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="623786"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:UFr3JBfyzgjOblwJvvAkPxE8QXc= sha256:Tv5xEt9fZCT/rlF63npiQ4zr83x8zYzJHwgmFWPMtdw=
	sha1:5YWO8/kbBlC3Ql5/0GbfBhsIpA8= sha256:/ERmvENgZybMsncb+rLpVV44TcRnF+bxXVWR5wmvD6I=
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 5C321125F04; Fri, 27 Nov 2026 06:00:51 +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 GBEoibaYfV-4;
	Fri, 27 Nov 2026 06:00:47 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-372420-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 2900F125F0D; Fri, 27 Nov 2026 06:00:38 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id BD40A28AC9; Fri, 27 Nov 2026 03:00:34 +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=1795748430;
	b=bpDmnzBYkn997JvRmCDKQRE/XT/66c0PT2r/sUxXpCepID3CKNPurf6QHXfSLAegxF+y
	 5Kg+nt9myLK/b5jMYmz+LH3HFHeSBsrjYHEIZP9+TS0fqe7ko0lPBxXB71M3nKA6yaQae
	 ylQgwNWHuz3dzzf1vXBboBWpzBcakyp01IsXN6g/N+Bv0DNbnarGw4hoteQwlnZO/WfgE
	 VyMg9BtD325q3Ug/pA8aXwqFxODRNdeNsEngMsuoI/u/ua968s4vtRSh++xJloVvw7uTL
	 arihB6mqqG5zxfSEWPgGKtQA7Gb1Jw8mVNmkLtBEsooM1lYyUrjsH1HPT+qW7x/Drzw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795748430;
	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=R0Vs5cMh1I8sELTgtzEauSmU6SnbuXs/YWY69nxtdIo=;
	b=c+WPD4rR5r186P8Iqxv++qZRMYBb1eplnPy5N8nkHK3HVLIOJVO3VnLyM+5ec1ZRY4ey
	 dpi7ysaKU70haQz5O/YEUDYqGWMpLYF5M7zPrMqOQtu3QW+a6gluv727M4fPP7udHgWxc
	 9D/cNVdsIcvUb2UPDMZvRlbYBRCN/Yr+n4lYCqrHfmKJpX3pWCYD8qiFowT5odg6YVAwO
	 pswoL+rLLHObRSHl+JL5IcMVhehFMhcCbAVBhDYlg2NhVbYaBzMfwfIoHKHLrjh5iU8Kn
	 NYj0T96q750lZYPiA2LWvSyVGze6zwGuQ5Pi5IVUqNxih255zLJb/Qh2AMSUzezUpow==
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=CIshqDiN;
	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 66D79606A68B;
	Fri, 27 Nov 2026 03:00:30 +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=CIshqDiN
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=1795748429;
	b=LrXjfvfUzScs+ENaMvBsqPZxvxE5cqfCFmSrNLRMjiHgVxfJf6L4xUetTTIOZsgDGyZg
	 RUECRGFfAAN6wA8kaZOKZ3rSOo3/NNIndrUWSIpRhBnvnTn9HGWsOfWhbJOUzdDyN7ifl
	 cVBKslseNpsy2szr2YLP+sPs41hfYW5jRvNP4g/9nqpSD0KNk71wkRIi6bGgFit9PSl6j
	 zMVsf1H9pA+lkY7iqeEOFWkB1nR46Plo0GnmeVyImbfRiW1xTRKDhetlqlvhaUe4G2MyW
	 4UM6zg4YUFIdeA/zeKyXl5dL5fSAoNyxzXUuDlRbJ4JJA/ycQVGgMCpGSNbE5EAqitQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795748429;
	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=R0Vs5cMh1I8sELTgtzEauSmU6SnbuXs/YWY69nxtdIo=;
	b=2d+fXl6h1ZU0Znbx8JjWmlyLPpVukyMdT/49W2T2EasAeB4y6KHJ4Zi9CS7a6G0d6xD1
	 qIvA5gtqURdA+y3Zps03RzCYrMGOeOxyWBTqfytWYt+bZAUdWpdjTF4iHYxF2A9u0PpwA
	 +bMZ+ktjkcSRwxk/Hohoyqz1WDKGKcvO13L0PjHOoOLVaptsAoAiFgLBRlXvGTJ5NXBpn
	 HJQ825fwi6gmR6F7cwL5pMRvTc7fxHfPDK+JqKXDaDrifLBuO/9jLSE7Mm8+XhSo6Z4zs
	 auaAF4xoDXrKV3LfsTdJlQqQlEsic6aQcowx2fIuu4wxUbXyLUy/rCwKKBz9pW9e5wQ==
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=CIshqDiN;
	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 87EA1606A697;
	Fri, 27 Nov 2026 03:00:29 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 152481F00A22;
	Fri, 27 Nov 2026 03:00:28 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795748429;
	bh=R0Vs5cMh1I8sELTgtzEauSmU6SnbuXs/YWY69nxtdIo=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=CIshqDiNIElgldUMIWCCu6vOprXOUWlxNMRuFgeUDR1NZ5/BVpyIk0ERfSTu0uSiR
	 4V+lt/T9RpPvzRuQkydqPr5K1+g4yfNySyHUIf7qfpxl/5hbGgd9v3kP/d8BsTmMrV
	 GePB6Alm/0YXguMm0lIaUPvvpEmMo/+WgzbdPI4mR7RC1GMgRZYHD1Ng/5UKGr+8NR
	 rQPeh02/kt3wtp4JTFyHodYzdtrDR/Qf9WKvaDZGymT8aBYXndo9dAUdyA5HObeK8a
	 4FM+YMF5TKspMkDaRugjWO/dA6ElRenOajKTpeW+qKjswIzchzeFApsG5TgMkOF6Zf
	 Ht/Mb3g8MOr7A==
X-Cc: 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
X-In-Reply-To: <5540b093-3ecf-4ba8-99ee-84197a037f11@yahoo.com>
X-sashiko-severity: Low
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