From: "Jens Emil Schulz Østergaard" <jensemil.schulzostergaard@microchip.com>
To: <netdev-bot+sashiko@kernel.org>,
<jensemil.schulzostergaard@microchip.com>
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>
Subject: Re: [PATCH net-next 5/5] net: dsa: lan9645x: add bridge support
Date: Wed, 25 Nov 2026 14:27:47 +0100 [thread overview]
Message-ID: <DN4BS3G13BGT.1VM1EI873BRWR@microchip.com> (raw)
In-Reply-To: <179559711039.3135.10067666642818194046@kernel.org>
On Wed Nov 25, 2026 at 9:58 AM CET, netdev-bot+sashiko wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential
> issue(s) to consider.
>
> Critical: 0 · High: 0 · Medium: 2 · 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).
>
> - [Medium] lan9645x_port_bridge_join()
> (drivers/net/dsa/microchip/lan9645x/lan9645x_main.c:544) stores…
> - [Medium] lan9645x_fdb_vid()
> (drivers/net/dsa/microchip/lan9645x/lan9645x_main.c:692) only switches…
>
> --
>
> net: dsa: lan9645x: add bridge support
>
> This adds hardware bridge offload to the lan9645x DSA driver. Each
> VLAN-unaware bridge gets its own reserved VID, and at most one bridge can
> be VLAN-aware. The CPU port is no longer in the default unicast and
> multicast flood masks; .port_set_host_flood adds it instead. The patch
> also adds ageing time configuration with min/max limits.
>
>> diff --git a/drivers/net/dsa/microchip/lan9645x/lan9645x_main.c b/drivers/net/dsa/microchip/lan9645x/lan9645x_main.c
>> index de432772f6399..a78410efb9730 100644
>> --- a/drivers/net/dsa/microchip/lan9645x/lan9645x_main.c
>> +++ b/drivers/net/dsa/microchip/lan9645x/lan9645x_main.c
>
> [ ... ]
>
>> @@ -306,6 +302,20 @@ static int lan9645x_setup(struct dsa_switch *ds)
>> ds->mtu_enforcement_ingress = true;
>> ds->assisted_learning_on_cpu_port = true;
>> ds->fdb_isolation = true;
>> + ds->max_num_bridges = ds->num_ports;
>
> [ ... ]
>
>> +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)
>> +{
>
> [ ... ]
>
>> + p = lan9645x_to_port(lan9645x, port);
>> +
>> + mutex_lock(&lan9645x->fwd_domain_lock);
>> +
>> + p->bridge_num = bridge.num;
>> + lan9645x_vlan_port_set_bridge_vid(p, !p->vlan_aware);
>
> [Severity: Medium]
> Can bridge.num be larger than num_phys_ports here?
>
> lan9645x_vlan_init() only adds the CPU port module to the reserved VIDs
> for bridge numbers 1..num_phys_ports:
>
> for (bridge_num = 1; bridge_num <= lan9645x->num_phys_ports;
> bridge_num++) {
> vid = lan9645x_vlan_unaware_pvid(bridge_num);
> lan9645x->vlans[vid].portmask = BIT(lan9645x->num_phys_ports);
> ...
> }
>
> Setting ds->max_num_bridges = ds->num_ports does not appear to limit the
> number the DSA core passes in. In net/dsa/dsa.c, dsa_bridge_num_get()
> first calls dsa_bridge_num_find(). That function searches every tree in
> dsa_tree_list and returns an existing number without comparing it to max.
> The "bridge_num > max" check only runs when a new number is allocated.
>
> Take a bridge that first gets a number N >= 10 from a switch in another
> DSA tree with a larger max_num_bridges (mv88e6xxx, sja1105 or vsc73xx).
> If a lan9645x port then joins the same bridge:
>
> lan9645x_port_bridge_join()
> p->bridge_num = N
> lan9645x_vlan_port_set_bridge_vid(p, true)
> vlans[VLAN_N_VID - N].portmask |= BIT(port)
> lan9645x_vlan_hw_wr()
> cpu_dis = !(v->portmask & BIT(lan9645x->num_phys_ports)); -> 1
>
> ANA_PGID_CFG_OBEY_VLAN is set for the destination PGIDs. Would that mean
> no frame classified to this VID is ever copied to the CPU? That would
> cover broadcast, host FDB/MDB entries pointing at PGID_CPU, and host
> flooding. The host stack and software forwarding to the other tree's
> ports would then stop working for that bridge.
>
> Should the join reject bridge.num > num_phys_ports, or should the
> reserved VID be set up when it is first used?
>
Yes this looks correct. v2 rejects a bridge number above max_num_bridges in
.port_bridge_join with -EOPNOTSUPP, so the port falls back to software bridging,
as when DSA runs out of bridge numbers.
> [Severity: Medium]
> Several bridges can now be offloaded at once. Does lan9645x_fdb_vid()
> still keep the FDB of a VLAN-unaware bridge separate from the FDB of the
> VLAN-aware bridge?
>
> It only maps vid == 0 to the bridge's reserved VID:
>
> drivers/net/dsa/microchip/lan9645x/lan9645x_main.c:lan9645x_fdb_vid() {
> if (vid)
> return vid;
>
> return lan9645x_vlan_unaware_pvid(db->type == DSA_DB_BRIDGE ?
> db->bridge.num : 0);
> }
>
> Take "bridge fdb add M dev swpB master static" on a port of
> VLAN-unaware bridge B. br_fdb_add() adds M@0, and also M@vid for every
> VLAN in the port's VLAN group. That includes the default pvid 1, which
> exists even with vlan_filtering=0:
>
> list_for_each_entry(v, &vg->vlan_list, vlist) {
> if (!br_vlan_should_use(v))
> continue;
> err = __br_fdb_add(ndm, br, p, addr, nlh_flags, v,
> nfea_tb, notified, extack);
>
> DSA passes vid 1 through unchanged, so lan9645x_fdb_add() calls
> lan9645x_mact_learn(lan9645x, port, M, 1, ENTRYTYPE_LOCKED).
>
> B never uses that entry, because its ports classify to the reserved VID.
> Now suppose VLAN-aware bridge A uses VID 1. Would frames to M in A hit
> this locked entry pointing at swpB and be dropped by A's PGID_SRC mask?
> The locked entry would also stop M from being learned on A's real port.
>
> A later fdb_del from B would remove the same hardware entry. That could
> also delete A's own static M@VID1 entry. lan9645x_host_addr_shared()
> only handles collisions between CPU host addresses, not entries for front
> ports.
>
> Before this patch there was no .port_bridge_join, so bridge-DB FDB
> entries never reached this helper. The commit message says the reserved
> VIDs keep the FDB domains apart, but these entries would still overlap.
>
> Should non-zero VIDs from a VLAN-unaware bridge's DB also be mapped to
> its reserved VID, or skipped?
The overlap exists, but it requires both a VLAN-aware and a VLAN-unaware bridge
and the same MAC to be a station in both bridges. As far as I can tell this
matches ocelot, which also offloads one VLAN-aware bridge next to VLAN-unaware
bridges and maps only VID 0 in the same way.
Changing the mapping at add time as suggested does not fix it. MAC table entries
are keyed by the VID the port classifies to, and that depends on vlan_filtering,
while the bridge does not notify the FDB entries again when vlan_filtering
changes. An entry added at VID V while a bridge is VLAN-aware stays at V after
the bridge turns VLAN-unaware, whatever the add path did.
Mapping or skipping non-zero VIDs of a VLAN-unaware bridge would instead leave
the entry missing after the bridge turns VLAN-aware.
prev parent reply other threads:[~2026-11-25 13:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 8:57 [PATCH net-next 0/5] net: dsa: lan9645x: add VLAN and bridge offload Jens Emil Schulz Østergaard
2026-11-24 8:57 ` [PATCH net-next 1/5] net: dsa: lan9645x: add the analyzer event register Jens Emil Schulz Østergaard
2026-11-24 8:57 ` [PATCH net-next 2/5] net: dsa: lan9645x: add vlan support Jens Emil Schulz Østergaard
2026-11-24 8:57 ` [PATCH net-next 3/5] net: dsa: lan9645x: add mac table integration Jens Emil Schulz Østergaard
2026-11-25 8:58 ` netdev-bot+sashiko
2026-11-24 8:57 ` [PATCH net-next 4/5] net: dsa: lan9645x: add mdb management Jens Emil Schulz Østergaard
2026-11-25 8:58 ` netdev-bot+sashiko
2026-11-25 13:13 ` Jens Emil Schulz Østergaard
2026-11-24 8:57 ` [PATCH net-next 5/5] net: dsa: lan9645x: add bridge support Jens Emil Schulz Østergaard
2026-11-25 8:58 ` netdev-bot+sashiko
2026-11-25 13:27 ` Jens Emil Schulz Østergaard [this message]
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=DN4BS3G13BGT.1VM1EI873BRWR@microchip.com \
--to=jensemil.schulzostergaard@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.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