struct dsa_bridge is shared by the ports of all switches of a tree that are in the bridge, and dsa_port_bridge_join() overwrites its tx_fwd_offload with the answer of the switch whose port joins. mv88e6xxx offloads TX forwarding only on a chip with a PVT, where it maps the bridge as a virtual device, and on leave remaps that device only if bridge.tx_fwd_offload is set. In a tree with one chip that has a PVT and one that does not, a port of the second joining the bridge after a port of the first clears the flag; when the port of the first chip then leaves, mv88e6xxx_port_bridge_leave() skips the remap, and the PVT row of the bridge's virtual device still lets FORWARD frames of the bridge out of the port that left. Only ever set the shared flag on join, and offload TX forwarding to the bridge port by the port's own answer, as before 857fdd74fb38. On a chip without a PVT the remap on leave does nothing (mv88e6xxx_pvt_map() returns early). Fixes: 857fdd74fb38 ("net: dsa: eliminate dsa_switch_ops :: port_bridge_tx_fwd_{,un}offload") Signed-off-by: Julius Bairaktaris --- v2: new, from the Sashiko review of v1 4/6. net/dsa/port.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/net/dsa/port.c b/net/dsa/port.c index f71dfd78bf7c..7ebdc9ce6b92 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -521,13 +521,18 @@ int dsa_port_bridge_join(struct dsa_port *dp, struct net_device *br, if (err) goto out_rollback; - /* Drivers which support bridge TX forwarding should set this */ - dp->bridge->tx_fwd_offload = info.tx_fwd_offload; + /* Drivers which support bridge TX forwarding should set this. The + * bridge is shared by the ports of all switches of the tree: one + * switch whose port cannot offload TX forwarding must not clear what + * another switch's port set up and has to undo when it leaves. + */ + if (info.tx_fwd_offload) + dp->bridge->tx_fwd_offload = true; err = switchdev_bridge_port_offload(brport_dev, dev, dp, &dsa_user_switchdev_notifier, &dsa_user_switchdev_blocking_notifier, - dp->bridge->tx_fwd_offload, extack); + info.tx_fwd_offload, extack); if (err) goto out_rollback_unbridge; -- 2.53.0