#include <linux/idr.h>
#include <linux/log2.h>
#include <linux/mutex.h>
#include <linux/netlink.h>
#include <net/devlink.h>
#include "spectrum.h"
struct mlxsw_sp_policer_family { … };
struct mlxsw_sp_policer { … };
struct mlxsw_sp_policer_family_ops { … };
struct mlxsw_sp_policer_core { … };
struct mlxsw_sp_policer_core_ops { … };
static u64 mlxsw_sp_policer_rate_bytes_ps_kbps(u64 rate_bytes_ps)
{ … }
static u8 mlxsw_sp_policer_burst_bytes_hw_units(u64 burst_bytes)
{ … }
static u64 mlxsw_sp_policer_single_rate_occ_get(void *priv)
{ … }
static int
mlxsw_sp_policer_single_rate_family_init(struct mlxsw_sp_policer_family *family)
{ … }
static void
mlxsw_sp_policer_single_rate_family_fini(struct mlxsw_sp_policer_family *family)
{ … }
static int
mlxsw_sp_policer_single_rate_index_alloc(struct mlxsw_sp_policer_family *family,
struct mlxsw_sp_policer *policer)
{ … }
static struct mlxsw_sp_policer *
mlxsw_sp_policer_single_rate_index_free(struct mlxsw_sp_policer_family *family,
u16 policer_index)
{ … }
static int
mlxsw_sp_policer_single_rate_init(struct mlxsw_sp_policer_family *family,
const struct mlxsw_sp_policer *policer)
{ … }
static int
mlxsw_sp_policer_single_rate_params_check(const struct mlxsw_sp_policer_family *family,
const struct mlxsw_sp_policer_params *params,
struct netlink_ext_ack *extack)
{ … }
static const struct mlxsw_sp_policer_family_ops mlxsw_sp_policer_single_rate_ops = …;
static const struct mlxsw_sp_policer_family mlxsw_sp_policer_single_rate_family = …;
static const struct mlxsw_sp_policer_family *mlxsw_sp_policer_family_arr[] = …;
int mlxsw_sp_policer_add(struct mlxsw_sp *mlxsw_sp,
enum mlxsw_sp_policer_type type,
const struct mlxsw_sp_policer_params *params,
struct netlink_ext_ack *extack, u16 *p_policer_index)
{ … }
void mlxsw_sp_policer_del(struct mlxsw_sp *mlxsw_sp,
enum mlxsw_sp_policer_type type, u16 policer_index)
{ … }
int mlxsw_sp_policer_drops_counter_get(struct mlxsw_sp *mlxsw_sp,
enum mlxsw_sp_policer_type type,
u16 policer_index, u64 *p_drops)
{ … }
static int
mlxsw_sp_policer_family_register(struct mlxsw_sp *mlxsw_sp,
const struct mlxsw_sp_policer_family *tmpl)
{ … }
static void
mlxsw_sp_policer_family_unregister(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_policer_family *family)
{ … }
int mlxsw_sp_policers_init(struct mlxsw_sp *mlxsw_sp)
{ … }
void mlxsw_sp_policers_fini(struct mlxsw_sp *mlxsw_sp)
{ … }
int mlxsw_sp_policer_resources_register(struct mlxsw_core *mlxsw_core)
{ … }
static int
mlxsw_sp1_policer_core_init(struct mlxsw_sp_policer_core *policer_core)
{ … }
const struct mlxsw_sp_policer_core_ops mlxsw_sp1_policer_core_ops = …;
static int
mlxsw_sp2_policer_core_init(struct mlxsw_sp_policer_core *policer_core)
{ … }
const struct mlxsw_sp_policer_core_ops mlxsw_sp2_policer_core_ops = …;