Netdev List
 help / color / mirror / Atom feed
From: Nicolai Buchwitz <nb@tipi-net.de>
To: netdev-bot+sashiko@kernel.org, florian.fainelli@broadcom.com,
	justin.chen@broadcom.com
Cc: opendmb@gmail.com, bcm-kernel-feedback-list@broadcom.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, dave.stevenson@raspberrypi.com,
	pierremarinleclercq88@gmail.com, f.fainelli@gmail.com
Subject: Re: [PATCH net-next v3 6/8] net: bcmgenet: pad transmit frames out of the packet ready window
Date: Thu, 08 Oct 2026 12:03:45 +0200	[thread overview]
Message-ID: <a4d4a29095a7b68ae2345d35074f6e2c@tipi-net.de> (raw)
In-Reply-To: <179145241435.434549.3651092628869076790@kernel.org>

Hi Clashiko

On 8.10.2026 11:40, netdev-bot+sashiko@kernel.org wrote:

> [...]

> [Severity: Medium]
> 
> What happens here when the GENET is the conduit for a DSA switch that
> uses a tail tag? By the time the skb reaches bcmgenet_xmit(), the 
> tagger
> has already written the tag into the last bytes of the frame. This
> skb_put_padto() then appends zeros after the tag.
> 
> The DSA core pads before tagging so that the conduit never has to add
> bytes after a tail tag:
> 
> net/dsa/user.c:dsa_user_xmit() {
>     ...
> 	if (dev->needed_tailroom)
> 		eth_skb_pad(skb);
>     ...
> }
> 
> For KSZ9477-class switches the tag holds the egress port mask, the
> priority, and the override bit for link-local frames:
> 
> net/dsa/tag_ksz.c:ksz9477_xmit() {
>     ...
> 	if (is_link_local_ether_addr(hdr->h_dest))
> 		val |= KSZ9477_TAIL_TAG_OVERRIDE;
> 
> 	*tag = cpu_to_be16(val);
>     ...
> }
> 
> lan937x_xmit() also always sets LAN937X_TAIL_TAG_VALID.
> 
> After padding, would the switch read an all-zero tag in place of these
> fields, with the real tag left inside the payload? HSR/PRP RCT trailers
> look like they would be corrupted the same way.
> 
> The commit message says these protocols "see the zeros instead". The
> switch, though, would read the zeros as forwarding instructions: no 
> port
> mask, no override bit and no valid bit. Depending on the switch, the
> frame could be dropped, forwarded by address lookup or flooded, 
> whatever
> egress port the host chose. That could break standalone port isolation,
> and link-local frames would lose their forced egress port.
> 
> This path opens up once later patches in the series raise max_mtu. If a
> user port MTU is raised above roughly 3806, dsa_user_change_mtu() calls
> dev_set_mtu(conduit, new_conduit_mtu), which moves the conduit into the
> MTU range that has the window. After that, whoever sends the traffic
> decides whether a frame lands in the window, for example through the 
> UDP
> datagram size, IP fragment tails, or forwarded traffic.
> 
> Instead of padding after the trailer, would it be safer to check
> netdev_uses_dsa() here and drop the frame? Another option would be to
> refuse conduit MTUs that reach the window.

I do not think genet is ever a DSA conduit with tail tags. At least none
of the boards I'm aware of + what appears in the tree...

Broadcom switches use a head tag, and genet already reserves
ENET_BRCM_TAG_LEN for it, so padding at the tail wont do any harm. On 
the
Broadcom SoCs that do have an integrated switch the conduit is 
SYSTEMPORT,
not genet, and that driver has the netdev_uses_dsa() checks.

Every tagger listed is a tail tagger for a switch family that is not 
paired
with genet. Reaching this would need an out of tree board wiring one 
behind
a genet SoC and raising the user port MTU past 3808 (not 3806)...

So I would keep the padding and the note in the commit message rather 
than
add a drop path for a configuration that does not exist?

The only other way (which I don't really like), would be to cap the MTU 
when
attached to dsa in _change_mtu():

	/* Padding a frame clear of the window would overwrite a DSA tail tag 
*/
	if (netdev_uses_dsa(dev) && new_mtu > ENET_MAX_PAD_FREE_MTU)
		return -EINVAL;

But if we do this, Clashiko would complain about the case where the dsa 
is
attached after the MTU is already set to something above the thresholds 
...

@Florian / Justin: Anything you are aware of in the stb universe?

Thanks,
Nicolai


  reply	other threads:[~2026-10-08 10:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07  8:51 [PATCH net-next v3 0/8] net: bcmgenet: support larger MTUs Nicolai Buchwitz
2026-10-07  8:51 ` [PATCH net-next v3 1/8] net: bcmgenet: ring the doorbell when the last frame of a batch is dropped Nicolai Buchwitz
2026-10-07  8:51 ` [PATCH net-next v3 2/8] net: bcmgenet: let the caller decide whether to start the PHY Nicolai Buchwitz
2026-10-07  8:51 ` [PATCH net-next v3 3/8] net: bcmgenet: allow a continuation descriptor without the alignment pad Nicolai Buchwitz
2026-10-07  8:51 ` [PATCH net-next v3 4/8] net: bcmgenet: rename ENET_MAX_MTU_SIZE to ENET_MAX_FRAME_LEN Nicolai Buchwitz
2026-10-07  8:51 ` [PATCH net-next v3 5/8] net: bcmgenet: derive the receive buffer length from the MTU Nicolai Buchwitz
2026-10-08  9:40   ` netdev-bot+sashiko
2026-10-08 10:07     ` Nicolai Buchwitz
2026-10-07  8:51 ` [PATCH net-next v3 6/8] net: bcmgenet: pad transmit frames out of the packet ready window Nicolai Buchwitz
2026-10-08  9:40   ` netdev-bot+sashiko
2026-10-08 10:03     ` Nicolai Buchwitz [this message]
2026-10-07  8:51 ` [PATCH net-next v3 7/8] net: bcmgenet: allow the MTU to be changed Nicolai Buchwitz
2026-10-08  9:40   ` netdev-bot+sashiko
2026-10-08 10:17     ` Nicolai Buchwitz
2026-10-07  8:51 ` [PATCH net-next v3 8/8] net: bcmgenet: reassemble jumbo frames from status block fragments Nicolai Buchwitz
2026-10-07  8:56 ` [PATCH net-next v3 0/8] net: bcmgenet: support larger MTUs netdev-bot+sinfo
2026-10-08  8:02   ` Nicolai Buchwitz

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=a4d4a29095a7b68ae2345d35074f6e2c@tipi-net.de \
    --to=nb@tipi-net.de \
    --cc=andrew+netdev@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=justin.chen@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=opendmb@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=pierremarinleclercq88@gmail.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