๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #4825

Re: [PATCH net-next v15 8/9] net: dsa: lan9645x: add bridge support

#4825
From: netdev-bot+sashiko
Date: Mon, 19 Oct 2026 10:08
108 lines
9971 bytes
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
Technical Details
Message-ID: <179240453125.3135.11938999224472029303@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348401-linux-kernel-netdev=dewy.ru
References: <20261015-dsa_lan9645x_switch_driver_base-v15-8-562f316f78b9@microchip.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348401-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v15 8/9] net: dsa: lan9645x: add bridge support
Date: Mon, 19 Oct 2026 10:08:51 +0000
Organization: Usenet Network
Message-ID: <179240453125.3135.11938999224472029303@kernel.org>
References: <20261015-dsa_lan9645x_switch_driver_base-v15-8-562f316f78b9@microchip.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3568672"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Qn3vMtdg5AA4QUe1tHur1TwKunY= sha256:twEHwujSaxUuJTMRGgKfj93YUITPwZ91CUjXSjO9pnA=
	sha1:hBlII8LlKfvy5GfO43lbYf3XwKg= sha256:CVrjrR6tguNKeqZFhxoSAyYFTsQqH5SEO2yQ6oQLK7g=
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 0E71011097F; Mon, 19 Oct 2026 13:10:50 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.829
X-Spam-Status: No, score=-3.829 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.329, 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 5XnAHbUsBp1i;
	Mon, 19 Oct 2026 13:10:47 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-348401-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 0B34111093F; Mon, 19 Oct 2026 13:10:39 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by sto.lore.kernel.org (Postfix) with ESMTP id A824E60AFA2; Mon, 19 Oct 2026 10:09:36 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 833E24D9568;
	Mon, 19 Oct 2026 10:08:54 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ONDL/pxl"
X-Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E8894D7D5E;
	Mon, 19 Oct 2026 10:08:53 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1792404534; cv=none; b=Te7aQMUsq2ob1gVaFNdcaxQWuouvC6PduVNDZJxLc5EBChuasTHjwPDX1/Y6QC5y9t07fmrjAfatVe6i+saNDkZyXUeGE4liD1OzlJkj/FhOo8rlAQKP8L0iMeG+yJtD/dcUU0HO2dUXXeSyf67RcFEr+nu9b9POJ3ZqWNkVtXY=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1792404534; c=relaxed/simple;
	bh=/uWp582f+ldpsvdy4fm7swPZbqcNhxWaNp1L6ftY/rc=;
	h=Subject:From:To:Cc:Date:Message-ID:In-Reply-To:References:
	 Content-Type:MIME-Version; b=F+xZv4ycqSuue3FyWvDVriHbsM2s9n7D98hEyvIDUCoXY4IkMZZOmYaND6RllaC3Gqhagr0VMnxiveOXHfEB5RzepNTrjxMhAM+vhnnEuDd2RY9diO0By2aeQsbqQRhwN1cqwnMIW8E+6cItNpoDPTx8TMvnMFb/It0SRAv4nm8=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ONDL/pxl; arc=none smtp.client-ip=100.103.45.18
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA72B1F000C4;
	Mon, 19 Oct 2026 10:08:51 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792404532;
	bh=y0nubFCxnCOLOvPV9BUK73w27Jqvlztfy1Qf6IkT+H0=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=ONDL/pxlS590MKOcn9JBW4O3cw63KrDuvPkLtZau2HjRce6i+JwY4sSqLbLgAZTib
	 kesxZSFVblPryH28kLUgHjwSuKVsrHCS9+Bx5klZCw0IY9PhXawmYEGRDfG6a1JQtR
	 v7rL6qLvBE+JtlaKO783YTfNYnbrFRREuQv3+Js1GY9rV7SCajGF37NSXZpMQtv9ms
	 e3Jr5tDpO02PjXE6AKeTThLNNNFilsG8edifiGEtXo+HO5y8XL0Yk+qDsu3QCi5Rtn
	 L/E0rXp1PpWikM8G5y3s+D7PY6qmqKzWaJvyylnHUqaOxluekGq1h5i+qt1Klb6SsF
	 qibPkJqiOgHFw==
X-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
X-In-Reply-To:  <20261015-dsa_lan9645x_switch_driver_base-v15-8-562f316f78b9@microchip.com>
X-sashiko-severity: High
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>