2020-03-30 22:38:26 +03:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
|
|
|
|
|
/* Copyright (c) 2020 Mellanox Technologies. All rights reserved */
|
|
|
|
|
|
|
|
|
|
#ifndef _MLXSW_SPECTRUM_TRAP_H
|
|
|
|
|
#define _MLXSW_SPECTRUM_TRAP_H
|
|
|
|
|
|
2020-03-30 22:38:28 +03:00
|
|
|
#include <linux/list.h>
|
2020-03-30 22:38:27 +03:00
|
|
|
#include <net/devlink.h>
|
|
|
|
|
|
2020-03-30 22:38:26 +03:00
|
|
|
struct mlxsw_sp_trap {
|
2020-05-17 01:43:06 +03:00
|
|
|
struct mlxsw_sp_trap_policer_item *policer_items_arr;
|
2020-08-03 19:11:35 +03:00
|
|
|
size_t policers_count; /* Number of registered policers */
|
2020-05-17 01:43:07 +03:00
|
|
|
|
|
|
|
|
struct mlxsw_sp_trap_group_item *group_items_arr;
|
2020-08-03 19:11:35 +03:00
|
|
|
size_t groups_count; /* Number of registered groups */
|
2020-05-17 01:43:07 +03:00
|
|
|
|
2020-05-17 01:43:08 +03:00
|
|
|
struct mlxsw_sp_trap_item *trap_items_arr;
|
2020-08-03 19:11:35 +03:00
|
|
|
size_t traps_count; /* Number of registered traps */
|
2020-05-17 01:43:08 +03:00
|
|
|
|
2020-05-26 02:05:51 +03:00
|
|
|
u16 thin_policer_hw_id;
|
|
|
|
|
|
2020-03-30 22:38:26 +03:00
|
|
|
u64 max_policers;
|
|
|
|
|
unsigned long policers_usage[]; /* Usage bitmap */
|
|
|
|
|
};
|
|
|
|
|
|
2020-08-03 19:11:37 +03:00
|
|
|
struct mlxsw_sp_trap_ops {
|
|
|
|
|
int (*groups_init)(struct mlxsw_sp *mlxsw_sp,
|
|
|
|
|
const struct mlxsw_sp_trap_group_item **arr,
|
|
|
|
|
size_t *p_groups_count);
|
2020-08-03 19:11:38 +03:00
|
|
|
int (*traps_init)(struct mlxsw_sp *mlxsw_sp,
|
|
|
|
|
const struct mlxsw_sp_trap_item **arr,
|
|
|
|
|
size_t *p_traps_count);
|
2020-08-03 19:11:37 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern const struct mlxsw_sp_trap_ops mlxsw_sp1_trap_ops;
|
|
|
|
|
extern const struct mlxsw_sp_trap_ops mlxsw_sp2_trap_ops;
|
|
|
|
|
|
2020-03-30 22:38:26 +03:00
|
|
|
#endif
|