net: switchdev: Add extack to switchdev_handle_port_obj_add() callback
authorPetr Machata <petrm@mellanox.com>
Wed, 12 Dec 2018 17:02:56 +0000 (17:02 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 13 Dec 2018 00:34:22 +0000 (16:34 -0800)
Drivers use switchdev_handle_port_obj_add() to handle recursive descent
through lower devices. Change this function prototype to take add_cb
that itself takes an extack argument. Decode extack from
switchdev_notifier_port_obj_info and pass it to add_cb.

Update mlxsw and ocelot drivers which use this helper.

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>
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
drivers/net/ethernet/mscc/ocelot.c
include/net/switchdev.h
net/switchdev/switchdev.c

index 5ad1fcebf7883ebb8dba76e4a6747adb2171ef2f..4b9292289256ba64413b6e1476d6b79972b3efd6 100644 (file)
@@ -1777,7 +1777,8 @@ static void mlxsw_sp_span_respin_schedule(struct mlxsw_sp *mlxsw_sp)
 
 static int mlxsw_sp_port_obj_add(struct net_device *dev,
                                 const struct switchdev_obj *obj,
-                                struct switchdev_trans *trans)
+                                struct switchdev_trans *trans,
+                                struct netlink_ext_ack *extack)
 {
        struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
        const struct switchdev_obj_port_vlan *vlan;
index 7f8da8873a96d2338dccf335e169d553edce9b66..ea3eec263875177adf5f40194000fe204cefc701 100644 (file)
@@ -1293,7 +1293,8 @@ static int ocelot_port_obj_del_mdb(struct net_device *dev,
 
 static int ocelot_port_obj_add(struct net_device *dev,
                               const struct switchdev_obj *obj,
-                              struct switchdev_trans *trans)
+                              struct switchdev_trans *trans,
+                              struct netlink_ext_ack *extack)
 {
        int ret = 0;
 
index 4facfa6775e898bea5a43cff2aa22f076d14f9a0..a7fdab5ee6c3be35cf14b91a872fbcdecb61d3e7 100644 (file)
@@ -215,7 +215,8 @@ int switchdev_handle_port_obj_add(struct net_device *dev,
                        bool (*check_cb)(const struct net_device *dev),
                        int (*add_cb)(struct net_device *dev,
                                      const struct switchdev_obj *obj,
-                                     struct switchdev_trans *trans));
+                                     struct switchdev_trans *trans,
+                                     struct netlink_ext_ack *extack));
 int switchdev_handle_port_obj_del(struct net_device *dev,
                        struct switchdev_notifier_port_obj_info *port_obj_info,
                        bool (*check_cb)(const struct net_device *dev),
@@ -304,7 +305,8 @@ switchdev_handle_port_obj_add(struct net_device *dev,
                        bool (*check_cb)(const struct net_device *dev),
                        int (*add_cb)(struct net_device *dev,
                                      const struct switchdev_obj *obj,
-                                     struct switchdev_trans *trans))
+                                     struct switchdev_trans *trans,
+                                     struct netlink_ext_ack *extack))
 {
        return 0;
 }
index aa84acfb663274d8076caead179c9687cc9ba61d..5df9d1138ac9026b03639d87b543a7cf5ea20905 100644 (file)
@@ -616,16 +616,21 @@ static int __switchdev_handle_port_obj_add(struct net_device *dev,
                        bool (*check_cb)(const struct net_device *dev),
                        int (*add_cb)(struct net_device *dev,
                                      const struct switchdev_obj *obj,
-                                     struct switchdev_trans *trans))
+                                     struct switchdev_trans *trans,
+                                     struct netlink_ext_ack *extack))
 {
+       struct netlink_ext_ack *extack;
        struct net_device *lower_dev;
        struct list_head *iter;
        int err = -EOPNOTSUPP;
 
+       extack = switchdev_notifier_info_to_extack(&port_obj_info->info);
+
        if (check_cb(dev)) {
                /* This flag is only checked if the return value is success. */
                port_obj_info->handled = true;
-               return add_cb(dev, port_obj_info->obj, port_obj_info->trans);
+               return add_cb(dev, port_obj_info->obj, port_obj_info->trans,
+                             extack);
        }
 
        /* Switch ports might be stacked under e.g. a LAG. Ignore the
@@ -650,7 +655,8 @@ int switchdev_handle_port_obj_add(struct net_device *dev,
                        bool (*check_cb)(const struct net_device *dev),
                        int (*add_cb)(struct net_device *dev,
                                      const struct switchdev_obj *obj,
-                                     struct switchdev_trans *trans))
+                                     struct switchdev_trans *trans,
+                                     struct netlink_ext_ack *extack))
 {
        int err;