Prepare for FW dump in error state in mlx5core.

- Move firmware dump prep and cleanup to init_one() and remove_one() so that
the init and cleanup will happen only upon driver reload.
- Add some prints to indicate firmware dump.

MFC after:	3 days
Submitted by:	slavash@
Sponsored by:	Mellanox Technologies
This commit is contained in:
Hans Petter Selasky 2018-03-30 19:43:15 +00:00
parent 0a752b05a8
commit 3c1274bd64
2 changed files with 9 additions and 5 deletions

View File

@ -116,14 +116,18 @@ mlx5_fwdump(struct mlx5_core_dev *mdev)
uint32_t i, ri;
int error;
dev_info(&mdev->pdev->dev, "Issuing FW dump\n");
dd = (struct mlx5_dump_data *)atomic_load_acq_ptr((uintptr_t *)
&mdev->dump_data);
if (dd == NULL)
return;
mtx_lock(&dd->dump_lock);
if (dd->dump_valid)
if (dd->dump_valid) {
/* only one dump */
dev_warn(&mdev->pdev->dev,
"Only one FW dump can be captured aborting FW dump\n");
goto failed;
}
/* mlx5_vsc already warns, be silent. */
error = mlx5_vsc_lock(mdev);

View File

@ -1056,8 +1056,6 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
goto err_fs;
}
mlx5_fwdump_prep(dev);
clear_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state);
set_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state);
@ -1127,7 +1125,6 @@ static int mlx5_unload_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
goto out;
}
mlx5_fwdump_clean(dev);
mlx5_unregister_device(dev);
mlx5_cleanup_fs(dev);
@ -1179,7 +1176,6 @@ struct mlx5_core_event_handler {
void *data);
};
static int init_one(struct pci_dev *pdev,
const struct pci_device_id *id)
{
@ -1224,6 +1220,8 @@ static int init_one(struct pci_dev *pdev,
goto clean_health;
}
mlx5_fwdump_prep(dev);
pci_save_state(pdev->dev.bsddev);
return 0;
@ -1248,6 +1246,7 @@ static void remove_one(struct pci_dev *pdev)
return;
}
mlx5_fwdump_clean(dev);
mlx5_pagealloc_cleanup(dev);
mlx5_health_cleanup(dev);
mlx5_pci_close(dev, priv);
@ -1264,6 +1263,7 @@ static pci_ers_result_t mlx5_pci_err_detected(struct pci_dev *pdev,
dev_info(&pdev->dev, "%s was called\n", __func__);
mlx5_enter_error_state(dev, false);
mlx5_unload_one(dev, priv, false);
if (state) {
mlx5_drain_health_wq(dev);
mlx5_pci_disable_device(dev);