Article View: linux.kernel.netdev
Article #21204Re: [PATCH net-next] net: dsa: tag_rtl8_4: add support for RTL9607C tag variant
From: netdev-bot+sashiko
Date: Mon, 23 Nov 2026 18:00
Date: Mon, 23 Nov 2026 18:00
197 lines
15110 bytes
15110 bytes
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · 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] This patch adds a new DSA tag protocol, DSA_TAG_PROTO_RTL8_4AP
(value 38), and the tagger rtl8_4ap_netdev_ops.
- [Medium] rtl8_4ap_read_tag() (net/dsa/tag_rtl8_4.c, lines 296-306) uses
a deny-list to decide whether the switch already forwarded a received…
- [Low] The patch makes tag_rtl8_4.c cover a second chip family, but some
existing documentation was not updated and the new comment contradicts…
- [Low] The comment and the code in net/dsa/tag_rtl8_4.c disagree on what
REASON means for the rtl8_4ap tagger.
--
net: dsa: tag_rtl8_4: add support for RTL9607C tag variant
This commit adds a new DSA tag protocol, rtl8_4ap (DSA_TAG_PROTO_RTL8_4AP),
for the variant of the 8 byte Realtek protocol 4 tag used by the switch
embedded in RTL9607C SoCs. The tag sits after the source MAC, as with
rtl8_4, but the fields are laid out differently and the TX and RX layouts
differ from each other.
> diff --git a/include/net/dsa.h b/include/net/dsa.h
> index 09f3043d57f06..6f86c76253043 100644
> --- a/include/net/dsa.h
> +++ b/include/net/dsa.h
> @@ -63,6 +63,7 @@ struct tc_action;
> #define DSA_TAG_PROTO_MT7628_VALUE 35
> #define DSA_TAG_PROTO_KS8995_VALUE 36
> #define DSA_TAG_PROTO_LAN9645X_VALUE 37
> +#define DSA_TAG_PROTO_RTL8_4AP_VALUE 38
[Severity: Medium]
Which switch driver is expected to select DSA_TAG_PROTO_RTL8_4AP?
The only in-tree user of the protocol 4 taggers is rtl8365mb. It only
returns the two existing values:
drivers/net/dsa/realtek/rtl8365mb_main.c:rtl8365mb_get_tag_protocol() {
...
if (cpu->position == RTL8365MB_CPU_POS_BEFORE_CRC)
return DSA_TAG_PROTO_RTL8_4T;
return DSA_TAG_PROTO_RTL8_4;
}
Likewise, rtl8365mb_change_tag_protocol() only accepts DSA_TAG_PROTO_RTL8_4
and DSA_TAG_PROTO_RTL8_4T.
So nothing in mainline can reach rtl8_4ap_tag_xmit() or rtl8_4ap_tag_rcv().
The patch still permanently reserves protocol ID 38 and adds the module
aliases "id-38" and "rtl8_4ap".
The commit message says:
Add basic necessities for this cpu tag variant to function.
However, the RTL9607C switch driver that would use this tagger is not part
of the submission. The only testing mentioned was on an out-of-tree OpenWrt
6.18 kernel.
Could this be resubmitted together with the switch driver that consumes it?
[ ... ]
> diff --git a/net/dsa/tag_rtl8_4.c b/net/dsa/tag_rtl8_4.c
> index 4da3beebef75e..c934c232d330e 100644
> --- a/net/dsa/tag_rtl8_4.c
> +++ b/net/dsa/tag_rtl8_4.c
> @@ -74,6 +74,54 @@
[ ... ]
> + * On CPU->Switch however the byte 3 is also different:
> + *
> + * |-----------------------------------+-----------------------------------|
> + * | (8-bit) | (8-bit) |
> + * | Protocol [0x04] | TX_PORTMASK_LOW |
> + * |-----------------------------------+-----------------------------------|
> + * | (3-bit) |(1)| (1) | (3) |(1) |(1)| (1) |(1) |(2)| (1) |1|
> + * |TX_PORTMASK_HIGH| X | PRI_EN | PRI |KEEP| X |LEARN_DIS|PSEL| X |DIRTX|X|
[Severity: Low]
This isn't a bug, but the CPU->switch diagram calls the forwarding port
mask TX_PORTMASK_LOW and TX_PORTMASK_HIGH. The glossary earlier in the file
says "RX (CPU->switch): forwarding port mask", and the code names the same
fields RTL8_4AP_RX_LO and RTL8_4AP_RX_HI. Should the diagram say RX to
match?
The new macros also mix two prefixes: RTL9607C_RX_HI_MSK sits next to
RTL8_4AP_RX_LO and RTL8_4AP_RX_HI.
A few existing descriptions were not updated for the new variant. The file
header still says:
* NOTE: Currently only supports protocol "4" found in the RTL8365MB, hence
* named tag_rtl8_4.
The tag placement text only mentions "rtl8_4" and "rtl8_4t". The
NET_DSA_TAG_RTL8_4 help text in net/dsa/Kconfig only mentions the
RTL8365MB-VC:
switches with 8 byte protocol 4 tags, such as the Realtek RTL8365MB-VC.
Could these be updated to cover RTL9607C and rtl8_4ap?
[ ... ]
> @@ -97,13 +146,63 @@
> #define RTL8_4_REASON GENMASK(7, 0)
> #define RTL8_4_REASON_FORWARD 0
> #define RTL8_4_REASON_TRAP 80
> +#define RTL8_4AP_REASON_BCAST_TRAP 203
> +#define RTL8_4AP_REASON_RESV_TRAP 215
> +#define RTL8_4AP_REASON_IGMP 219
> +#define RTL8_4AP_REASON_RMA 220
> +#define RTL8_4AP_REASON_ACL 227
[Severity: Low]
The only REASON documentation in this file is the shared table:
* REASON | reason for forwarding packet to CPU
* | 0: packet was forwarded or flooded to CPU
* | 80: packet was trapped to CPU
The new RTL9607C section says only bytes 4-7 differ on switch->CPU. That
suggests REASON means the same thing on this SoC.
However, rtl8_4ap_read_tag() treats 203, 215, 219, 220 and 227 as traps,
and none of these codes appear in the comment. It also treats 80 as
forwarded, which is the opposite of the documented meaning.
The new FBI description ("Only relevant when REASON is FB (aka < 64)") also
implies that 0..63 are flow based reasons. That conflicts with "0: packet
was forwarded or flooded to CPU".
Could the RTL9607C REASON codes be documented, and the existing table
marked as RTL8365MB specific?
[ ... ]
> @@ -153,6 +252,84 @@ static struct sk_buff *rtl8_4t_tag_xmit(struct sk_buff *skb,
[ ... ]
> + /* Parse REASON */
> + reason = FIELD_GET(RTL8_4_REASON, ntohs(tag16[1]));
[ ... ]
> + switch (reason) {
> + case RTL8_4AP_REASON_BCAST_TRAP:
> + case RTL8_4AP_REASON_RESV_TRAP:
> + case RTL8_4AP_REASON_IGMP:
> + case RTL8_4AP_REASON_RMA:
> + case RTL8_4AP_REASON_ACL:
> + break;
> + default:
> + dsa_default_offload_fwd_mark(skb);
> + break;
> + }
[Severity: Medium]
Is a deny-list safe here? Every REASON value except these five ends up in
dsa_default_offload_fwd_mark():
net/dsa/tag.h:dsa_default_offload_fwd_mark() {
struct dsa_port *dp = dsa_user_to_port(skb->dev);
skb->offload_fwd_mark = !!(dp->bridge);
}
That covers the flow based reasons (< 64) from the FBI description, code
80, and any other trap reason the RTL9607C can emit.
Suppose the switch traps a frame to the CPU on a bridged port for one of
those unlisted reasons. Wouldn't the bridge then treat the frame as already
forwarded in hardware, and skip software forwarding to the other ports in
the same hardware domain? That frame would be silently lost.
Whether this happens depends on which reason codes the hardware emits and
how the switch driver configures trapping. Neither is visible in the tree.
Would it be safer to set offload_fwd_mark only for reasons that are known
to mean the switch already forwarded or flooded the frame?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119165129.26693-1-adilov%40disroot.org
Technical Details
Message-ID:
<179545681886.3135.12744267158619416896@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369635-linux-kernel-netdev=dewy.ruReferences:
<20261119165129.26693-1-adilov@disroot.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369635-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next] net: dsa: tag_rtl8_4: add support for RTL9607C tag variant Date: Mon, 23 Nov 2026 18:00:18 +0000 Organization: Usenet Network Message-ID: <179545681886.3135.12744267158619416896@kernel.org> References: <20261119165129.26693-1-adilov@disroot.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3946716"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:8O0wz/NdM9R3xAavORnI/+6ItUY= sha256:AcveafMA0fSKY7WDznvZbFB9Lwt6fipe6oGdeUcku8g= sha1:pO+Kfhfao+lRgB974woKb057Zmg= sha256:SM26Df2/zn+7Je6IKxmIjMLUH4NevoJHF+bGga1nQSQ= 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 8A34C125DC2; Mon, 23 Nov 2026 21:00:46 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 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, URIBL_BLOCKED=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 s33VFBBBdrkH; Mon, 23 Nov 2026 21:00:42 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369635-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id EB7BB125DB9; Mon, 23 Nov 2026 21:00:33 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id A41FE2E7EE; Mon, 23 Nov 2026 18:00:26 +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=1795456821; b=3nJtGvliYbA37WZh7TW5SWCXqSYg56v/VZgCl2a+GhizTKvi8n7geLbZ9pHLmjVsCnQr ofyHsQ6winrmEhryaLLW7lb4X86mkuXpUE/vRG9N3GwpSAZdunYVV+4+1olanz9wxmn0g 1Kk1Pr5X4Nv3abd11kktmZW8v9vE23uM50VpruxA0RLAjMCq1MWDs++7GfP9ASNszovc5 5U+8SGOj+Vqb3aLD3S0dvTPpP5F0bg4pSae8puu5H8/ttO+2huL0z/w7mfSFsjZKYXk2P Jr7hMbYjocgO4122+5hA2CFFd4PojKR20zxax2cDsT/gpmFTHQKLn3844EorEkljqkg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795456821; 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=VCDgVwIkgLge8GbQvw7KHx7sko0csoUykFdgfMQXgFM=; b=1RAQHcdrir7Mnxe4qLeJHPWApm7ppROf2C9vCswWmds1hWThW3nE6EJDLlXKKThn4EPq 2hcMClqgzOjWL8mTYHc5TGHzEkwydg0Ac8EBQjwPC+I7dhg//TIcGJBwPIRtLEJCxeGH8 PvJoPil136pute9nw/FMgkFUEapTN+SKac5Gc+dI/4J0E0Ju6DVAcBgdOEj2guGUWufxd PSRzX19Ajvevk+0GU44xcucNClegiIZONdH/dmyuWuB9Wp3PZVZiKwKYtILKdk7QNvLOF AWXQEDjKnPxHRTOTQm1W2bVX578wKiC63zBqk7pxwi9Jww3AM7WuWnF66uelWdYnZhA== 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=SiAZc5ki; 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 7A9BC606A334; Mon, 23 Nov 2026 18:00:21 +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=SiAZc5ki 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=1795456820; b=0xp7aKnqYd1vLTpMHC0PZAOdQwf/x3AXi6EXGWkYq2opF4SByiqjt25kGGHBkbUtgDYl 2SG+KswCjj8iRH7qOt6NBHprKIqdsTrWKFdQYxwdIi3A+89mJGKWHPjXQ2ABcdyh3vZj0 A2vMIN2PNA39Khz9h45UWMiWxvYF49TWPRiw05w3SuNHrgSIqsiCedTnNV/qebTVFyjUH cQ5a234WMUW2FfIG5mpLq7RFBXArodZB+W30ekmMGfaqaG347hzexeK2d63OXUhMX+er0 HKP6G/RcclXJt9ggsrxKJB2xswZW1memY6tYtP72MNnRVn2L2qxuUSPQiXVlb8bFfAg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795456820; 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=VCDgVwIkgLge8GbQvw7KHx7sko0csoUykFdgfMQXgFM=; b=APxG5/Qv+h2iXU1tUFCnlpkbPJh5n1PPKvbVNxnMf896YyS02Iqi0vkwcLHqmtww7ksE pGTu+DjbVkBCVTsc4CThmKGA4tK6IB9Pq9J8D8/K0EHnDoNGRZyOMuVyN9idlGm7fsdW1 /fwoSb7wJqcOyCuQTfDQgCbua3N9iFgzJrpz9WgRTbMwWc0aPL/06P3HPvq75k39yQou1 yxb3DHUMNMQMrxNlgpN60S9gYPAWBUwEAMNwr9NXtq4MkW5Wi6C5TBYi4k5jxg5WWVpkK ImFxzN9FSNe5qcgb1QtlsOJqpfSxTNz7Cy3LJSW9/C6QEzW86SnscelznuWi2Wu5zUw== 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=SiAZc5ki; 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 99C3F606A321; Mon, 23 Nov 2026 18:00:20 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 502661F000D1; Mon, 23 Nov 2026 18:00:19 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795456820; bh=VCDgVwIkgLge8GbQvw7KHx7sko0csoUykFdgfMQXgFM=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=SiAZc5kiVYEA2z4xL5BwqF+GHuzD7MWu9w6aGI7XCDZPo3LBsrS93UFXFoFXDY0o0 lJcVCtQRmWGmd8ImF4sBgYj4e6EkmDM3kCtWrd3I9Eqy4DMVsDzGb8hkWEEYEcHKJ8 KQ0Zmpv2Gd3mCSSy12qeK5ErOyqf89+DNZLW4DKUJrr0qmh0fERtNA2KOwP5kTJU7J xQoBH66qED4WJP5lRE2lmxUHDa5o2sckcDt7EGkzGAsCTmaPFdPc0nwYeKrpc34C1x A6KDnAN36sRVjh8XZ8hAu24LD4kLsw1xeqXjmN7hb8926J0YVWki3sI7bCdbeUsCI1 jbsY1bqrvmOgg== X-Cc: andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, alvin.sipraga@analog.com, linusw@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, zectaiga@gmail.com X-In-Reply-To: <20261119165129.26693-1-adilov@disroot.org> 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