History

net: switchdev: Add a helper to replay objects on a bridge port

When a front panel joins a bridge via another netdevice (typically a LAG), the driver needs to learn about the objects configured on the bridge port. When the bridge port is offloaded by the driver for the first time, this can be achieved by passing a notifier to switchdev_bridge_port_offload(). The notifier is then invoked for the individual objects (such as VLANs) configured on the bridge, and can look for the interesting ones. Calling switchdev_bridge_port_offload() when the second port joins the bridge lower is unnecessary, but the replay is still needed. To that end, add a new function, switchdev_bridge_port_replay(), which does only the replay part of the _offload() function in exactly the same way as that function.

Petr Machata committed 3 years ago

Commit f2e28571 parent 989280d5 files · +64 −0Browse files

Showing the changes to net/switchdev/switchdev.c (1 of 5 files). Show all

Unified · Split

net/switchdev/switchdev.c+25−0
@@ -862,3 +862,28 @@ void switchdev_bridge_port_unoffload(struct net_device *brport_dev, · 861 unmodified lines
862862 NULL);
863863 }
864864 EXPORT_SYMBOL_GPL(switchdev_bridge_port_unoffload);
865+
866+int switchdev_bridge_port_replay(struct net_device *brport_dev,
867+ struct net_device *dev, const void *ctx,
868+ struct notifier_block *atomic_nb,
869+ struct notifier_block *blocking_nb,
870+ struct netlink_ext_ack *extack)
871+{
872+ struct switchdev_notifier_brport_info brport_info = {
873+ .brport = {
874+ .dev = dev,
875+ .ctx = ctx,
876+ .atomic_nb = atomic_nb,
877+ .blocking_nb = blocking_nb,
878+ },
879+ };
880+ int err;
881+
882+ ASSERT_RTNL();
883+
884+ err = call_switchdev_blocking_notifiers(SWITCHDEV_BRPORT_REPLAY,
885+ brport_dev, &brport_info.info,
886+ extack);
887+ return notifier_to_errno(err);
888+}
889+EXPORT_SYMBOL_GPL(switchdev_bridge_port_replay);