mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: v.strassheim@linutronix.de
Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
	andrew@lunn.ch, olteanv@gmail.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, linux@armlinux.org.uk,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, martin.kaistra@linutronix.de,
	b.spranger@linutronix.de
Subject: Re: [PATCH net-next v2 3/4] net: dsa: Add tag handling for SoC-e switches
Date: Wed, 09 Sep 2026 12:12:25 +0000	[thread overview]
Message-ID: <178895594594.219967.10703472718792333808@kernel.org> (raw)
In-Reply-To: <20260903-devel-vstrassheim-soce-dsa-ml-v2-3-fb0587cb466b@linutronix.de>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider:

Critical: 0 · High: 0 · Medium: 1 · Low: 1

- [Medium] sdsa_rcv() (net/dsa/tag_sdsa.c, lines 86-87) unconditionally
  destroys every received frame whose SDSA header has the VLAN-info bit…
- [Low] Concern (INVALIDATED by series context): 'the new DSA tag
  protocol DSA_TAG_PROTO_SDSA / CONFIG_NET_DSA_TAG_SDSA has no in-tree…

--

net: dsa: Add tag handling for SoC-e switches

This adds a new DSA tagger for SoC-e switches, which insert an 8-byte SDSA
header with EtherType 0xdcdc between the source MAC address and the original
EtherType.  Both TO_CPU and FROM_CPU directions are handled, while the VLAN
metadata fields in the header are left clear on transmit and rejected on
receive.

> diff --git a/net/dsa/Kconfig b/net/dsa/Kconfig
> index 23b4b74004ed5..0032ccd3badf6 100644
> --- a/net/dsa/Kconfig
> +++ b/net/dsa/Kconfig
> @@ -188,6 +188,12 @@ config NET_DSA_TAG_RZN1_A5PSW
>  	  Renesas RZ/N1 embedded switch that uses an 8 byte tag located after
>  	  destination MAC address.
>  
> +config NET_DSA_TAG_SDSA
> +	tristate "Tag driver for SoC-e switches using EtherType SDSA headers"
> +	help
> +	  Say Y or M if you want to enable support for tagging frames for the
> +	  SoC-e switches.
> +

[Severity: Low]
This isn't a bug, just a note so it does not get raised again during review.
Taken on its own, this patch adds a tagger and a protocol id with no in-tree
user.  The next patch in the series, "net: dsa: soce: Add basic support for
SoC-e switch IP cores", adds drivers/net/dsa/soce/ whose Kconfig contains
select NET_DSA_TAG_SDSA and whose soce_get_tag_protocol() returns
DSA_TAG_PROTO_SDSA, so the tagger is reachable by the end of the series.

[ ... ]

> diff --git a/net/dsa/tag_sdsa.c b/net/dsa/tag_sdsa.c
> new file mode 100644
> index 0000000000000..83bccd65b1b1d
> --- /dev/null
> +++ b/net/dsa/tag_sdsa.c
> @@ -0,0 +1,123 @@

[ ... ]

> +/* SDSA tag byte layout (after the 12-byte MAC header):
> + * Bytes 0-1: SDSA EtherType (0xDCDC)
> + * Bytes 2-3: Reserved
> + * Byte 4:    Frame type (bits 7-6), VLAN-info bit (bit 5), port[9:5] (bits 4-0)
> + * Byte 5:    Port[4:0] (bits 7-3)
> + * Bytes 6-7: PCP (bits 7-5) / CFI (bit 4) / VID (bits 3-0 + byte 7), only
> + *            meaningful when the VLAN-info bit is set.
> + */

[ ... ]

> +static struct sk_buff *sdsa_xmit(struct sk_buff *skb, struct net_device *dev)
> +{

[ ... ]

> +	tag->port_lo = FIELD_PREP(SDSA_TAG_PORT_LO_MASK, dp->index);
> +	tag->vlan = 0;
> +
> +	return skb;
> +}
> +
> +static struct sk_buff *sdsa_rcv(struct sk_buff *skb, struct net_device *dev)
> +{

[ ... ]

> +	/* SDSA VLAN information is not supported. */
> +	if (tag->frame_type_port_hi & SDSA_TAG_VLAN_BIT)
> +		goto out_drop;

[Severity: Medium]
Can this drop every VLAN-tagged frame destined for the CPU?

The layout comment in this file states that bytes 6-7 carry PCP/CFI/VID and
are "only meaningful when the VLAN-info bit is set", so the hardware appears
to move the frame's VLAN identity out of the frame body and into the tag.

The SDSA layout looks like a close relative of Marvell (E)DSA: proprietary
EtherType, two reserved bytes, command in bits 7-6 of the first tag byte,
port in bits 7-3 of the second byte, and the VLAN indication in bit 5.  In
tag_dsa.c that bit means the frame arrived VLAN-tagged and the tagger
reconstructs the 802.1Q header rather than dropping the frame:

net/dsa/tag_dsa.c:dsa_rcv_ll() {
	...
	if (dsa_header[0] & 0x20) {
		u8 new_header[4];

		/* Insert 802.1Q ethertype and copy the VLAN-related
		 * fields, but clear the bit that will hold CFI (since
		 * DSA uses that bit location for another purpose).
		 */
		new_header[0] = (ETH_P_8021Q >> 8) & 0xff;
		new_header[1] = ETH_P_8021Q & 0xff;
		new_header[2] = dsa_header[2] & ~0x10;
		new_header[3] = dsa_header[3];
	...
}

If the SoC-e core sets bit 5 for ordinary tagged ingress in any supported
configuration, all such traffic towards the CPU is freed here.  The driver
added later in the series only programs SOCE_TAG_ALL_FRAMES_ENABLE and
SOCE_CUSTOM_RULES_TAGGING_ENABLE in soce_sw_enable_tagging() and implements
no VLAN operations at all, so nothing turns this hardware behaviour off.
Is it known that the core never sets that bit?

The drop itself is a bare kfree_skb() with no drop reason, counter, or
ratelimited message, so from userspace the resulting loss is hard to tell
apart from a link or MAC problem.  Would kfree_skb_reason() be worth using
for these paths?

On the transmit side, sdsa_xmit() writes tag->vlan = 0 with the VLAN-info
bit left clear while any 802.1Q header stays inline in the payload.  If the
switch expects the egress VLAN identity in the tag, as the Marvell-style
parts do in tag_dsa.c:

net/dsa/tag_dsa.c:dsa_xmit_ll() {
	...
	if (skb->protocol == htons(ETH_P_8021Q) &&
	    (!br_dev || br_vlan_enabled(br_dev))) {
		...
		dsa_header[0] = (cmd << 6) | 0x20 | tag_dev;
	...
}

would FROM_CPU frames then be injected as untagged/PVID-assigned with the
inline 802.1Q header treated as opaque payload?

The commit message does say the field could not be tested:

    SDSA VLAN metadata generation could not be tested on the available
    switch configuration yet. Leave these fields clear on transmit and
    reject receive headers which mark the metadata as valid.

Could the receive side pass such frames up (or at least count them) instead
of discarding them, so an untested field does not turn into silent packet
loss?

> +
> +	/* Determine the source port from the two port fields. */
> +	source_port = FIELD_GET(SDSA_TAG_PORT_HI_MASK,
> +				tag->frame_type_port_hi) <<
> +		      SDSA_TAG_PORT_HI_SHIFT;
> +	source_port |= FIELD_GET(SDSA_TAG_PORT_LO_MASK, tag->port_lo);
> +
> +	skb->dev = dsa_conduit_find_user(dev, 0, source_port);
> +	if (!skb->dev)
> +		goto out_drop;

[ ... ]

> +out_drop:
> +	kfree_skb(skb);
> +	return NULL;
> +}

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260903-devel-vstrassheim-soce-dsa-ml-v2-0-fb0587cb466b%40linutronix.de

  reply	other threads:[~2026-09-09 12:12 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03 18:10 [PATCH net-next v2 0/4] net: dsa: Add SoC-e DSA driver Vasilij Strassheim
2026-09-03 18:10 ` [PATCH net-next v2 1/4] dt-bindings: vendor-prefixes: Add soce Vasilij Strassheim
2026-09-07  9:14   ` Krzysztof Kozlowski
2026-09-03 18:10 ` [PATCH net-next v2 2/4] dt-bindings: net: dsa: Add SoC-e SWIP switch Vasilij Strassheim
2026-09-07  9:21   ` Krzysztof Kozlowski
2026-09-07 14:01     ` Vasilij Strassheim
2026-09-07 18:56       ` Andrew Lunn
2026-09-08 10:16         ` Vasilij Strassheim
2026-09-08 10:29         ` Kurt Kanzenbach
2026-09-08  9:14       ` Krzysztof Kozlowski
2026-09-08 10:09         ` Vasilij Strassheim
2026-09-07 19:04   ` Andrew Lunn
2026-09-07 19:09     ` Andrew Lunn
2026-09-08 18:15     ` Vasilij Strassheim
2026-09-08 19:10       ` Andrew Lunn
2026-09-09 18:46         ` Vasilij Strassheim
2026-09-10 12:12           ` Andrew Lunn
2026-09-03 18:11 ` [PATCH net-next v2 3/4] net: dsa: Add tag handling for SoC-e switches Vasilij Strassheim
2026-09-09 12:12   ` netdev-bot+sashiko [this message]
2026-09-03 18:11 ` [PATCH net-next v2 4/4] net: dsa: soce: Add basic support for SoC-e switch IP cores Vasilij Strassheim
2026-09-07 19:28   ` Andrew Lunn
2026-09-08 18:44     ` Vasilij Strassheim
2026-09-08 19:20       ` Andrew Lunn
2026-09-09 19:28         ` Vasilij Strassheim
2026-09-10 12:18           ` Andrew Lunn
2026-09-08  0:37   ` Andrew Lunn
2026-09-10 13:01     ` Vasilij Strassheim
2026-09-10 15:07       ` Andrew Lunn
2026-09-11 13:39         ` Vasilij Strassheim
2026-09-08  8:25   ` Kurt Kanzenbach
2026-09-08 10:12     ` Vasilij Strassheim
2026-09-09 12:12   ` netdev-bot+sashiko
2026-09-07  9:10 ` [PATCH net-next v2 0/4] net: dsa: Add SoC-e DSA driver Krzysztof Kozlowski

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=178895594594.219967.10703472718792333808@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=b.spranger@linutronix.de \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=martin.kaistra@linutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    --cc=v.strassheim@linutronix.de \
    /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®