net: dsa: replay a deletion of switchdev objects for ports leaving a bridged LAG
authorVladimir Oltean <vladimir.oltean@nxp.com>
Sun, 27 Jun 2021 11:54:29 +0000 (14:54 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jun 2021 21:09:03 +0000 (14:09 -0700)
commit7491894532341cff11babd1fe3bd68537166bcc4
tree9ba8efa46dfb690c3076eb2d2c810484ba88cc03
parent4ede74e73b5b540b2a20bb6d5ad4d69348ba51fc
net: dsa: replay a deletion of switchdev objects for ports leaving a bridged LAG

When a DSA switch port leaves a bonding interface that is under a
bridge, there might be dangling switchdev objects on that port left
behind, because the bridge is not aware that its lower interface (the
bond) changed state in any way.

Call the bridge replay helpers with adding=false before changing
dp->bridge_dev to NULL, because we need to simulate to
dsa_slave_port_obj_del() that these notifications were emitted by the
bridge.

We add this hook to the NETDEV_PRECHANGEUPPER event handler, because
we are calling into switchdev (and the __switchdev_handle_port_obj_del
fanout helpers expect the upper/lower adjacency lists to still be valid)
and PRECHANGEUPPER is the last moment in time when they still are.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/dsa_priv.h
net/dsa/port.c
net/dsa/slave.c