Skip to content

Commit f7a70d6

Browse files
wkzdavem330
authored andcommitted
net: bridge: switchdev: Ensure deferred event delivery on unoffload
When unoffloading a device, it is important to ensure that all relevant deferred events are delivered to it before it disassociates itself from the bridge. Before this change, this was true for the normal case when a device maps 1:1 to a net_bridge_port, i.e. br0 / swp0 When swp0 leaves br0, the call to switchdev_deferred_process() in del_nbp() makes sure to process any outstanding events while the device is still associated with the bridge. In the case when the association is indirect though, i.e. when the device is attached to the bridge via an intermediate device, like a LAG... br0 / lag0 / swp0 ...then detaching swp0 from lag0 does not cause any net_bridge_port to be deleted, so there was no guarantee that all events had been processed before the device disassociated itself from the bridge. Fix this by always synchronously processing all deferred events before signaling completion of unoffloading back to the driver. Fixes: 4e51bf4 ("net: bridge: move the switchdev object replay helpers to "push" mode") Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com> Reviewed-by: Vladimir Oltean <olteanv@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent dc489f8 commit f7a70d6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

net/bridge/br_switchdev.c

+10
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,16 @@ static void nbp_switchdev_unsync_objs(struct net_bridge_port *p,
804804
br_switchdev_mdb_replay(br_dev, dev, ctx, false, blocking_nb, NULL);
805805

806806
br_switchdev_vlan_replay(br_dev, ctx, false, blocking_nb, NULL);
807+
808+
/* Make sure that the device leaving this bridge has seen all
809+
* relevant events before it is disassociated. In the normal
810+
* case, when the device is directly attached to the bridge,
811+
* this is covered by del_nbp(). If the association was indirect
812+
* however, e.g. via a team or bond, and the device is leaving
813+
* that intermediate device, then the bridge port remains in
814+
* place.
815+
*/
816+
switchdev_deferred_process();
807817
}
808818

809819
/* Let the bridge know that this port is offloaded, so that it can assign a

0 commit comments

Comments
 (0)