linux/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_action.c

// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
/* Copyright (c) 2024 NVIDIA Corporation & Affiliates */

#include "mlx5hws_internal.h"

#define MLX5HWS_ACTION_METER_INIT_COLOR_OFFSET

/* Header removal size limited to 128B (64 words) */
#define MLX5HWS_ACTION_REMOVE_HEADER_MAX_SIZE

/* This is the longest supported action sequence for FDB table:
 * DECAP, POP_VLAN, MODIFY, CTR, ASO, PUSH_VLAN, MODIFY, ENCAP, Term.
 */
static const u32 action_order_arr[MLX5HWS_TABLE_TYPE_MAX][MLX5HWS_ACTION_TYP_MAX] =;

static const char * const mlx5hws_action_type_str[] =;

static_assert();

const char *mlx5hws_action_type_to_str(enum mlx5hws_action_type action_type)
{}

enum mlx5hws_action_type mlx5hws_action_get_type(struct mlx5hws_action *action)
{}

static int hws_action_get_shared_stc_nic(struct mlx5hws_context *ctx,
					 enum mlx5hws_context_shared_stc_type stc_type,
					 u8 tbl_type)
{}

static int hws_action_get_shared_stc(struct mlx5hws_action *action,
				     enum mlx5hws_context_shared_stc_type stc_type)
{}

static void hws_action_put_shared_stc(struct mlx5hws_action *action,
				      enum mlx5hws_context_shared_stc_type stc_type)
{}

static void hws_action_print_combo(struct mlx5hws_context *ctx,
				   enum mlx5hws_action_type *user_actions)
{}

bool mlx5hws_action_check_combo(struct mlx5hws_context *ctx,
				enum mlx5hws_action_type *user_actions,
				enum mlx5hws_table_type table_type)
{}

static bool
hws_action_fixup_stc_attr(struct mlx5hws_context *ctx,
			  struct mlx5hws_cmd_stc_modify_attr *stc_attr,
			  struct mlx5hws_cmd_stc_modify_attr *fixup_stc_attr,
			  enum mlx5hws_table_type table_type,
			  bool is_mirror)
{}

int mlx5hws_action_alloc_single_stc(struct mlx5hws_context *ctx,
				    struct mlx5hws_cmd_stc_modify_attr *stc_attr,
				    u32 table_type,
				    struct mlx5hws_pool_chunk *stc)
__must_hold(&ctx->ctrl_lock)
{}

void mlx5hws_action_free_single_stc(struct mlx5hws_context *ctx,
				    u32 table_type,
				    struct mlx5hws_pool_chunk *stc)
__must_hold(&ctx->ctrl_lock)
{}

static u32 hws_action_get_mh_stc_type(struct mlx5hws_context *ctx,
				      __be64 pattern)
{}

static void hws_action_fill_stc_attr(struct mlx5hws_action *action,
				     u32 obj_id,
				     struct mlx5hws_cmd_stc_modify_attr *attr)
{}

static int
hws_action_create_stcs(struct mlx5hws_action *action, u32 obj_id)
{}

static void
hws_action_destroy_stcs(struct mlx5hws_action *action)
{}

static bool hws_action_is_flag_hws_fdb(u32 flags)
{}

static bool
hws_action_validate_hws_action(struct mlx5hws_context *ctx, u32 flags)
{}

static struct mlx5hws_action *
hws_action_create_generic_bulk(struct mlx5hws_context *ctx,
			       u32 flags,
			       enum mlx5hws_action_type action_type,
			       u8 bulk_sz)
{}

static struct mlx5hws_action *
hws_action_create_generic(struct mlx5hws_context *ctx,
			  u32 flags,
			  enum mlx5hws_action_type action_type)
{}

struct mlx5hws_action *
mlx5hws_action_create_dest_table_num(struct mlx5hws_context *ctx,
				     u32 table_id,
				     u32 flags)
{}

struct mlx5hws_action *
mlx5hws_action_create_dest_table(struct mlx5hws_context *ctx,
				 struct mlx5hws_table *tbl,
				 u32 flags)
{}

struct mlx5hws_action *
mlx5hws_action_create_dest_drop(struct mlx5hws_context *ctx, u32 flags)
{}

struct mlx5hws_action *
mlx5hws_action_create_default_miss(struct mlx5hws_context *ctx, u32 flags)
{}

struct mlx5hws_action *
mlx5hws_action_create_tag(struct mlx5hws_context *ctx, u32 flags)
{}

static struct mlx5hws_action *
hws_action_create_aso(struct mlx5hws_context *ctx,
		      enum mlx5hws_action_type action_type,
		      u32 obj_id,
		      u8 return_reg_id,
		      u32 flags)
{}

struct mlx5hws_action *
mlx5hws_action_create_aso_meter(struct mlx5hws_context *ctx,
				u32 obj_id,
				u8 return_reg_id,
				u32 flags)
{}

struct mlx5hws_action *
mlx5hws_action_create_counter(struct mlx5hws_context *ctx,
			      u32 obj_id,
			      u32 flags)
{}

struct mlx5hws_action *
mlx5hws_action_create_dest_vport(struct mlx5hws_context *ctx,
				 u16 vport_num,
				 bool vhca_id_valid,
				 u16 vhca_id,
				 u32 flags)
{}

struct mlx5hws_action *
mlx5hws_action_create_push_vlan(struct mlx5hws_context *ctx, u32 flags)
{}

struct mlx5hws_action *
mlx5hws_action_create_pop_vlan(struct mlx5hws_context *ctx, u32 flags)
{}

static int
hws_action_handle_insert_with_ptr(struct mlx5hws_action *action,
				  u8 num_of_hdrs,
				  struct mlx5hws_action_reformat_header *hdrs,
				  u32 log_bulk_sz)
{}

static int
hws_action_handle_l2_to_tunnel_l3(struct mlx5hws_action *action,
				  u8 num_of_hdrs,
				  struct mlx5hws_action_reformat_header *hdrs,
				  u32 log_bulk_sz)
{}

static void hws_action_prepare_decap_l3_actions(size_t data_sz,
						u8 *mh_data,
						int *num_of_actions)
{}

static int
hws_action_handle_tunnel_l3_to_l2(struct mlx5hws_action *action,
				  u8 num_of_hdrs,
				  struct mlx5hws_action_reformat_header *hdrs,
				  u32 log_bulk_sz)
{}

static int
hws_action_create_reformat_hws(struct mlx5hws_action *action,
			       u8 num_of_hdrs,
			       struct mlx5hws_action_reformat_header *hdrs,
			       u32 bulk_size)
{}

struct mlx5hws_action *
mlx5hws_action_create_reformat(struct mlx5hws_context *ctx,
			       enum mlx5hws_action_type reformat_type,
			       u8 num_of_hdrs,
			       struct mlx5hws_action_reformat_header *hdrs,
			       u32 log_bulk_size,
			       u32 flags)
{}

static int
hws_action_create_modify_header_hws(struct mlx5hws_action *action,
				    u8 num_of_patterns,
				    struct mlx5hws_action_mh_pattern *pattern,
				    u32 log_bulk_size)
{}

struct mlx5hws_action *
mlx5hws_action_create_modify_header(struct mlx5hws_context *ctx,
				    u8 num_of_patterns,
				    struct mlx5hws_action_mh_pattern *patterns,
				    u32 log_bulk_size,
				    u32 flags)
{}

struct mlx5hws_action *
mlx5hws_action_create_dest_array(struct mlx5hws_context *ctx,
				 size_t num_dest,
				 struct mlx5hws_action_dest_attr *dests,
				 bool ignore_flow_level,
				 u32 flow_source,
				 u32 flags)
{}

struct mlx5hws_action *
mlx5hws_action_create_insert_header(struct mlx5hws_context *ctx,
				    u8 num_of_hdrs,
				    struct mlx5hws_action_insert_header *hdrs,
				    u32 log_bulk_size,
				    u32 flags)
{}

struct mlx5hws_action *
mlx5hws_action_create_remove_header(struct mlx5hws_context *ctx,
				    struct mlx5hws_action_remove_header_attr *attr,
				    u32 flags)
{}

static struct mlx5hws_definer *
hws_action_create_dest_match_range_definer(struct mlx5hws_context *ctx)
{}

static struct mlx5hws_matcher_action_ste *
hws_action_create_dest_match_range_table(struct mlx5hws_context *ctx,
					 struct mlx5hws_definer *definer,
					 u32 miss_ft_id)
{}

static void
hws_action_destroy_dest_match_range_table(struct mlx5hws_context *ctx,
					  struct mlx5hws_matcher_action_ste *table_ste)
{}

static int
hws_action_create_dest_match_range_fill_table(struct mlx5hws_context *ctx,
					      struct mlx5hws_matcher_action_ste *table_ste,
					      struct mlx5hws_action *hit_ft_action,
					      struct mlx5hws_definer *range_definer,
					      u32 min, u32 max)
{}

struct mlx5hws_action *
mlx5hws_action_create_dest_match_range(struct mlx5hws_context *ctx,
				       u32 field,
				       struct mlx5_flow_table *hit_ft,
				       struct mlx5_flow_table *miss_ft,
				       u32 min, u32 max, u32 flags)
{}

struct mlx5hws_action *
mlx5hws_action_create_last(struct mlx5hws_context *ctx, u32 flags)
{}

struct mlx5hws_action *
mlx5hws_action_create_flow_sampler(struct mlx5hws_context *ctx,
				   u32 sampler_id, u32 flags)
{}

static void hws_action_destroy_hws(struct mlx5hws_action *action)
{}

int mlx5hws_action_destroy(struct mlx5hws_action *action)
{}

int mlx5hws_action_get_default_stc(struct mlx5hws_context *ctx, u8 tbl_type)
__must_hold(&ctx->ctrl_lock)
{}

void mlx5hws_action_put_default_stc(struct mlx5hws_context *ctx, u8 tbl_type)
__must_hold(&ctx->ctrl_lock)
{}

static void hws_action_modify_write(struct mlx5hws_send_engine *queue,
				    u32 arg_idx,
				    u8 *arg_data,
				    u16 num_of_actions,
				    u32 nope_locations)
{}

void mlx5hws_action_prepare_decap_l3_data(u8 *src, u8 *dst, u16 num_of_actions)
{}

static int
hws_action_get_shared_stc_offset(struct mlx5hws_context_common_res *common_res,
				 enum mlx5hws_context_shared_stc_type stc_type)
{}

static struct mlx5hws_actions_wqe_setter *
hws_action_setter_find_first(struct mlx5hws_actions_wqe_setter *setter,
			     u8 req_flags)
{}

static void
hws_action_apply_stc(struct mlx5hws_actions_apply_data *apply,
		     enum mlx5hws_action_stc_idx stc_idx,
		     u8 action_idx)
{}

static void
hws_action_setter_push_vlan(struct mlx5hws_actions_apply_data *apply,
			    struct mlx5hws_actions_wqe_setter *setter)
{}

static void
hws_action_setter_modify_header(struct mlx5hws_actions_apply_data *apply,
				struct mlx5hws_actions_wqe_setter *setter)
{}

static void
hws_action_setter_insert_ptr(struct mlx5hws_actions_apply_data *apply,
			     struct mlx5hws_actions_wqe_setter *setter)
{}

static void
hws_action_setter_tnl_l3_to_l2(struct mlx5hws_actions_apply_data *apply,
			       struct mlx5hws_actions_wqe_setter *setter)
{}

static void
hws_action_setter_aso(struct mlx5hws_actions_apply_data *apply,
		      struct mlx5hws_actions_wqe_setter *setter)
{}

static void
hws_action_setter_tag(struct mlx5hws_actions_apply_data *apply,
		      struct mlx5hws_actions_wqe_setter *setter)
{}

static void
hws_action_setter_ctrl_ctr(struct mlx5hws_actions_apply_data *apply,
			   struct mlx5hws_actions_wqe_setter *setter)
{}

static void
hws_action_setter_single(struct mlx5hws_actions_apply_data *apply,
			 struct mlx5hws_actions_wqe_setter *setter)
{}

static void
hws_action_setter_single_double_pop(struct mlx5hws_actions_apply_data *apply,
				    struct mlx5hws_actions_wqe_setter *setter)
{}

static void
hws_action_setter_hit(struct mlx5hws_actions_apply_data *apply,
		      struct mlx5hws_actions_wqe_setter *setter)
{}

static void
hws_action_setter_default_hit(struct mlx5hws_actions_apply_data *apply,
			      struct mlx5hws_actions_wqe_setter *setter)
{}

static void
hws_action_setter_hit_next_action(struct mlx5hws_actions_apply_data *apply,
				  struct mlx5hws_actions_wqe_setter *setter)
{}

static void
hws_action_setter_common_decap(struct mlx5hws_actions_apply_data *apply,
			       struct mlx5hws_actions_wqe_setter *setter)
{}

static void
hws_action_setter_range(struct mlx5hws_actions_apply_data *apply,
			struct mlx5hws_actions_wqe_setter *setter)
{}

int mlx5hws_action_template_process(struct mlx5hws_action_template *at)
{}

struct mlx5hws_action_template *
mlx5hws_action_template_create(enum mlx5hws_action_type action_type[])
{}

int mlx5hws_action_template_destroy(struct mlx5hws_action_template *at)
{}