Re: [PATCH net-next 5/5] net: dsa: lan9645x: add bridge support
From: netdev-bot+sashiko
Date: Wed Nov 25 2026 - 03:58:44 EST
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?
[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?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124-dsa-lan9645x-add-vlan-and-bridge-offload-v1-0-b930a1dae700%40microchip.com