Commit d4d11f8f authored by David S. Miller's avatar David S. Miller

Merge branch 'devlink-parallel-commands'

Jiri Pirko says:

====================
net: devlink: allow parallel commands on multiple devlinks

Aim of this patchset is to remove devlink_mutex and eventually to enable
parallel ops on devlink netlink interface.
====================
Tested-by: default avatarIdo Schimmel <idosch@nvidia.com>
Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 02a7cb28 09b27846
...@@ -3958,11 +3958,9 @@ static int mlx4_devlink_reload_down(struct devlink *devlink, bool netns_change, ...@@ -3958,11 +3958,9 @@ static int mlx4_devlink_reload_down(struct devlink *devlink, bool netns_change,
NL_SET_ERR_MSG_MOD(extack, "Namespace change is not supported"); NL_SET_ERR_MSG_MOD(extack, "Namespace change is not supported");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
devl_lock(devlink);
if (persist->num_vfs) if (persist->num_vfs)
mlx4_warn(persist->dev, "Reload performed on PF, will cause reset on operating Virtual Functions\n"); mlx4_warn(persist->dev, "Reload performed on PF, will cause reset on operating Virtual Functions\n");
mlx4_restart_one_down(persist->pdev); mlx4_restart_one_down(persist->pdev);
devl_unlock(devlink);
return 0; return 0;
} }
...@@ -3975,10 +3973,8 @@ static int mlx4_devlink_reload_up(struct devlink *devlink, enum devlink_reload_a ...@@ -3975,10 +3973,8 @@ static int mlx4_devlink_reload_up(struct devlink *devlink, enum devlink_reload_a
struct mlx4_dev_persistent *persist = dev->persist; struct mlx4_dev_persistent *persist = dev->persist;
int err; int err;
devl_lock(devlink);
*actions_performed = BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT); *actions_performed = BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT);
err = mlx4_restart_one_up(persist->pdev, true, devlink); err = mlx4_restart_one_up(persist->pdev, true, devlink);
devl_unlock(devlink);
if (err) if (err)
mlx4_err(persist->dev, "mlx4_restart_one_up failed, ret=%d\n", mlx4_err(persist->dev, "mlx4_restart_one_up failed, ret=%d\n",
err); err);
......
...@@ -164,7 +164,6 @@ static int mlx5_devlink_reload_down(struct devlink *devlink, bool netns_change, ...@@ -164,7 +164,6 @@ static int mlx5_devlink_reload_down(struct devlink *devlink, bool netns_change,
NL_SET_ERR_MSG_MOD(extack, "reload while VFs are present is unfavorable"); NL_SET_ERR_MSG_MOD(extack, "reload while VFs are present is unfavorable");
} }
devl_lock(devlink);
switch (action) { switch (action) {
case DEVLINK_RELOAD_ACTION_DRIVER_REINIT: case DEVLINK_RELOAD_ACTION_DRIVER_REINIT:
mlx5_unload_one_devl_locked(dev); mlx5_unload_one_devl_locked(dev);
...@@ -181,7 +180,6 @@ static int mlx5_devlink_reload_down(struct devlink *devlink, bool netns_change, ...@@ -181,7 +180,6 @@ static int mlx5_devlink_reload_down(struct devlink *devlink, bool netns_change,
ret = -EOPNOTSUPP; ret = -EOPNOTSUPP;
} }
devl_unlock(devlink);
return ret; return ret;
} }
...@@ -192,7 +190,6 @@ static int mlx5_devlink_reload_up(struct devlink *devlink, enum devlink_reload_a ...@@ -192,7 +190,6 @@ static int mlx5_devlink_reload_up(struct devlink *devlink, enum devlink_reload_a
struct mlx5_core_dev *dev = devlink_priv(devlink); struct mlx5_core_dev *dev = devlink_priv(devlink);
int ret = 0; int ret = 0;
devl_lock(devlink);
*actions_performed = BIT(action); *actions_performed = BIT(action);
switch (action) { switch (action) {
case DEVLINK_RELOAD_ACTION_DRIVER_REINIT: case DEVLINK_RELOAD_ACTION_DRIVER_REINIT:
...@@ -211,7 +208,6 @@ static int mlx5_devlink_reload_up(struct devlink *devlink, enum devlink_reload_a ...@@ -211,7 +208,6 @@ static int mlx5_devlink_reload_up(struct devlink *devlink, enum devlink_reload_a
ret = -EOPNOTSUPP; ret = -EOPNOTSUPP;
} }
devl_unlock(devlink);
return ret; return ret;
} }
......
...@@ -1499,9 +1499,7 @@ mlxsw_devlink_core_bus_device_reload_down(struct devlink *devlink, ...@@ -1499,9 +1499,7 @@ mlxsw_devlink_core_bus_device_reload_down(struct devlink *devlink,
if (!(mlxsw_core->bus->features & MLXSW_BUS_F_RESET)) if (!(mlxsw_core->bus->features & MLXSW_BUS_F_RESET))
return -EOPNOTSUPP; return -EOPNOTSUPP;
devl_lock(devlink);
mlxsw_core_bus_device_unregister(mlxsw_core, true); mlxsw_core_bus_device_unregister(mlxsw_core, true);
devl_unlock(devlink);
return 0; return 0;
} }
...@@ -1515,12 +1513,10 @@ mlxsw_devlink_core_bus_device_reload_up(struct devlink *devlink, enum devlink_re ...@@ -1515,12 +1513,10 @@ mlxsw_devlink_core_bus_device_reload_up(struct devlink *devlink, enum devlink_re
*actions_performed = BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT) | *actions_performed = BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT) |
BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE); BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE);
devl_lock(devlink);
err = mlxsw_core_bus_device_register(mlxsw_core->bus_info, err = mlxsw_core_bus_device_register(mlxsw_core->bus_info,
mlxsw_core->bus, mlxsw_core->bus,
mlxsw_core->bus_priv, true, mlxsw_core->bus_priv, true,
devlink, extack); devlink, extack);
devl_unlock(devlink);
return err; return err;
} }
......
...@@ -948,18 +948,15 @@ static int nsim_dev_reload_down(struct devlink *devlink, bool netns_change, ...@@ -948,18 +948,15 @@ static int nsim_dev_reload_down(struct devlink *devlink, bool netns_change,
{ {
struct nsim_dev *nsim_dev = devlink_priv(devlink); struct nsim_dev *nsim_dev = devlink_priv(devlink);
devl_lock(devlink);
if (nsim_dev->dont_allow_reload) { if (nsim_dev->dont_allow_reload) {
/* For testing purposes, user set debugfs dont_allow_reload /* For testing purposes, user set debugfs dont_allow_reload
* value to true. So forbid it. * value to true. So forbid it.
*/ */
NL_SET_ERR_MSG_MOD(extack, "User forbid the reload for testing purposes"); NL_SET_ERR_MSG_MOD(extack, "User forbid the reload for testing purposes");
devl_unlock(devlink);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
nsim_dev_reload_destroy(nsim_dev); nsim_dev_reload_destroy(nsim_dev);
devl_unlock(devlink);
return 0; return 0;
} }
...@@ -970,19 +967,16 @@ static int nsim_dev_reload_up(struct devlink *devlink, enum devlink_reload_actio ...@@ -970,19 +967,16 @@ static int nsim_dev_reload_up(struct devlink *devlink, enum devlink_reload_actio
struct nsim_dev *nsim_dev = devlink_priv(devlink); struct nsim_dev *nsim_dev = devlink_priv(devlink);
int ret; int ret;
devl_lock(devlink);
if (nsim_dev->fail_reload) { if (nsim_dev->fail_reload) {
/* For testing purposes, user set debugfs fail_reload /* For testing purposes, user set debugfs fail_reload
* value to true. Fail right away. * value to true. Fail right away.
*/ */
NL_SET_ERR_MSG_MOD(extack, "User setup the reload to fail for testing purposes"); NL_SET_ERR_MSG_MOD(extack, "User setup the reload to fail for testing purposes");
devl_unlock(devlink);
return -EINVAL; return -EINVAL;
} }
*actions_performed = BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT); *actions_performed = BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT);
ret = nsim_dev_reload_create(nsim_dev, extack); ret = nsim_dev_reload_create(nsim_dev, extack);
devl_unlock(devlink);
return ret; return ret;
} }
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment