linux_dsm_epyc7002/drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.h
Ido Schimmel 13f2e64b94 mlxsw: spectrum_trap: Add devlink-trap policer support
Register supported packet trap policers with devlink and implement
callbacks to change their parameters and read their counters.

Prevent user space from passing invalid policer parameters down to the
device by checking their validity and communicating the failure via an
appropriate extack message.

v2:
* Remove the max/min validity checks from __mlxsw_sp_trap_policer_set()

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-30 17:54:59 -07:00

25 lines
625 B
C

/* 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
#include <linux/list.h>
#include <net/devlink.h>
struct mlxsw_sp_trap {
struct devlink_trap_policer *policers_arr; /* Registered policers */
u64 policers_count; /* Number of registered policers */
struct list_head policer_item_list;
u64 max_policers;
unsigned long policers_usage[]; /* Usage bitmap */
};
struct mlxsw_sp_trap_policer_item {
u16 hw_id;
u32 id;
struct list_head list; /* Member of policer_item_list */
};
#endif