mlx4: Split restart_one into two functions
Split the function restart_one into two functions and separate teardown and buildup. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c6af0c227a
commit
35c7ff349a
|
@ -210,7 +210,7 @@ static void mlx4_handle_error_state(struct mlx4_dev_persistent *persist)
|
|||
mutex_lock(&persist->interface_state_mutex);
|
||||
if (persist->interface_state & MLX4_INTERFACE_STATE_UP &&
|
||||
!(persist->interface_state & MLX4_INTERFACE_STATE_DELETION)) {
|
||||
err = mlx4_restart_one(persist->pdev, false, NULL);
|
||||
err = mlx4_restart_one(persist->pdev);
|
||||
mlx4_info(persist->dev, "mlx4_restart_one was ended, ret=%d\n",
|
||||
err);
|
||||
}
|
||||
|
|
|
@ -3931,6 +3931,10 @@ static void mlx4_devlink_param_load_driverinit_values(struct devlink *devlink)
|
|||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -3941,9 +3945,11 @@ static int mlx4_devlink_reload(struct devlink *devlink,
|
|||
|
||||
if (persist->num_vfs)
|
||||
mlx4_warn(persist->dev, "Reload performed on PF, will cause reset on operating Virtual Functions\n");
|
||||
err = mlx4_restart_one(persist->pdev, true, devlink);
|
||||
mlx4_restart_one_down(persist->pdev);
|
||||
err = mlx4_restart_one_up(persist->pdev, true, devlink);
|
||||
if (err)
|
||||
mlx4_err(persist->dev, "mlx4_restart_one failed, ret=%d\n", err);
|
||||
mlx4_err(persist->dev, "mlx4_restart_one_up failed, ret=%d\n",
|
||||
err);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
@ -4163,7 +4169,13 @@ static int restore_current_port_types(struct mlx4_dev *dev,
|
|||
return err;
|
||||
}
|
||||
|
||||
int mlx4_restart_one(struct pci_dev *pdev, bool reload, struct devlink *devlink)
|
||||
static void mlx4_restart_one_down(struct pci_dev *pdev)
|
||||
{
|
||||
mlx4_unload_one(pdev);
|
||||
}
|
||||
|
||||
static int mlx4_restart_one_up(struct pci_dev *pdev, bool reload,
|
||||
struct devlink *devlink)
|
||||
{
|
||||
struct mlx4_dev_persistent *persist = pci_get_drvdata(pdev);
|
||||
struct mlx4_dev *dev = persist->dev;
|
||||
|
@ -4175,7 +4187,6 @@ int mlx4_restart_one(struct pci_dev *pdev, bool reload, struct devlink *devlink)
|
|||
total_vfs = dev->persist->num_vfs;
|
||||
memcpy(nvfs, dev->persist->nvfs, sizeof(dev->persist->nvfs));
|
||||
|
||||
mlx4_unload_one(pdev);
|
||||
if (reload)
|
||||
mlx4_devlink_param_load_driverinit_values(devlink);
|
||||
err = mlx4_load_one(pdev, pci_dev_data, total_vfs, nvfs, priv, 1);
|
||||
|
@ -4194,6 +4205,12 @@ int mlx4_restart_one(struct pci_dev *pdev, bool reload, struct devlink *devlink)
|
|||
return err;
|
||||
}
|
||||
|
||||
int mlx4_restart_one(struct pci_dev *pdev)
|
||||
{
|
||||
mlx4_restart_one_down(pdev);
|
||||
return mlx4_restart_one_up(pdev, false, NULL);
|
||||
}
|
||||
|
||||
#define MLX_SP(id) { PCI_VDEVICE(MELLANOX, id), MLX4_PCI_DEV_FORCE_SENSE_PORT }
|
||||
#define MLX_VF(id) { PCI_VDEVICE(MELLANOX, id), MLX4_PCI_DEV_IS_VF }
|
||||
#define MLX_GN(id) { PCI_VDEVICE(MELLANOX, id), 0 }
|
||||
|
|
|
@ -1043,8 +1043,7 @@ int mlx4_catas_init(struct mlx4_dev *dev);
|
|||
void mlx4_catas_end(struct mlx4_dev *dev);
|
||||
int mlx4_crdump_init(struct mlx4_dev *dev);
|
||||
void mlx4_crdump_end(struct mlx4_dev *dev);
|
||||
int mlx4_restart_one(struct pci_dev *pdev, bool reload,
|
||||
struct devlink *devlink);
|
||||
int mlx4_restart_one(struct pci_dev *pdev);
|
||||
int mlx4_register_device(struct mlx4_dev *dev);
|
||||
void mlx4_unregister_device(struct mlx4_dev *dev);
|
||||
void mlx4_dispatch_event(struct mlx4_dev *dev, enum mlx4_dev_event type,
|
||||
|
|
Loading…
Reference in New Issue