mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: jensemil.schulzostergaard@microchip.com
Cc: UNGLinuxDriver@microchip.com, andrew@lunn.ch, olteanv@gmail.com,
	davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, woojung.huh@microchip.com,
	linux@armlinux.org.uk, Steen.Hegelund@microchip.com,
	daniel.machon@microchip.com, geert+renesas@glider.be,
	magnus.damm@gmail.com, edumazet@kernel.org,
	richardcochran@gmail.com, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH net-next v15 8/9] net: dsa: lan9645x: add bridge support
Date: Mon, 19 Oct 2026 10:08:51 +0000	[thread overview]
Message-ID: <179240453125.3135.11938999224472029303@kernel.org> (raw)
In-Reply-To: <20261015-dsa_lan9645x_switch_driver_base-v15-8-562f316f78b9@microchip.com>

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

Critical: 0 · High: 1 · Medium: 0 · 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).

- [High] The 802.1Q-only restriction can be bypassed by changing the
  bridge's vlan_protocol after the port has joined.

--

net: dsa: lan9645x: add bridge support

This adds hardware offload of a single bridge to the lan9645x DSA
driver. It covers ageing time, bridge port flags, STP state handling and
host flooding. Joining a VLAN-aware bridge whose vlan_protocol is not
802.1Q is refused at join time.

> diff --git a/drivers/net/dsa/microchip/lan9645x/lan9645x_main.c b/drivers/net/dsa/microchip/lan9645x/lan9645x_main.c
> index d2e8c52e2a178..c6371a7b9a52a 100644
> --- a/drivers/net/dsa/microchip/lan9645x/lan9645x_main.c
> +++ b/drivers/net/dsa/microchip/lan9645x/lan9645x_main.c

[ ... ]

> +static int lan9645x_port_bridge_join(struct dsa_switch *ds, int port,
> +				     struct dsa_bridge bridge,
> +				     bool *tx_fwd_offload,
> +				     struct netlink_ext_ack *extack)
> +{
> +	struct lan9645x *lan9645x = ds->priv;
> +	struct lan9645x_port *p;
> +
> +	if (!lan9645x_bridge_vlan_proto_ok(bridge.dev)) {
> +		NL_SET_ERR_MSG_MOD(extack,
> +				   "Only 802.1Q VLAN-aware bridges are supported");
> +		return -EINVAL;
> +	}

[Severity: High]
Can the 802.1Q-only restriction be bypassed by changing vlan_protocol
after the port has joined?

lan9645x_bridge_vlan_proto_ok() is only checked in two places. One is
here, at join time. The other is lan9645x_port_vlan_filtering(). DSA
only calls lan9645x_port_vlan_filtering() when the filtering state
changes, because dsa_port_vlan_filtering() returns early when
dsa_port_is_vlan_filtering(dp) already matches.

A protocol change goes through __br_vlan_set_proto():

net/bridge/br_vlan.c:__br_vlan_set_proto() {
	struct switchdev_attr attr = {
		.orig_dev = br->dev,
		.id = SWITCHDEV_ATTR_ID_BRIDGE_VLAN_PROTOCOL,
		.flags = SWITCHDEV_F_SKIP_EOPNOTSUPP,
    ...
	err = switchdev_port_attr_set(br->dev, &attr, extack);
	if (err && err != -EOPNOTSUPP)
		return err;
    ...
	br->vlan_proto = proto;
    ...
}

Only mlxsw and mlx5 handle SWITCHDEV_ATTR_ID_BRIDGE_VLAN_PROTOCOL. DSA
has no case for it and returns -EOPNOTSUPP. The bridge then commits the
new protocol, and lan9645x never sees the change.

br_changelink() also handles IFLA_BR_VLAN_FILTERING before
IFLA_BR_VLAN_PROTOCOL. So both of these sequences look like they end up
with an offloaded VLAN-aware 802.1ad bridge:

  ip link set br0 type bridge vlan_filtering 1 vlan_protocol 802.1ad

  ip link set br0 type bridge vlan_protocol 802.1ad
  (on a bridge that already has vlan_filtering 1)

In the first case, lan9645x_port_vlan_filtering() runs while
br->vlan_proto is still 802.1Q, so the check passes.

The hardware then keeps its 802.1Q setup in ANA_VLAN_CFG: VLAN aware,
C-tag type, pop count 1. Would it then classify customer 0x8100-tagged
frames by the C-VID the sender chose, and forward them in hardware to
members of that VID?

Under 802.1ad, the software bridge treats that tag as payload and puts
the frame in the port PVID (the S-VLAN). If the hardware classifies by
the C-VID instead, S-VLAN isolation breaks for traffic arriving from
the wire.

The v15 changelog says VLAN-aware bridges whose vlan_protocol is not
802.1Q are refused. Does this need handling for protocol changes, rather
than only the join-time check? Two options would be a veto from a
switchdev or netdev notifier, or a DSA hook for
SWITCHDEV_ATTR_ID_BRIDGE_VLAN_PROTOCOL.

The later patch in the series, "net: dsa: lan9645x: add port
statistics", only adds statistics and does not change this logic.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261015-dsa_lan9645x_switch_driver_base-v15-0-562f316f78b9%40microchip.com

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

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15  8:05 [PATCH net-next v15 0/9] net: dsa: add DSA support for the LAN9645x switch chip family Jens Emil Schulz Østergaard
2026-10-15  8:05 ` [PATCH net-next v15 1/9] net: dsa: add tag driver for LAN9645X Jens Emil Schulz Østergaard
2026-10-19 10:08   ` netdev-bot+sashiko
2026-10-15  8:05 ` [PATCH net-next v15 2/9] dt-bindings: net: dsa: add Microchip LAN9645x switch Jens Emil Schulz Østergaard
2026-10-19 10:08   ` netdev-bot+sashiko
2026-10-15  8:05 ` [PATCH net-next v15 3/9] net: dsa: lan9645x: add autogenerated register macros Jens Emil Schulz Østergaard
2026-10-15  8:05 ` [PATCH net-next v15 4/9] net: dsa: lan9645x: add basic dsa driver for LAN9645X Jens Emil Schulz Østergaard
2026-10-19 10:08   ` netdev-bot+sashiko
2026-10-15  8:05 ` [PATCH net-next v15 5/9] net: dsa: lan9645x: add vlan support Jens Emil Schulz Østergaard
2026-10-19 10:08   ` netdev-bot+sashiko
2026-10-15  8:06 ` [PATCH net-next v15 6/9] net: dsa: lan9645x: add mac table integration Jens Emil Schulz Østergaard
2026-10-15  8:06 ` [PATCH net-next v15 7/9] net: dsa: lan9645x: add mdb management Jens Emil Schulz Østergaard
2026-10-19 10:08   ` netdev-bot+sashiko
2026-10-15  8:06 ` [PATCH net-next v15 8/9] net: dsa: lan9645x: add bridge support Jens Emil Schulz Østergaard
2026-10-19 10:08   ` netdev-bot+sashiko [this message]
2026-10-15  8:06 ` [PATCH net-next v15 9/9] net: dsa: lan9645x: add port statistics Jens Emil Schulz Østergaard
2026-10-19 10:08   ` netdev-bot+sashiko

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=179240453125.3135.11938999224472029303@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=Steen.Hegelund@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=daniel.machon@microchip.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=horms@kernel.org \
    --cc=jensemil.schulzostergaard@microchip.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=magnus.damm@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=robh@kernel.org \
    --cc=woojung.huh@microchip.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

all inboxes | Powered by JetHome®