This will make it easier to add a tracepoint for all replay messages
later on.

Signed-off-by: Tobias Waldekranz <[email protected]>
---
 include/net/switchdev.h   |  3 +++
 net/bridge/br_switchdev.c | 10 +++++-----
 net/switchdev/switchdev.c | 17 +++++++++++++++++
 3 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index 250053748c08..974cd8467131 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -337,6 +337,9 @@ int switchdev_port_obj_add(struct net_device *dev,
 int switchdev_port_obj_del(struct net_device *dev,
                           const struct switchdev_obj *obj);
 
+int switchdev_call_replay(struct notifier_block *nb, unsigned long type,
+                         struct switchdev_notifier_info *info);
+
 int register_switchdev_notifier(struct notifier_block *nb);
 int unregister_switchdev_notifier(struct notifier_block *nb);
 int call_switchdev_notifiers(unsigned long val, struct net_device *dev,
diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c
index ee84e783e1df..b9e69b522544 100644
--- a/net/bridge/br_switchdev.c
+++ b/net/bridge/br_switchdev.c
@@ -306,7 +306,7 @@ br_switchdev_fdb_replay_one(struct net_bridge *br, struct 
notifier_block *nb,
 
        br_switchdev_fdb_populate(br, &item, fdb, ctx);
 
-       err = nb->notifier_call(nb, action, &item);
+       err = switchdev_call_replay(nb, action, &item.info);
        return notifier_to_errno(err);
 }
 
@@ -376,8 +376,8 @@ static int br_switchdev_vlan_attr_replay(struct net_device 
*br_dev,
                        attr.u.vlan_msti.vid = v->vid;
                        attr.u.vlan_msti.msti = v->msti;
 
-                       err = nb->notifier_call(nb, SWITCHDEV_PORT_ATTR_SET,
-                                               &attr_info);
+                       err = switchdev_call_replay(nb, SWITCHDEV_PORT_ATTR_SET,
+                                                   &attr_info.info);
                        err = notifier_to_errno(err);
                        if (err)
                                return err;
@@ -404,7 +404,7 @@ br_switchdev_vlan_replay_one(struct notifier_block *nb,
        };
        int err;
 
-       err = nb->notifier_call(nb, action, &obj_info);
+       err = switchdev_call_replay(nb, action, &obj_info.info);
        return notifier_to_errno(err);
 }
 
@@ -590,7 +590,7 @@ br_switchdev_mdb_replay_one(struct notifier_block *nb, 
struct net_device *dev,
        };
        int err;
 
-       err = nb->notifier_call(nb, action, &obj_info);
+       err = switchdev_call_replay(nb, action, &obj_info.info);
        return notifier_to_errno(err);
 }
 
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index 5b045284849e..05f22f971312 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -307,6 +307,23 @@ int switchdev_port_obj_del(struct net_device *dev,
 }
 EXPORT_SYMBOL_GPL(switchdev_port_obj_del);
 
+/**
+ *     switchdev_replay - Replay switchdev message to driver
+ *     @nb: notifier block to send the message to
+ *     @val: value passed unmodified to notifier function
+ *     @info: notifier information data
+ *
+ *     Typically issued by the bridge, as a response to a replay
+ *     request initiated by a port that is either attaching to, or
+ *     detaching from, that bridge.
+ */
+int switchdev_call_replay(struct notifier_block *nb, unsigned long type,
+                         struct switchdev_notifier_info *info)
+{
+       return nb->notifier_call(nb, type, info);
+}
+EXPORT_SYMBOL_GPL(switchdev_call_replay);
+
 static ATOMIC_NOTIFIER_HEAD(switchdev_notif_chain);
 static BLOCKING_NOTIFIER_HEAD(switchdev_blocking_notif_chain);
 
-- 
2.34.1


Reply via email to