net/mlx5: Unregister traps on driver unload flow
Before this patch, devlink traps are registered only on full driver probe and unregistered on driver removal. As devlink traps are not usable once driver functionality is unloaded, it should be unrgeistered also on flows that unload the driver and then registered when loaded back, e.g. devlink reload flow. Signed-off-by: Moshe Shemesh <moshe@nvidia.com> Reviewed-by: Aya Levin <ayal@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
parent
d23b928bef
commit
71b75f0e02
|
@ -840,7 +840,7 @@ static const struct devlink_trap_group mlx5_trap_groups_arr[] = {
|
|||
DEVLINK_TRAP_GROUP_GENERIC(L2_DROPS, 0),
|
||||
};
|
||||
|
||||
static int mlx5_devlink_traps_register(struct devlink *devlink)
|
||||
int mlx5_devlink_traps_register(struct devlink *devlink)
|
||||
{
|
||||
struct mlx5_core_dev *core_dev = devlink_priv(devlink);
|
||||
int err;
|
||||
|
@ -862,7 +862,7 @@ err_trap_group:
|
|||
return err;
|
||||
}
|
||||
|
||||
static void mlx5_devlink_traps_unregister(struct devlink *devlink)
|
||||
void mlx5_devlink_traps_unregister(struct devlink *devlink)
|
||||
{
|
||||
devl_traps_unregister(devlink, mlx5_traps_arr, ARRAY_SIZE(mlx5_traps_arr));
|
||||
devl_trap_groups_unregister(devlink, mlx5_trap_groups_arr,
|
||||
|
@ -889,17 +889,11 @@ int mlx5_devlink_register(struct devlink *devlink)
|
|||
if (err)
|
||||
goto max_uc_list_err;
|
||||
|
||||
err = mlx5_devlink_traps_register(devlink);
|
||||
if (err)
|
||||
goto traps_reg_err;
|
||||
|
||||
if (!mlx5_core_is_mp_slave(dev))
|
||||
devlink_set_features(devlink, DEVLINK_F_RELOAD);
|
||||
|
||||
return 0;
|
||||
|
||||
traps_reg_err:
|
||||
mlx5_devlink_max_uc_list_param_unregister(devlink);
|
||||
max_uc_list_err:
|
||||
mlx5_devlink_auxdev_params_unregister(devlink);
|
||||
auxdev_reg_err:
|
||||
|
@ -910,7 +904,6 @@ auxdev_reg_err:
|
|||
|
||||
void mlx5_devlink_unregister(struct devlink *devlink)
|
||||
{
|
||||
mlx5_devlink_traps_unregister(devlink);
|
||||
mlx5_devlink_max_uc_list_param_unregister(devlink);
|
||||
mlx5_devlink_auxdev_params_unregister(devlink);
|
||||
devlink_params_unregister(devlink, mlx5_devlink_params,
|
||||
|
|
|
@ -30,6 +30,8 @@ void mlx5_devlink_trap_report(struct mlx5_core_dev *dev, int trap_id, struct sk_
|
|||
int mlx5_devlink_trap_get_num_active(struct mlx5_core_dev *dev);
|
||||
int mlx5_devlink_traps_get_action(struct mlx5_core_dev *dev, int trap_id,
|
||||
enum devlink_trap_action *action);
|
||||
int mlx5_devlink_traps_register(struct devlink *devlink);
|
||||
void mlx5_devlink_traps_unregister(struct devlink *devlink);
|
||||
|
||||
struct devlink *mlx5_devlink_alloc(struct device *dev);
|
||||
void mlx5_devlink_free(struct devlink *devlink);
|
||||
|
|
|
@ -1306,8 +1306,15 @@ static int mlx5_load(struct mlx5_core_dev *dev)
|
|||
|
||||
mlx5_sf_dev_table_create(dev);
|
||||
|
||||
err = mlx5_devlink_traps_register(priv_to_devlink(dev));
|
||||
if (err)
|
||||
goto err_traps_reg;
|
||||
|
||||
return 0;
|
||||
|
||||
err_traps_reg:
|
||||
mlx5_sf_dev_table_destroy(dev);
|
||||
mlx5_sriov_detach(dev);
|
||||
err_sriov:
|
||||
mlx5_lag_remove_mdev(dev);
|
||||
mlx5_ec_cleanup(dev);
|
||||
|
@ -1336,6 +1343,7 @@ err_irq_table:
|
|||
|
||||
static void mlx5_unload(struct mlx5_core_dev *dev)
|
||||
{
|
||||
mlx5_devlink_traps_unregister(priv_to_devlink(dev));
|
||||
mlx5_sf_dev_table_destroy(dev);
|
||||
mlx5_sriov_detach(dev);
|
||||
mlx5_eswitch_disable(dev->priv.eswitch);
|
||||
|
|
Loading…
Reference in New Issue