net: devlink: split reload op into two
In order to properly implement failure indication during reload, split the reload op into two ops, one for down phase and one for up phase. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

zatwierdzone przez
David S. Miller

rodzic
35c7ff349a
commit
97691069dc
@@ -3935,17 +3935,27 @@ static void mlx4_restart_one_down(struct pci_dev *pdev);
|
||||
static int mlx4_restart_one_up(struct pci_dev *pdev, bool reload,
|
||||
struct devlink *devlink);
|
||||
|
||||
static int mlx4_devlink_reload(struct devlink *devlink,
|
||||
struct netlink_ext_ack *extack)
|
||||
static int mlx4_devlink_reload_down(struct devlink *devlink,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct mlx4_priv *priv = devlink_priv(devlink);
|
||||
struct mlx4_dev *dev = &priv->dev;
|
||||
struct mlx4_dev_persistent *persist = dev->persist;
|
||||
|
||||
if (persist->num_vfs)
|
||||
mlx4_warn(persist->dev, "Reload performed on PF, will cause reset on operating Virtual Functions\n");
|
||||
mlx4_restart_one_down(persist->pdev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mlx4_devlink_reload_up(struct devlink *devlink,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct mlx4_priv *priv = devlink_priv(devlink);
|
||||
struct mlx4_dev *dev = &priv->dev;
|
||||
struct mlx4_dev_persistent *persist = dev->persist;
|
||||
int err;
|
||||
|
||||
if (persist->num_vfs)
|
||||
mlx4_warn(persist->dev, "Reload performed on PF, will cause reset on operating Virtual Functions\n");
|
||||
mlx4_restart_one_down(persist->pdev);
|
||||
err = mlx4_restart_one_up(persist->pdev, true, devlink);
|
||||
if (err)
|
||||
mlx4_err(persist->dev, "mlx4_restart_one_up failed, ret=%d\n",
|
||||
@@ -3956,7 +3966,8 @@ static int mlx4_devlink_reload(struct devlink *devlink,
|
||||
|
||||
static const struct devlink_ops mlx4_devlink_ops = {
|
||||
.port_type_set = mlx4_devlink_port_type_set,
|
||||
.reload = mlx4_devlink_reload,
|
||||
.reload_down = mlx4_devlink_reload_down,
|
||||
.reload_up = mlx4_devlink_reload_up,
|
||||
};
|
||||
|
||||
static int mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
|
||||
|
@@ -984,16 +984,26 @@ mlxsw_devlink_info_get(struct devlink *devlink, struct devlink_info_req *req,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mlxsw_devlink_core_bus_device_reload(struct devlink *devlink,
|
||||
struct netlink_ext_ack *extack)
|
||||
static int
|
||||
mlxsw_devlink_core_bus_device_reload_down(struct devlink *devlink,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct mlxsw_core *mlxsw_core = devlink_priv(devlink);
|
||||
int err;
|
||||
|
||||
if (!(mlxsw_core->bus->features & MLXSW_BUS_F_RESET))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
mlxsw_core_bus_device_unregister(mlxsw_core, true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
mlxsw_devlink_core_bus_device_reload_up(struct devlink *devlink,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct mlxsw_core *mlxsw_core = devlink_priv(devlink);
|
||||
int err;
|
||||
|
||||
err = mlxsw_core_bus_device_register(mlxsw_core->bus_info,
|
||||
mlxsw_core->bus,
|
||||
mlxsw_core->bus_priv, true,
|
||||
@@ -1066,7 +1076,8 @@ mlxsw_devlink_trap_group_init(struct devlink *devlink,
|
||||
}
|
||||
|
||||
static const struct devlink_ops mlxsw_devlink_ops = {
|
||||
.reload = mlxsw_devlink_core_bus_device_reload,
|
||||
.reload_down = mlxsw_devlink_core_bus_device_reload_down,
|
||||
.reload_up = mlxsw_devlink_core_bus_device_reload_up,
|
||||
.port_type_set = mlxsw_devlink_port_type_set,
|
||||
.port_split = mlxsw_devlink_port_split,
|
||||
.port_unsplit = mlxsw_devlink_port_unsplit,
|
||||
|
Reference in New Issue
Block a user