Return an error from ioctl(MLX5_FW_RESET) if reset was rejected in mlx5core.

Submitted by:	kib@
MFC after:	3 days
Sponsored by:	Mellanox Technologies
This commit is contained in:
Hans Petter Selasky 2019-10-02 10:24:13 +00:00
parent 96425f44c9
commit 3e40712eb0
3 changed files with 9 additions and 5 deletions

View File

@ -110,7 +110,7 @@ void mlx5e_cleanup(void);
int mlx5_ctl_init(void);
void mlx5_ctl_fini(void);
void mlx5_fwdump_prep(struct mlx5_core_dev *mdev);
void mlx5_fwdump(struct mlx5_core_dev *mdev);
int mlx5_fwdump(struct mlx5_core_dev *mdev);
void mlx5_fwdump_clean(struct mlx5_core_dev *mdev);
struct mlx5_crspace_regmap {

View File

@ -148,7 +148,7 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev)
mlx5_vsc_unlock(mdev);
}
void
int
mlx5_fwdump(struct mlx5_core_dev *mdev)
{
const struct mlx5_crspace_regmap *r;
@ -157,12 +157,15 @@ mlx5_fwdump(struct mlx5_core_dev *mdev)
mlx5_core_info(mdev, "Issuing FW dump\n");
mtx_lock(&mdev->dump_lock);
if (mdev->dump_data == NULL)
if (mdev->dump_data == NULL) {
error = EIO;
goto failed;
}
if (mdev->dump_valid) {
/* only one dump */
mlx5_core_warn(mdev,
"Only one FW dump can be captured aborting FW dump\n");
error = EEXIST;
goto failed;
}
@ -187,6 +190,7 @@ mlx5_fwdump(struct mlx5_core_dev *mdev)
mlx5_vsc_unlock(mdev);
failed:
mtx_unlock(&mdev->dump_lock);
return (error);
}
void
@ -400,7 +404,7 @@ mlx5_ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag,
error = mlx5_dbsf_to_core(devaddr, &mdev);
if (error != 0)
break;
mlx5_fwdump(mdev);
error = mlx5_fwdump(mdev);
break;
case MLX5_FW_UPDATE:
if ((fflag & FWRITE) == 0) {

View File

@ -300,7 +300,7 @@ void mlx5_enter_error_state(struct mlx5_core_dev *dev, bool force)
/* Execute cr-dump and SW reset */
if (lock != -EBUSY) {
mlx5_fwdump(dev);
(void)mlx5_fwdump(dev);
reset_fw_if_needed(dev);
delay_ms = MLX5_FW_RESET_WAIT_MS;
}