🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23829

Re: [PATCH net-next v2 5/5] net: dsa: lan9645x: add bridge support

#23829
From: netdev-bot+sashiko
Date: Sat, 28 Nov 2026 09:30
133 lines
12775 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

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

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] The 802.1Q-only restriction for VLAN-aware bridges is checked
  only when a port joins, in lan9645x_port_bridge_join() through…
- [Low] In lan9645x_port_mdb_add(), the existing `mdb->vid > VLAN_MAX`
  check (returns -EOPNOTSUPP) runs before the new…

--

net: dsa: lan9645x: add bridge support

This adds hardware bridge offload to the lan9645x DSA driver. Up to 8
bridges are supported, each VLAN-unaware bridge gets its own reserved VID,
and at most one bridge can be VLAN-aware. The patch adds STP, learning,
flooding, host flood and ageing support, and refuses vlan_filtering
changes while ports are bridged. It also does not install FDB or MDB
entries that carry a VID on a VLAN-unaware bridge.

> diff --git a/drivers/net/dsa/microchip/lan9645x/lan9645x_main.c b/drivers/net/dsa/microchip/lan9645x/lan9645x_main.c
> index e840de1c918ba..94b46082cf5c4 100644
> --- a/drivers/net/dsa/microchip/lan9645x/lan9645x_main.c
> +++ b/drivers/net/dsa/microchip/lan9645x/lan9645x_main.c

[ ... ]

> +static bool lan9645x_bridge_vlan_proto_ok(const struct net_device *br)
> +{
> +	u16 proto;
> +
> +	return !br_vlan_enabled(br) || br_vlan_get_proto(br, &proto) ||
> +	       proto == ETH_P_8021Q;
> +}

[ ... ]

> +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)
> +{

[ ... ]

> +	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: Medium]
Is checking the protocol only in lan9645x_port_bridge_join() enough to
keep the hardware and the software bridge in agreement?

Once a port has joined, a protocol change goes through
__br_vlan_set_proto() in net/bridge/br_vlan.c:

	err = switchdev_port_attr_set(br->dev, &attr, extack);
	if (err && err != -EOPNOTSUPP)
		return err;

The attribute is sent with SWITCHDEV_F_SKIP_EOPNOTSUPP. net/dsa/ has no
handler for SWITCHDEV_ATTR_ID_BRIDGE_VLAN_PROTOCOL, so a command like
"ip link set br0 type bridge vlan_protocol 802.1ad" succeeds on a
VLAN-aware bridge that already has lan9645x ports.

After that, the hardware still treats 0x8100 tags as VLAN tags, but the
software bridge uses 802.1ad. Take a 0x8100-tagged VID 20 frame that
arrives on a port with pvid 10, where the port is also a member of VLAN
20. The hardware forwards it in VLAN 20, but the bridge policy would
classify it to VLAN 10.

The commit message mentions this limitation:

  DSA does not pass SWITCHDEV_ATTR_ID_BRIDGE_VLAN_PROTOCOL to drivers,
  so a protocol change on a bridge that is already VLAN-aware is not
  seen.

It also says "Only bridge vlan_protocol 802.1Q is offloaded", but that
restriction can be bypassed after the join. Should the DSA core either
pass this attribute to drivers or refuse the change while ports are
offloaded?

[ ... ]

> @@ -503,6 +844,9 @@ static int lan9645x_port_mdb_add(struct dsa_switch *ds, int port,
>  	if (mdb->vid > VLAN_MAX)
>  		return -EOPNOTSUPP;
>  
> +	if (lan9645x_db_vid_unused(lan9645x, mdb->vid, &db))
> +		return 0;
> +

[Severity: Low]
Should lan9645x_db_vid_unused() be checked before the VLAN_MAX check
here?

On a VLAN-unaware bridge, an MDB entry with a VID in 4032..4094 gets
-EOPNOTSUPP on add. lan9645x_port_mdb_del() has no range check and
returns 0 through lan9645x_db_vid_unused().

That does not match the commit message, which says "3) An MDB entry can
be added with any VID" and "they are accepted without being installed".
It also does not match the comment above lan9645x_db_vid_unused():

  so a delete skips exactly the entries that the add skipped.

br_mdb_add() does not check the VID against the VLAN group when
vlan_filtering is off, so a command like this reaches the driver:

  bridge mdb add dev br0 port br0 grp 01:00:5e:01:01:01 permanent vid 4040

For a host MDB the add fails, so dsa_port_do_mdb_add() never adds a
dsa_mac_addr to cpu_dp->mdbs. The later delete then fails in
dsa_port_do_mdb_del() with -ENOENT, and switchdev_port_obj_del_deferred()
logs it as an error.

The hardware ends up the same either way, since the entry is never
installed.

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261127-dsa-lan9645x-add-vlan-and-bridge-offload-v2-0-84adcd919dac%40microchip.com
Technical Details
Message-ID: <179585821765.3135.11957570145287110531@kernel.org>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!srl.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-373075-linux-kernel-netdev=dewy.ru
References: <20261127-dsa-lan9645x-add-vlan-and-bridge-offload-v2-5-84adcd919dac@microchip.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!srl.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-373075-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2 5/5] net: dsa: lan9645x: add bridge support
Date: Sat, 28 Nov 2026 09:30:17 +0000
Organization: Usenet Network
Message-ID: <179585821765.3135.11957570145287110531@kernel.org>
References: <20261127-dsa-lan9645x-add-vlan-and-bridge-offload-v2-5-84adcd919dac@microchip.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="922395"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ATSByE+dFsc8es2UCfKqsWmTpUI= sha256:+ZPg8tf78WRPD//lPhb1cBmyXCpk9NidHKse7L653hQ=
	sha1:1EOo1xFelvx1h+ugB4Th8yaVTio= sha256:cLdTagETHb/GnyADW+OvbXr+XJXdonnQaLD8smG43hk=
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 AAE0E125F6D; Sat, 28 Nov 2026 12:31:04 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31
	tests=[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]
	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 EAigX6tU1ziW;
	Sat, 28 Nov 2026 12:31:01 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-373075-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 2821C125F70; Sat, 28 Nov 2026 12:30:52 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id C9C322D129; Sat, 28 Nov 2026 09:30:34 +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=1795858225;
	b=r+oGnd99ejI3FNTvOd0uPcPLW+V1atAiEt4P4yX6PPFqiokb9kteQ+m8SzqmaYrAHEoe
	 2Mry7Y6LaLS2e/3BSJSnLXRfVCGyvbhMa6jSDfkHcpV36yWXmquHiElo1H1aWA7E94u0u
	 mzimuL9K85l1uHzljl5ghWsTcvVaU04SmnCK4s3rl44LINrSNysWEmybFfWy18O7H6/DO
	 5Kbc1NgT6PEsUSCdPj9auE4lThkoz1scZ1RaIiiCEViS1C3HL9ynSP9dIHkQv7CaUV6cb
	 auAO3QTW+9a5rvSIZ47uaznzHqCASfrXKKHweHVYtUcqytcQ0x/ZLXv5m006U1TtGhA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795858225;
	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=1NdFSc4Q5nm/FDad+O4eAYEhWlUETJkfgU3eFUfziiE=;
	b=lXAJXjPfanyF9W9O2098wU4q5Yq9GyNV/kBk7w1s2iWEPeqcj6AeR/NTZNeOwgIydplS
	 W0Oe6u92ATa1VNcvWxcKLgEEQXvRfo7OcJZflybfRVFwBd05UQ9nED3uamDG1gIw9rHGU
	 9qHEA86aRxaVnZoRL1WO2FzWfJbQZLnjsE4Esn95Bo/GTR260gBxkRmkMgISILBBD6xqU
	 qPWZ2ZDbzWnWzOoy0qnrPPhUUERrLKmAygW2OewzyLrDzo8zFVAunUryyqH8H3u7ldYsB
	 p0CnUu9yZEd9d/heQrvujzHUefdLIdgKfGCQXXqW6m0EcRA9sgRTkwQO8yAlZstIXTQ==
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=MzDkb99T;
	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 1041E606A689;
	Sat, 28 Nov 2026 09:30:25 +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=MzDkb99T
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=1795858219;
	b=gv/hyFZroD3T31U5mU8P1K1hwTOat5WJfMKxRIxt4mpQTzITtjItIOnCN6MFEfs+lf9T
	 n+KF6FoAUkgC0ADL1jCIFLESAmbLI1m2xLCKB/oMVe6CPn4eqpyY5xgqs1+HC+DSXq1CM
	 s52Zm3T6KfFYuiGEgc6VbKQFb21o0xC6Ff9tYjW+MKwFVtQsb4OtJwWH6M7/JD9iUOy4B
	 QeDaqUb6NrgJtchMA+V0tg7UCN7Ay3zKRV96zDql0ZltkIyAR4WoOslOVsURdhFYf4t0N
	 4/Kcxbcu3izyypNHw7dypXGDigZowgN+WyPsDkIyqmaqwKExkml4Q+X6dECvMsZ6JvA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795858219;
	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=1NdFSc4Q5nm/FDad+O4eAYEhWlUETJkfgU3eFUfziiE=;
	b=fAIaHkPMB6t6PMI8X4VMLGRSngQlaG6UzPNtRlPvhb0j3hECadXShiDO+RQLjlNJMCQw
	 dc8NEvJ/ZPRH3pwwpGACuo0OwvrTL7IX8SO/h0Een03rtyRgLWlb2du/foHMRvGp+yclT
	 t5AJYvgOnaiG7ZRshQqttYx8OfFwfLx1Y9bT1kvG+cIVVeLYMemxT59n29j81msIPyZrn
	 mijRSrh0qxiQp0NnAwyTuGHXYXzBi3WzYbuYG6WuB3IhnyOuFSsAMA7zDZtIhVEsSx86o
	 KhwtQTKvphcrE0qkjUG4tcnb6FiwJADpsx6N8OOF37oikXC0uydQqSuhAFE1AjqexLQ==
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=MzDkb99T;
	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 316E4606A68D;
	Sat, 28 Nov 2026 09:30:18 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2360D1F00897;
	Sat, 28 Nov 2026 09:30:18 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795858218;
	bh=1NdFSc4Q5nm/FDad+O4eAYEhWlUETJkfgU3eFUfziiE=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=MzDkb99TYZP55O+y5EEc2+XLVzozaw5R+MsqdFl6y58L/dHjIhssXH0wFvW1g8wRC
	 +8Z5NgTAIleI9C2nU6kaRGpwUyZtt/MT3uvxCCwRuv0Ttu/J4nUDAxsW1eU1Xq/J7j
	 XRj4ZFBsCDTy8czuzHWsNbTVtxMkhaXiIeY2wWxmTXBKlYow46Hc1tGQuRlOyo6xAw
	 guWI3RgdcRQJMbgD3bLjHX8grfeaSgw2p65LRiNBAeuLuSOmBYg2qlUeL/oRDq7dt7
	 3mPw4UcrnKV/gC7n90JMRFRpzN0Tq9g90mAGo2ij9WD5YFnSVhCHCUR3a/5XopBgVY
	 ZwL9QqlLEOrzg==
X-Cc: UNGLinuxDriver@microchip.com, andrew@lunn.ch, olteanv@gmail.com,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 linux@armlinux.org.uk, linux-kernel@vger.kernel.org, netdev@vger.kernel.org
X-In-Reply-To: <20261127-dsa-lan9645x-add-vlan-and-bridge-offload-v2-5-84adcd919dac@microchip.com>
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