sparx5_port_attr_set() is called through switchdev_handle_port_attr_set(), which passes the attributes of a bridge and its ports down through the uppers of a port. It applies every attribute it handles, without checking which bridge or bridge port it comes from. The port then also takes attributes from a bridge it is not offloaded in. They reach it through a VLAN upper of the port that is a port of another bridge, or through a bond with sparx5 members that the switch does not offload. The port takes that bridge's VLAN mode and ageing time, and the STP state, flood flags and multicast router state of the upper. For example, removing the VLAN upper from the other bridge sets the port to the disabled STP state, so it stops forwarding in the offloaded bridge. Apply the port attributes only when they come from the port itself, and the bridge attributes only when they come from the offloaded bridge. An ignored attribute returns -EOPNOTSUPP, as from any netdev that does not offload it, so the other bridge handles the VLAN upper or the bond like a software port. This is in preparation for LAG support, which follows in a later series. Signed-off-by: Daniel Machon --- This does not fix a regression, so it is targeted at net-next. --- .../ethernet/microchip/sparx5/sparx5_switchdev.c | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c b/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c index 322806fbfe2bb..9e85a746414c4 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_switchdev.c @@ -140,18 +140,39 @@ static int sparx5_port_attr_set(struct net_device *dev, const void *ctx, switch (attr->id) { case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS: + /* Ignore it from a bridge port other than the port itself */ + if (attr->orig_dev != dev) + return -EOPNOTSUPP; + return sparx5_port_attr_pre_bridge_flags(port, attr->u.brport_flags); case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS: + /* Ignore it from a bridge port other than the port itself */ + if (attr->orig_dev != dev) + return -EOPNOTSUPP; + sparx5_port_attr_bridge_flags(port, attr->u.brport_flags); break; case SWITCHDEV_ATTR_ID_PORT_STP_STATE: + /* Ignore it from a bridge port other than the port itself */ + if (attr->orig_dev != dev) + return -EOPNOTSUPP; + sparx5_attr_stp_state_set(port, attr->u.stp_state); break; case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME: + /* Ignore it from a bridge the switch does not offload */ + if (attr->orig_dev != port->sparx5->hw_bridge_dev) + return -EOPNOTSUPP; + sparx5_port_attr_ageing_set(port, attr->u.ageing_time); break; case SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING: + /* Ignore it from a bridge the port is not offloaded in */ + if (!test_bit(port->portno, port->sparx5->bridge_mask) || + attr->orig_dev != port->sparx5->hw_bridge_dev) + return -EOPNOTSUPP; + /* L3 offload requires a VLAN aware bridge. */ if (!attr->u.vlan_filtering) sparx5_rr_bridge_legs_flush(port->sparx5, @@ -173,6 +194,10 @@ static int sparx5_port_attr_set(struct net_device *dev, const void *ctx, sparx5_rr_legs_reconcile_schedule(port->sparx5); return -EOPNOTSUPP; case SWITCHDEV_ATTR_ID_PORT_MROUTER: + /* Ignore it from a bridge port other than the port itself */ + if (attr->orig_dev != dev) + return -EOPNOTSUPP; + sparx5_port_attr_mrouter_set(port, attr->orig_dev, attr->u.mrouter); --- base-commit: ffd713dc373629317dc374f71690dae61060ead0 change-id: 20261203-sparx5-vlan-filtering-other-bridges-6ce769bbbace Best regards, -- Daniel Machon