linux/drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c

// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
/* Copyright (c) 2019 Mellanox Technologies. All rights reserved */

#include <linux/bitops.h>
#include <linux/kernel.h>
#include <linux/netlink.h>
#include <net/devlink.h>
#include <uapi/linux/devlink.h>

#include "core.h"
#include "reg.h"
#include "spectrum.h"
#include "spectrum_trap.h"

struct mlxsw_sp_trap_policer_item {};

struct mlxsw_sp_trap_group_item {};

#define MLXSW_SP_TRAP_LISTENERS_MAX

struct mlxsw_sp_trap_item {};

/* All driver-specific traps must be documented in
 * Documentation/networking/devlink/mlxsw.rst
 */
enum {};

#define DEVLINK_MLXSW_TRAP_NAME_IRIF_DISABLED
#define DEVLINK_MLXSW_TRAP_NAME_ERIF_DISABLED

#define MLXSW_SP_TRAP_METADATA

enum {};

static int mlxsw_sp_rx_listener(struct mlxsw_sp *mlxsw_sp, struct sk_buff *skb,
				u16 local_port,
				struct mlxsw_sp_port *mlxsw_sp_port)
{}

static void mlxsw_sp_rx_drop_listener(struct sk_buff *skb, u16 local_port,
				      void *trap_ctx)
{}

static void mlxsw_sp_rx_acl_drop_listener(struct sk_buff *skb, u16 local_port,
					  void *trap_ctx)
{}

static int __mlxsw_sp_rx_no_mark_listener(struct sk_buff *skb, u16 local_port,
					  void *trap_ctx)
{}

static void mlxsw_sp_rx_no_mark_listener(struct sk_buff *skb, u16 local_port,
					 void *trap_ctx)
{}

static void mlxsw_sp_rx_mark_listener(struct sk_buff *skb, u16 local_port,
				      void *trap_ctx)
{}

static void mlxsw_sp_rx_l3_mark_listener(struct sk_buff *skb, u16 local_port,
					 void *trap_ctx)
{}

static void mlxsw_sp_rx_ptp_listener(struct sk_buff *skb, u16 local_port,
				     void *trap_ctx)
{}

static struct mlxsw_sp_port *
mlxsw_sp_sample_tx_port_get(struct mlxsw_sp *mlxsw_sp,
			    const struct mlxsw_rx_md_info *rx_md_info)
{}

/* The latency units are determined according to MOGCR.mirror_latency_units. It
 * defaults to 64 nanoseconds.
 */
#define MLXSW_SP_MIRROR_LATENCY_SHIFT

static void mlxsw_sp_psample_md_init(struct mlxsw_sp *mlxsw_sp,
				     struct psample_metadata *md,
				     struct sk_buff *skb, int in_ifindex,
				     bool truncate, u32 trunc_size)
{}

static void mlxsw_sp_rx_sample_listener(struct sk_buff *skb, u16 local_port,
					void *trap_ctx)
{}

static void mlxsw_sp_rx_sample_tx_listener(struct sk_buff *skb, u16 local_port,
					   void *trap_ctx)
{}

static void mlxsw_sp_rx_sample_acl_listener(struct sk_buff *skb, u16 local_port,
					    void *trap_ctx)
{}

#define MLXSW_SP_TRAP_DROP(_id, _group_id)

#define MLXSW_SP_TRAP_DROP_EXT(_id, _group_id, _metadata)

#define MLXSW_SP_TRAP_BUFFER_DROP(_id)

#define MLXSW_SP_TRAP_DRIVER_DROP(_id, _group_id)

#define MLXSW_SP_TRAP_EXCEPTION(_id, _group_id)

#define MLXSW_SP_TRAP_CONTROL(_id, _group_id, _action)

#define MLXSW_SP_RXL_DISCARD(_id, _group_id)

#define MLXSW_SP_RXL_ACL_DISCARD(_id, _en_group_id, _dis_group_id)

#define MLXSW_SP_RXL_BUFFER_DISCARD(_mirror_reason)

#define MLXSW_SP_RXL_EXCEPTION(_id, _group_id, _action)

#define MLXSW_SP_RXL_NO_MARK(_id, _group_id, _action, _is_ctrl)

#define MLXSW_SP_RXL_MARK(_id, _group_id, _action, _is_ctrl)

#define MLXSW_SP_RXL_L3_MARK(_id, _group_id, _action, _is_ctrl)

#define MLXSW_SP_TRAP_POLICER(_id, _rate, _burst)

/* Ordered by policer identifier */
static const struct mlxsw_sp_trap_policer_item
mlxsw_sp_trap_policer_items_arr[] =;

static const struct mlxsw_sp_trap_group_item mlxsw_sp_trap_group_items_arr[] =;

static const struct mlxsw_sp_trap_item mlxsw_sp_trap_items_arr[] =;

static struct mlxsw_sp_trap_policer_item *
mlxsw_sp_trap_policer_item_lookup(struct mlxsw_sp *mlxsw_sp, u32 id)
{}

static struct mlxsw_sp_trap_group_item *
mlxsw_sp_trap_group_item_lookup(struct mlxsw_sp *mlxsw_sp, u16 id)
{}

static struct mlxsw_sp_trap_item *
mlxsw_sp_trap_item_lookup(struct mlxsw_sp *mlxsw_sp, u16 id)
{}

static int mlxsw_sp_trap_cpu_policers_set(struct mlxsw_sp *mlxsw_sp)
{}

static int mlxsw_sp_trap_dummy_group_init(struct mlxsw_sp *mlxsw_sp)
{}

static int mlxsw_sp_trap_policer_items_arr_init(struct mlxsw_sp *mlxsw_sp)
{}

static void mlxsw_sp_trap_policer_items_arr_fini(struct mlxsw_sp *mlxsw_sp)
{}

static int mlxsw_sp_trap_policers_init(struct mlxsw_sp *mlxsw_sp)
{}

static void mlxsw_sp_trap_policers_fini(struct mlxsw_sp *mlxsw_sp)
{}

static int mlxsw_sp_trap_group_items_arr_init(struct mlxsw_sp *mlxsw_sp)
{}

static void mlxsw_sp_trap_group_items_arr_fini(struct mlxsw_sp *mlxsw_sp)
{}

static int mlxsw_sp_trap_groups_init(struct mlxsw_sp *mlxsw_sp)
{}

static void mlxsw_sp_trap_groups_fini(struct mlxsw_sp *mlxsw_sp)
{}

static bool
mlxsw_sp_trap_listener_is_valid(const struct mlxsw_listener *listener)
{}

static int mlxsw_sp_trap_items_arr_init(struct mlxsw_sp *mlxsw_sp)
{}

static void mlxsw_sp_trap_items_arr_fini(struct mlxsw_sp *mlxsw_sp)
{}

static int mlxsw_sp_traps_init(struct mlxsw_sp *mlxsw_sp)
{}

static void mlxsw_sp_traps_fini(struct mlxsw_sp *mlxsw_sp)
{}

int mlxsw_sp_devlink_traps_init(struct mlxsw_sp *mlxsw_sp)
{}

void mlxsw_sp_devlink_traps_fini(struct mlxsw_sp *mlxsw_sp)
{}

int mlxsw_sp_trap_init(struct mlxsw_core *mlxsw_core,
		       const struct devlink_trap *trap, void *trap_ctx)
{}

void mlxsw_sp_trap_fini(struct mlxsw_core *mlxsw_core,
			const struct devlink_trap *trap, void *trap_ctx)
{}

int mlxsw_sp_trap_action_set(struct mlxsw_core *mlxsw_core,
			     const struct devlink_trap *trap,
			     enum devlink_trap_action action,
			     struct netlink_ext_ack *extack)
{}

static int
__mlxsw_sp_trap_group_init(struct mlxsw_core *mlxsw_core,
			   const struct devlink_trap_group *group,
			   u32 policer_id, struct netlink_ext_ack *extack)
{}

int mlxsw_sp_trap_group_init(struct mlxsw_core *mlxsw_core,
			     const struct devlink_trap_group *group)
{}

int mlxsw_sp_trap_group_set(struct mlxsw_core *mlxsw_core,
			    const struct devlink_trap_group *group,
			    const struct devlink_trap_policer *policer,
			    struct netlink_ext_ack *extack)
{}

static int
mlxsw_sp_trap_policer_item_init(struct mlxsw_sp *mlxsw_sp,
				struct mlxsw_sp_trap_policer_item *policer_item)
{}

static void
mlxsw_sp_trap_policer_item_fini(struct mlxsw_sp *mlxsw_sp,
				struct mlxsw_sp_trap_policer_item *policer_item)
{}

static int mlxsw_sp_trap_policer_bs(u64 burst, u8 *p_burst_size,
				    struct netlink_ext_ack *extack)
{}

static int __mlxsw_sp_trap_policer_set(struct mlxsw_sp *mlxsw_sp, u16 hw_id,
				       u64 rate, u64 burst, bool clear_counter,
				       struct netlink_ext_ack *extack)
{}

int mlxsw_sp_trap_policer_init(struct mlxsw_core *mlxsw_core,
			       const struct devlink_trap_policer *policer)
{}

void mlxsw_sp_trap_policer_fini(struct mlxsw_core *mlxsw_core,
				const struct devlink_trap_policer *policer)
{}

int mlxsw_sp_trap_policer_set(struct mlxsw_core *mlxsw_core,
			      const struct devlink_trap_policer *policer,
			      u64 rate, u64 burst,
			      struct netlink_ext_ack *extack)
{}

int
mlxsw_sp_trap_policer_counter_get(struct mlxsw_core *mlxsw_core,
				  const struct devlink_trap_policer *policer,
				  u64 *p_drops)
{}

int mlxsw_sp_trap_group_policer_hw_id_get(struct mlxsw_sp *mlxsw_sp, u16 id,
					  bool *p_enabled, u16 *p_hw_id)
{}

static const struct mlxsw_sp_trap_group_item
mlxsw_sp1_trap_group_items_arr[] =;

static const struct mlxsw_sp_trap_item
mlxsw_sp1_trap_items_arr[] =;

static int
mlxsw_sp1_trap_groups_init(struct mlxsw_sp *mlxsw_sp,
			   const struct mlxsw_sp_trap_group_item **arr,
			   size_t *p_groups_count)
{}

static int mlxsw_sp1_traps_init(struct mlxsw_sp *mlxsw_sp,
				const struct mlxsw_sp_trap_item **arr,
				size_t *p_traps_count)
{}

const struct mlxsw_sp_trap_ops mlxsw_sp1_trap_ops =;

static const struct mlxsw_sp_trap_group_item
mlxsw_sp2_trap_group_items_arr[] =;

static const struct mlxsw_sp_trap_item
mlxsw_sp2_trap_items_arr[] =;

static int
mlxsw_sp2_trap_groups_init(struct mlxsw_sp *mlxsw_sp,
			   const struct mlxsw_sp_trap_group_item **arr,
			   size_t *p_groups_count)
{}

static int mlxsw_sp2_traps_init(struct mlxsw_sp *mlxsw_sp,
				const struct mlxsw_sp_trap_item **arr,
				size_t *p_traps_count)
{}

const struct mlxsw_sp_trap_ops mlxsw_sp2_trap_ops =;