net: switchdev: Add extack argument to switchdev_port_obj_add()
authorPetr Machata <petrm@mellanox.com>
Wed, 12 Dec 2018 17:02:52 +0000 (17:02 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 13 Dec 2018 00:34:21 +0000 (16:34 -0800)
After the previous patch, bridge driver has extack argument available to
pass to switchdev. Therefore extend switchdev_port_obj_add() with this
argument, updating all callers, and passing the argument through to
switchdev_port_obj_notify().

Signed-off-by: Petr Machata <petrm@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Ivan Vecera <ivecera@redhat.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/switchdev.h
net/bridge/br_mdb.c
net/bridge/br_switchdev.c
net/switchdev/switchdev.c

index 866b6d148b777ce0d0a10935e5af415552cd0780..69016305ad5891749225ba0baaf79b943bd83d29 100644 (file)
@@ -180,7 +180,8 @@ int switchdev_port_attr_get(struct net_device *dev,
 int switchdev_port_attr_set(struct net_device *dev,
                            const struct switchdev_attr *attr);
 int switchdev_port_obj_add(struct net_device *dev,
-                          const struct switchdev_obj *obj);
+                          const struct switchdev_obj *obj,
+                          struct netlink_ext_ack *extack);
 int switchdev_port_obj_del(struct net_device *dev,
                           const struct switchdev_obj *obj);
 
@@ -233,7 +234,8 @@ static inline int switchdev_port_attr_set(struct net_device *dev,
 }
 
 static inline int switchdev_port_obj_add(struct net_device *dev,
-                                        const struct switchdev_obj *obj)
+                                        const struct switchdev_obj *obj,
+                                        struct netlink_ext_ack *extack)
 {
        return -EOPNOTSUPP;
 }
index 79d4c9d253e020c1fdad5dfee689cba25c7b3d22..f69c8d91dc8189773223080c4c8c8f8ef0924a36 100644 (file)
@@ -331,7 +331,7 @@ static void br_mdb_switchdev_host_port(struct net_device *dev,
        mdb.obj.orig_dev = dev;
        switch (type) {
        case RTM_NEWMDB:
-               switchdev_port_obj_add(lower_dev, &mdb.obj);
+               switchdev_port_obj_add(lower_dev, &mdb.obj, NULL);
                break;
        case RTM_DELMDB:
                switchdev_port_obj_del(lower_dev, &mdb.obj);
@@ -381,7 +381,7 @@ static void __br_mdb_notify(struct net_device *dev, struct net_bridge_port *p,
                        __mdb_entry_to_br_ip(entry, &complete_info->ip);
                        mdb.obj.complete_priv = complete_info;
                        mdb.obj.complete = br_mdb_complete;
-                       if (switchdev_port_obj_add(port_dev, &mdb.obj))
+                       if (switchdev_port_obj_add(port_dev, &mdb.obj, NULL))
                                kfree(complete_info);
                }
        } else if (p && port_dev && type == RTM_DELMDB) {
index 99ba32177b31145441d71675c8affda7469d9aa5..035ff59d9cbd8dde7dc93426da8ea91be08906bd 100644 (file)
@@ -151,7 +151,7 @@ int br_switchdev_port_vlan_add(struct net_device *dev, u16 vid, u16 flags,
                .vid_end = vid,
        };
 
-       return switchdev_port_obj_add(dev, &v.obj);
+       return switchdev_port_obj_add(dev, &v.obj, extack);
 }
 
 int br_switchdev_port_vlan_del(struct net_device *dev, u16 vid)
index fe23fac4dc4bddbb2c86e377bc962d84525c9612..cb20669bf6ce2e4d8aca638c3b4efe9e43b724aa 100644 (file)
@@ -356,7 +356,8 @@ static size_t switchdev_obj_size(const struct switchdev_obj *obj)
 static int switchdev_port_obj_notify(enum switchdev_notifier_type nt,
                                     struct net_device *dev,
                                     const struct switchdev_obj *obj,
-                                    struct switchdev_trans *trans)
+                                    struct switchdev_trans *trans,
+                                    struct netlink_ext_ack *extack)
 {
        int rc;
        int err;
@@ -379,7 +380,8 @@ static int switchdev_port_obj_notify(enum switchdev_notifier_type nt,
 }
 
 static int switchdev_port_obj_add_now(struct net_device *dev,
-                                     const struct switchdev_obj *obj)
+                                     const struct switchdev_obj *obj,
+                                     struct netlink_ext_ack *extack)
 {
        struct switchdev_trans trans;
        int err;
@@ -397,7 +399,7 @@ static int switchdev_port_obj_add_now(struct net_device *dev,
 
        trans.ph_prepare = true;
        err = switchdev_port_obj_notify(SWITCHDEV_PORT_OBJ_ADD,
-                                       dev, obj, &trans);
+                                       dev, obj, &trans, extack);
        if (err) {
                /* Prepare phase failed: abort the transaction.  Any
                 * resources reserved in the prepare phase are
@@ -417,7 +419,7 @@ static int switchdev_port_obj_add_now(struct net_device *dev,
 
        trans.ph_prepare = false;
        err = switchdev_port_obj_notify(SWITCHDEV_PORT_OBJ_ADD,
-                                       dev, obj, &trans);
+                                       dev, obj, &trans, extack);
        WARN(err, "%s: Commit of object (id=%d) failed.\n", dev->name, obj->id);
        switchdev_trans_items_warn_destroy(dev, &trans);
 
@@ -430,7 +432,7 @@ static void switchdev_port_obj_add_deferred(struct net_device *dev,
        const struct switchdev_obj *obj = data;
        int err;
 
-       err = switchdev_port_obj_add_now(dev, obj);
+       err = switchdev_port_obj_add_now(dev, obj, NULL);
        if (err && err != -EOPNOTSUPP)
                netdev_err(dev, "failed (err=%d) to add object (id=%d)\n",
                           err, obj->id);
@@ -460,12 +462,13 @@ static int switchdev_port_obj_add_defer(struct net_device *dev,
  *     in case SWITCHDEV_F_DEFER flag is not set.
  */
 int switchdev_port_obj_add(struct net_device *dev,
-                          const struct switchdev_obj *obj)
+                          const struct switchdev_obj *obj,
+                          struct netlink_ext_ack *extack)
 {
        if (obj->flags & SWITCHDEV_F_DEFER)
                return switchdev_port_obj_add_defer(dev, obj);
        ASSERT_RTNL();
-       return switchdev_port_obj_add_now(dev, obj);
+       return switchdev_port_obj_add_now(dev, obj, extack);
 }
 EXPORT_SYMBOL_GPL(switchdev_port_obj_add);
 
@@ -473,7 +476,7 @@ static int switchdev_port_obj_del_now(struct net_device *dev,
                                      const struct switchdev_obj *obj)
 {
        return switchdev_port_obj_notify(SWITCHDEV_PORT_OBJ_DEL,
-                                        dev, obj, NULL);
+                                        dev, obj, NULL, NULL);
 }
 
 static void switchdev_port_obj_del_deferred(struct net_device *dev,