diff options
author | Petr Machata <petrm@mellanox.com> | 2018-12-12 12:02:56 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-12-12 19:34:22 -0500 |
commit | 6921351359395a6c6ac72cd275a8393f399cecc7 (patch) | |
tree | 980ee7e316a654327c1824e914e541c2c9a69fc5 | |
parent | 479c86dc551c9720765ed19433990eae6a1f899f (diff) |
net: switchdev: Add extack to switchdev_handle_port_obj_add() callback
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>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/mscc/ocelot.c | 3 | ||||
-rw-r--r-- | include/net/switchdev.h | 6 | ||||
-rw-r--r-- | net/switchdev/switchdev.c | 12 |
4 files changed, 17 insertions, 7 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c index 5ad1fcebf788..4b9292289256 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | |||
@@ -1777,7 +1777,8 @@ static void mlxsw_sp_span_respin_schedule(struct mlxsw_sp *mlxsw_sp) | |||
1777 | 1777 | ||
1778 | static int mlxsw_sp_port_obj_add(struct net_device *dev, | 1778 | static int mlxsw_sp_port_obj_add(struct net_device *dev, |
1779 | const struct switchdev_obj *obj, | 1779 | const struct switchdev_obj *obj, |
1780 | struct switchdev_trans *trans) | 1780 | struct switchdev_trans *trans, |
1781 | struct netlink_ext_ack *extack) | ||
1781 | { | 1782 | { |
1782 | struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); | 1783 | struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev); |
1783 | const struct switchdev_obj_port_vlan *vlan; | 1784 | const struct switchdev_obj_port_vlan *vlan; |
diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 7f8da8873a96..ea3eec263875 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c | |||
@@ -1293,7 +1293,8 @@ static int ocelot_port_obj_del_mdb(struct net_device *dev, | |||
1293 | 1293 | ||
1294 | static int ocelot_port_obj_add(struct net_device *dev, | 1294 | static int ocelot_port_obj_add(struct net_device *dev, |
1295 | const struct switchdev_obj *obj, | 1295 | const struct switchdev_obj *obj, |
1296 | struct switchdev_trans *trans) | 1296 | struct switchdev_trans *trans, |
1297 | struct netlink_ext_ack *extack) | ||
1297 | { | 1298 | { |
1298 | int ret = 0; | 1299 | int ret = 0; |
1299 | 1300 | ||
diff --git a/include/net/switchdev.h b/include/net/switchdev.h index 4facfa6775e8..a7fdab5ee6c3 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h | |||
@@ -215,7 +215,8 @@ int switchdev_handle_port_obj_add(struct net_device *dev, | |||
215 | bool (*check_cb)(const struct net_device *dev), | 215 | bool (*check_cb)(const struct net_device *dev), |
216 | int (*add_cb)(struct net_device *dev, | 216 | int (*add_cb)(struct net_device *dev, |
217 | const struct switchdev_obj *obj, | 217 | const struct switchdev_obj *obj, |
218 | struct switchdev_trans *trans)); | 218 | struct switchdev_trans *trans, |
219 | struct netlink_ext_ack *extack)); | ||
219 | int switchdev_handle_port_obj_del(struct net_device *dev, | 220 | int switchdev_handle_port_obj_del(struct net_device *dev, |
220 | struct switchdev_notifier_port_obj_info *port_obj_info, | 221 | struct switchdev_notifier_port_obj_info *port_obj_info, |
221 | bool (*check_cb)(const struct net_device *dev), | 222 | bool (*check_cb)(const struct net_device *dev), |
@@ -304,7 +305,8 @@ switchdev_handle_port_obj_add(struct net_device *dev, | |||
304 | bool (*check_cb)(const struct net_device *dev), | 305 | bool (*check_cb)(const struct net_device *dev), |
305 | int (*add_cb)(struct net_device *dev, | 306 | int (*add_cb)(struct net_device *dev, |
306 | const struct switchdev_obj *obj, | 307 | const struct switchdev_obj *obj, |
307 | struct switchdev_trans *trans)) | 308 | struct switchdev_trans *trans, |
309 | struct netlink_ext_ack *extack)) | ||
308 | { | 310 | { |
309 | return 0; | 311 | return 0; |
310 | } | 312 | } |
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index aa84acfb6632..5df9d1138ac9 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c | |||
@@ -616,16 +616,21 @@ static int __switchdev_handle_port_obj_add(struct net_device *dev, | |||
616 | bool (*check_cb)(const struct net_device *dev), | 616 | bool (*check_cb)(const struct net_device *dev), |
617 | int (*add_cb)(struct net_device *dev, | 617 | int (*add_cb)(struct net_device *dev, |
618 | const struct switchdev_obj *obj, | 618 | const struct switchdev_obj *obj, |
619 | struct switchdev_trans *trans)) | 619 | struct switchdev_trans *trans, |
620 | struct netlink_ext_ack *extack)) | ||
620 | { | 621 | { |
622 | struct netlink_ext_ack *extack; | ||
621 | struct net_device *lower_dev; | 623 | struct net_device *lower_dev; |
622 | struct list_head *iter; | 624 | struct list_head *iter; |
623 | int err = -EOPNOTSUPP; | 625 | int err = -EOPNOTSUPP; |
624 | 626 | ||
627 | extack = switchdev_notifier_info_to_extack(&port_obj_info->info); | ||
628 | |||
625 | if (check_cb(dev)) { | 629 | if (check_cb(dev)) { |
626 | /* This flag is only checked if the return value is success. */ | 630 | /* This flag is only checked if the return value is success. */ |
627 | port_obj_info->handled = true; | 631 | port_obj_info->handled = true; |
628 | return add_cb(dev, port_obj_info->obj, port_obj_info->trans); | 632 | return add_cb(dev, port_obj_info->obj, port_obj_info->trans, |
633 | extack); | ||
629 | } | 634 | } |
630 | 635 | ||
631 | /* Switch ports might be stacked under e.g. a LAG. Ignore the | 636 | /* 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, | |||
650 | bool (*check_cb)(const struct net_device *dev), | 655 | bool (*check_cb)(const struct net_device *dev), |
651 | int (*add_cb)(struct net_device *dev, | 656 | int (*add_cb)(struct net_device *dev, |
652 | const struct switchdev_obj *obj, | 657 | const struct switchdev_obj *obj, |
653 | struct switchdev_trans *trans)) | 658 | struct switchdev_trans *trans, |
659 | struct netlink_ext_ack *extack)) | ||
654 | { | 660 | { |
655 | int err; | 661 | int err; |
656 | 662 | ||