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

Signed-off-by: Tobias Waldekranz <tob...@waldekranz.com>
---
 include/net/switchdev.h   |  3 +++
 net/bridge/br_switchdev.c | 10 +++++-----
 net/switchdev/switchdev.c | 18 ++++++++++++++++++
 3 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index 9bf387664e71..df4db720183f 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -340,6 +340,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 7b41ee8740cb..cc9ed7f6bf1c 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 c9189a970eec..f73249269a87 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -380,6 +380,24 @@ bool switchdev_port_obj_act_is_deferred(struct net_device 
*dev,
 }
 EXPORT_SYMBOL_GPL(switchdev_port_obj_act_is_deferred);
 
+/**
+ *     switchdev_call_replay - Replay switchdev message to driver
+ *
+ *     @nb: notifier block to send the message to
+ *     @type: value passed unmodified to notifier function
+ *     @info: notifier information data
+ *
+ *     Called by a bridge, in 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