mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 03:40:52 +07:00
net/mlx5: Register to devlink ingress VLAN filter trap
[ Upstream commit 82e6c96f04e13c72d91777455836ffd012853caa ] Add traps registration to mlx5_core devlink register/unregister flow. This patch registers INGRESS_VLAN_FILTER trap. Signed-off-by: Aya Levin <ayal@nvidia.com> Reviewed-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
1764ebd1fa
commit
2b441dbca3
@ -376,6 +376,48 @@ static void mlx5_devlink_set_params_init_values(struct devlink *devlink)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define MLX5_TRAP_DROP(_id, _group_id) \
|
||||||
|
DEVLINK_TRAP_GENERIC(DROP, DROP, _id, \
|
||||||
|
DEVLINK_TRAP_GROUP_GENERIC_ID_##_group_id, \
|
||||||
|
DEVLINK_TRAP_METADATA_TYPE_F_IN_PORT)
|
||||||
|
|
||||||
|
static const struct devlink_trap mlx5_traps_arr[] = {
|
||||||
|
MLX5_TRAP_DROP(INGRESS_VLAN_FILTER, L2_DROPS),
|
||||||
|
};
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
struct mlx5_core_dev *core_dev = devlink_priv(devlink);
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = devlink_trap_groups_register(devlink, mlx5_trap_groups_arr,
|
||||||
|
ARRAY_SIZE(mlx5_trap_groups_arr));
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
err = devlink_traps_register(devlink, mlx5_traps_arr, ARRAY_SIZE(mlx5_traps_arr),
|
||||||
|
&core_dev->priv);
|
||||||
|
if (err)
|
||||||
|
goto err_trap_group;
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
err_trap_group:
|
||||||
|
devlink_trap_groups_unregister(devlink, mlx5_trap_groups_arr,
|
||||||
|
ARRAY_SIZE(mlx5_trap_groups_arr));
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void mlx5_devlink_traps_unregister(struct devlink *devlink)
|
||||||
|
{
|
||||||
|
devlink_traps_unregister(devlink, mlx5_traps_arr, ARRAY_SIZE(mlx5_traps_arr));
|
||||||
|
devlink_trap_groups_unregister(devlink, mlx5_trap_groups_arr,
|
||||||
|
ARRAY_SIZE(mlx5_trap_groups_arr));
|
||||||
|
}
|
||||||
|
|
||||||
int mlx5_devlink_register(struct devlink *devlink, struct device *dev)
|
int mlx5_devlink_register(struct devlink *devlink, struct device *dev)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
@ -390,8 +432,16 @@ int mlx5_devlink_register(struct devlink *devlink, struct device *dev)
|
|||||||
goto params_reg_err;
|
goto params_reg_err;
|
||||||
mlx5_devlink_set_params_init_values(devlink);
|
mlx5_devlink_set_params_init_values(devlink);
|
||||||
devlink_params_publish(devlink);
|
devlink_params_publish(devlink);
|
||||||
|
|
||||||
|
err = mlx5_devlink_traps_register(devlink);
|
||||||
|
if (err)
|
||||||
|
goto traps_reg_err;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
traps_reg_err:
|
||||||
|
devlink_params_unregister(devlink, mlx5_devlink_params,
|
||||||
|
ARRAY_SIZE(mlx5_devlink_params));
|
||||||
params_reg_err:
|
params_reg_err:
|
||||||
devlink_unregister(devlink);
|
devlink_unregister(devlink);
|
||||||
return err;
|
return err;
|
||||||
@ -399,6 +449,7 @@ int mlx5_devlink_register(struct devlink *devlink, struct device *dev)
|
|||||||
|
|
||||||
void mlx5_devlink_unregister(struct devlink *devlink)
|
void mlx5_devlink_unregister(struct devlink *devlink)
|
||||||
{
|
{
|
||||||
|
mlx5_devlink_traps_unregister(devlink);
|
||||||
devlink_params_unregister(devlink, mlx5_devlink_params,
|
devlink_params_unregister(devlink, mlx5_devlink_params,
|
||||||
ARRAY_SIZE(mlx5_devlink_params));
|
ARRAY_SIZE(mlx5_devlink_params));
|
||||||
devlink_unregister(devlink);
|
devlink_unregister(devlink);
|
||||||
|
Loading…
Reference in New Issue
Block a user