From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=68.232.153.233 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796029422; b=DF7pJIsLrfqxOe0lc41Uvfsu0G3kNPJpPSespvZ/BIXdB7I4i5UI8ZKGCGzappZ6Ae/q ipAtQI6XzB7cOyMbHkxqGC/ef9EZpM/Ni5b5wXwd+EJ/c54frDMH4QJcJ5Q3fSUKFGaC0 th83+nsu2HbVyDNoITz8ArnzzKPFZMQYeSxwE+ilr4nmwwWNSg4/eSgKVg0I98kDXQKbJ RedvUxrpJU485n8HLg2lDREj2aRES4QoatlL+OyuIQiRv6PZTj43Pwh8fCbqZo4U7MITd K7ueTNQ+ED+HJpDGNRYIUPxouHtZA+SgTWHt6KGTBuxYZnkkpY9CcWiyPUbgMIMJNfg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796029422; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-Amp-Result:Received:Received:Received:MIME-Version: Content-Transfer-Encoding:Content-Type:Date:Message-ID:CC:From:To: Subject:X-Mailer:References:In-Reply-To; bh=vIhnEJgyxHWTo5uVtGXp9a9ekpfO5jWkKppvNliXrJQ=; b=3MfV/mSBStfBBy86WCvTHVGc39bgUsaIAA0RmMoA6Mh2jQJA7wSYuoreLLhvM3XLkiI/ QYao82AspOMqstrorwMmhjc3qS7tmOH14IWmH16Q8dJntwsyVghGxiL9J+6+pFPx2oVpv VMtdilnLsSAl6Fp9PlnuaFsFYMrPaPhOzuHrKJBZZj/D6Mlg31C1WEBP4rrBjh8W/IoRZ 4tMljLuIKUME0yL3Eu0eTl83GFOGuqRN/jOjADeY8eZGcU8xZQzs6fUSNQYE8is4JlAQw S7U87fgORj6/M/E4VnTGQXAOwSy1+qkWyDWZhZDa3yT7MF0z5gXz03V9OHeAonFpiLw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=microchip.com; spf=pass smtp.mailfrom=microchip.com; dkim=pass header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=cwP08byh; arc=none smtp.remote-ip=68.232.153.233 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FD1A606A320; Mon, 30 Nov 2026 09:03:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4FD1A606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=cwP08byh DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1796029422; x=1827565422; h=mime-version:content-transfer-encoding:date:message-id: cc:from:to:subject:references:in-reply-to; bh=L0XfYZejrmgXDIneyJqRNwFRwl6SS6zKVrfmQQ7lQ20=; b=cwP08byhhRsmbRCvaAZ3MMTuehCyciW3pzEyD/UF1/MUL2PlLl7czsCO DMsVF8DNJd53QN+d4VAuMI7/5HDg8iR1BE5IDVcl6UnEnYeOydNErw/2m WIq14Z0HiNKZL70BO1zOOS9cWIctetk3AOdKXYQQxGkI63MDUzsKfCU/W /MFktK9S4A8BtXBO8OTHI7TNYjFyRLKk+xKcI1TXCu5NmaxMfSzc3M6dM JtBu3UO7P6ZZd6DTZgs2vcpcnnvAuZX8rrQ80ypaW4IpaXuh3+K+FrdtU 5oA0jVn3ZQnVu7UaWsZhtw4+nIqd2lE3nvoNFx322eSmpVoLj3Z9gwF1V w==; X-CSE-ConnectionGUID: glcFoKqYQ6eL5mD9TpnOKQ== X-CSE-MsgGUID: mpZceOzQStSbV3GcpV8h2Q== X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; d="scan'208";a="298622055" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 02:03:41 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.87.151) by chn-vm-ex1.mchp-main.com (10.10.87.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.2562.57; Mon, 30 Nov 2026 02:03:40 -0700 Received: from localhost (10.10.85.11) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.58 via Frontend Transport; Mon, 30 Nov 2026 02:03:40 -0700 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Date: Mon, 30 Nov 2026 10:03:39 +0100 Message-ID: CC: , , , , , , , , , From: =?utf-8?q?Jens_Emil_Schulz_=C3=98stergaard?= To: , Subject: Re: [PATCH net-next v2 5/5] net: dsa: lan9645x: add bridge support X-Mailer: aerc 0.21.0 References: <20261127-dsa-lan9645x-add-vlan-and-bridge-offload-v2-5-84adcd919dac@microchip.com> <179585821765.3135.11957570145287110531@kernel.org> In-Reply-To: <179585821765.3135.11957570145287110531@kernel.org> On Sat Nov 28, 2026 at 10:30 AM CET, netdev-bot+sashiko wrote: > Thank you for your contribution! Sashiko AI review found 2 potential > issue(s) to consider. > > Critical: 0 =C2=B7 High: 0 =C2=B7 Medium: 1 =C2=B7 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 patchwor= k > know by including "pw-bot: cr" as a separate line at the end of your repl= y > (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=E2=80=A6 > - [Low] In lan9645x_port_mdb_add(), the existing `mdb->vid > VLAN_MAX` > check (returns -EOPNOTSUPP) runs before the new=E2=80=A6 > > -- > > 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/driver= s/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 =3D=3D 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 =3D switchdev_port_attr_set(br->dev, &attr, extack); > if (err && err !=3D -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? > No, it is not enough, and the commit message says so. The driver refuses to join a VLAN-aware 802.1ad bridge, and vlan_filtering changes are refused while ports are bridged, so a protocol change on a bridge that is already VLAN-aware is the only case left. The driver cannot see that change, since net/dsa does not handle SWITCHDEV_ATTR_ID_BRIDGE_VLAN_PROTOCOL. This applies to every DSA driver that only supports 802.1Q bridges. Refusing the change or passing it to drivers is a DSA core change, which I think belongs in its own patch rather than in this series. > [ ... ] > >> @@ -503,6 +844,9 @@ static int lan9645x_port_mdb_add(struct dsa_switch *= ds, int port, >> if (mdb->vid > VLAN_MAX) >> return -EOPNOTSUPP; >> =20 >> + 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 404= 0 > > 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. > > [ ... ]