Add call to setup firmware data dump structure during device load in
mlx5core. Do not consider the inability to create a firmware dump fatal, but inform about the situation and allow the driver to attach. The device might not implement the needed VSC, or we might not know the layout of the registers map. In either case, only firmware dump functionality is limited, the network operations should be fine. Submitted by: kib@ MFC after: 1 week Sponsored by: Mellanox Technologies
This commit is contained in:
parent
9cb83c4689
commit
0285276c92
@ -82,7 +82,7 @@ int mlx5_rename_eq(struct mlx5_core_dev *dev, int eq_ix, char *name);
|
||||
|
||||
int mlx5_fwdump_init(void);
|
||||
void mlx5_fwdump_fini(void);
|
||||
int mlx5_fwdump_prep(struct mlx5_core_dev *mdev);
|
||||
void mlx5_fwdump_prep(struct mlx5_core_dev *mdev);
|
||||
void mlx5_fwdump(struct mlx5_core_dev *mdev);
|
||||
void mlx5_fwdump_clean(struct mlx5_core_dev *mdev);
|
||||
|
||||
|
@ -69,15 +69,19 @@ mlx5_fwdump_destroy_dd(struct mlx5_dump_data *dd)
|
||||
free(dd, M_MLX5_DUMP);
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
mlx5_fwdump_prep(struct mlx5_core_dev *mdev)
|
||||
{
|
||||
struct mlx5_dump_data *dd;
|
||||
int error;
|
||||
|
||||
error = mlx5_vsc_find_cap(mdev);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
if (error != 0) {
|
||||
/* Inability to create a firmware dump is not fatal. */
|
||||
device_printf((&mdev->pdev->dev)->bsddev, "WARN: "
|
||||
"mlx5_fwdump_prep failed %d\n", error);
|
||||
return;
|
||||
}
|
||||
dd = malloc(sizeof(struct mlx5_dump_data), M_MLX5_DUMP, M_WAITOK);
|
||||
switch (pci_get_device(mdev->pdev->dev.bsddev)) {
|
||||
case 0x1013:
|
||||
@ -92,7 +96,7 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev)
|
||||
break;
|
||||
default:
|
||||
free(dd, M_MLX5_DUMP);
|
||||
return (0); /* silently fail to not prevent driver attach */
|
||||
return; /* silently fail, do not prevent driver attach */
|
||||
}
|
||||
dd->dump_size = mlx5_fwdump_getsize(dd->rege);
|
||||
dd->dump = malloc(dd->dump_size * sizeof(uint32_t), M_MLX5_DUMP,
|
||||
@ -102,7 +106,6 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev)
|
||||
if (atomic_cmpset_rel_ptr((uintptr_t *)&mdev->dump_data, 0,
|
||||
(uintptr_t)dd) == 0)
|
||||
mlx5_fwdump_destroy_dd(dd);
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1022,6 +1022,8 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
|
||||
goto err_reg_dev;
|
||||
}
|
||||
|
||||
mlx5_fwdump_prep(dev);
|
||||
|
||||
clear_bit(MLX5_INTERFACE_STATE_DOWN, &dev->intf_state);
|
||||
set_bit(MLX5_INTERFACE_STATE_UP, &dev->intf_state);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user