Commit d65dbedf authored by Huy Nguyen's avatar Huy Nguyen Committed by Saeed Mahameed

net/mlx5: Add support for COPY steering action

Add COPY type to modify_header action. IPsec feature is the first
feature that needs COPY steering action.
Signed-off-by: default avatarHuy Nguyen <huyn@mellanox.com>
Signed-off-by: default avatarRaed Salem <raeds@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Acked-by: default avatarLeon Romanovsky <leonro@mellanox.com>
parent e0b4b472
...@@ -427,7 +427,7 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_FLOW_ACTION_CREATE_MODIFY_HEADER)( ...@@ -427,7 +427,7 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_FLOW_ACTION_CREATE_MODIFY_HEADER)(
num_actions = uverbs_attr_ptr_get_array_size( num_actions = uverbs_attr_ptr_get_array_size(
attrs, MLX5_IB_ATTR_CREATE_MODIFY_HEADER_ACTIONS_PRM, attrs, MLX5_IB_ATTR_CREATE_MODIFY_HEADER_ACTIONS_PRM,
MLX5_UN_SZ_BYTES(set_action_in_add_action_in_auto)); MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto));
if (num_actions < 0) if (num_actions < 0)
return num_actions; return num_actions;
...@@ -648,7 +648,7 @@ DECLARE_UVERBS_NAMED_METHOD( ...@@ -648,7 +648,7 @@ DECLARE_UVERBS_NAMED_METHOD(
UA_MANDATORY), UA_MANDATORY),
UVERBS_ATTR_PTR_IN(MLX5_IB_ATTR_CREATE_MODIFY_HEADER_ACTIONS_PRM, UVERBS_ATTR_PTR_IN(MLX5_IB_ATTR_CREATE_MODIFY_HEADER_ACTIONS_PRM,
UVERBS_ATTR_MIN_SIZE(MLX5_UN_SZ_BYTES( UVERBS_ATTR_MIN_SIZE(MLX5_UN_SZ_BYTES(
set_action_in_add_action_in_auto)), set_add_copy_action_in_auto)),
UA_MANDATORY, UA_MANDATORY,
UA_ALLOC_AND_COPY), UA_ALLOC_AND_COPY),
UVERBS_ATTR_CONST_IN(MLX5_IB_ATTR_CREATE_MODIFY_HEADER_FT_TYPE, UVERBS_ATTR_CONST_IN(MLX5_IB_ATTR_CREATE_MODIFY_HEADER_FT_TYPE,
......
...@@ -385,7 +385,7 @@ mlx5_tc_ct_entry_create_nat(struct mlx5_tc_ct_priv *ct_priv, ...@@ -385,7 +385,7 @@ mlx5_tc_ct_entry_create_nat(struct mlx5_tc_ct_priv *ct_priv,
char *modact; char *modact;
int err, i; int err, i;
action_size = MLX5_UN_SZ_BYTES(set_action_in_add_action_in_auto); action_size = MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto);
flow_action_for_each(i, act, flow_action) { flow_action_for_each(i, act, flow_action) {
switch (act->id) { switch (act->id) {
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
#include "lib/geneve.h" #include "lib/geneve.h"
#include "diag/en_tc_tracepoint.h" #include "diag/en_tc_tracepoint.h"
#define MLX5_MH_ACT_SZ MLX5_UN_SZ_BYTES(set_action_in_add_action_in_auto) #define MLX5_MH_ACT_SZ MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto)
struct mlx5_nic_flow_attr { struct mlx5_nic_flow_attr {
u32 action; u32 action;
...@@ -2660,7 +2660,7 @@ static int offload_pedit_fields(struct mlx5e_priv *priv, ...@@ -2660,7 +2660,7 @@ static int offload_pedit_fields(struct mlx5e_priv *priv,
set_vals = &hdrs[0].vals; set_vals = &hdrs[0].vals;
add_vals = &hdrs[1].vals; add_vals = &hdrs[1].vals;
action_size = MLX5_UN_SZ_BYTES(set_action_in_add_action_in_auto); action_size = MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto);
for (i = 0; i < ARRAY_SIZE(fields); i++) { for (i = 0; i < ARRAY_SIZE(fields); i++) {
bool skip; bool skip;
...@@ -2793,7 +2793,7 @@ int alloc_mod_hdr_actions(struct mlx5_core_dev *mdev, ...@@ -2793,7 +2793,7 @@ int alloc_mod_hdr_actions(struct mlx5_core_dev *mdev,
if (mod_hdr_acts->num_actions < mod_hdr_acts->max_actions) if (mod_hdr_acts->num_actions < mod_hdr_acts->max_actions)
return 0; return 0;
action_size = MLX5_UN_SZ_BYTES(set_action_in_add_action_in_auto); action_size = MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto);
max_hw_actions = mlx5e_flow_namespace_max_modify_action(mdev, max_hw_actions = mlx5e_flow_namespace_max_modify_action(mdev,
namespace); namespace);
......
...@@ -274,7 +274,7 @@ mlx5_esw_chains_destroy_fdb_table(struct mlx5_eswitch *esw, ...@@ -274,7 +274,7 @@ mlx5_esw_chains_destroy_fdb_table(struct mlx5_eswitch *esw,
static int static int
create_fdb_chain_restore(struct fdb_chain *fdb_chain) create_fdb_chain_restore(struct fdb_chain *fdb_chain)
{ {
char modact[MLX5_UN_SZ_BYTES(set_action_in_add_action_in_auto)]; char modact[MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto)];
struct mlx5_eswitch *esw = fdb_chain->esw; struct mlx5_eswitch *esw = fdb_chain->esw;
struct mlx5_modify_hdr *mod_hdr; struct mlx5_modify_hdr *mod_hdr;
u32 index; u32 index;
......
...@@ -1490,7 +1490,7 @@ static void esw_destroy_restore_table(struct mlx5_eswitch *esw) ...@@ -1490,7 +1490,7 @@ static void esw_destroy_restore_table(struct mlx5_eswitch *esw)
static int esw_create_restore_table(struct mlx5_eswitch *esw) static int esw_create_restore_table(struct mlx5_eswitch *esw)
{ {
u8 modact[MLX5_UN_SZ_BYTES(set_action_in_add_action_in_auto)] = {}; u8 modact[MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto)] = {};
int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in); int inlen = MLX5_ST_SZ_BYTES(create_flow_group_in);
struct mlx5_flow_table_attr ft_attr = {}; struct mlx5_flow_table_attr ft_attr = {};
struct mlx5_core_dev *dev = esw->dev; struct mlx5_core_dev *dev = esw->dev;
...@@ -1900,7 +1900,7 @@ static int esw_vport_ingress_prio_tag_config(struct mlx5_eswitch *esw, ...@@ -1900,7 +1900,7 @@ static int esw_vport_ingress_prio_tag_config(struct mlx5_eswitch *esw,
static int esw_vport_add_ingress_acl_modify_metadata(struct mlx5_eswitch *esw, static int esw_vport_add_ingress_acl_modify_metadata(struct mlx5_eswitch *esw,
struct mlx5_vport *vport) struct mlx5_vport *vport)
{ {
u8 action[MLX5_UN_SZ_BYTES(set_action_in_add_action_in_auto)] = {}; u8 action[MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto)] = {};
struct mlx5_flow_act flow_act = {}; struct mlx5_flow_act flow_act = {};
int err = 0; int err = 0;
u32 key; u32 key;
......
...@@ -791,7 +791,7 @@ static int mlx5_cmd_modify_header_alloc(struct mlx5_flow_root_namespace *ns, ...@@ -791,7 +791,7 @@ static int mlx5_cmd_modify_header_alloc(struct mlx5_flow_root_namespace *ns,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
actions_size = MLX5_UN_SZ_BYTES(set_action_in_add_action_in_auto) * num_actions; actions_size = MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto) * num_actions;
inlen = MLX5_ST_SZ_BYTES(alloc_modify_header_context_in) + actions_size; inlen = MLX5_ST_SZ_BYTES(alloc_modify_header_context_in) + actions_size;
in = kzalloc(inlen, GFP_KERNEL); in = kzalloc(inlen, GFP_KERNEL);
......
...@@ -576,7 +576,7 @@ static int mlx5_cmd_dr_modify_header_alloc(struct mlx5_flow_root_namespace *ns, ...@@ -576,7 +576,7 @@ static int mlx5_cmd_dr_modify_header_alloc(struct mlx5_flow_root_namespace *ns,
struct mlx5dr_action *action; struct mlx5dr_action *action;
size_t actions_sz; size_t actions_sz;
actions_sz = MLX5_UN_SZ_BYTES(set_action_in_add_action_in_auto) * actions_sz = MLX5_UN_SZ_BYTES(set_add_copy_action_in_auto) *
num_actions; num_actions;
action = mlx5dr_action_create_modify_header(dr_domain, 0, action = mlx5dr_action_create_modify_header(dr_domain, 0,
actions_sz, actions_sz,
......
...@@ -5670,9 +5670,9 @@ struct mlx5_ifc_copy_action_in_bits { ...@@ -5670,9 +5670,9 @@ struct mlx5_ifc_copy_action_in_bits {
u8 reserved_at_38[0x8]; u8 reserved_at_38[0x8];
}; };
union mlx5_ifc_set_action_in_add_action_in_auto_bits { union mlx5_ifc_set_add_copy_action_in_auto_bits {
struct mlx5_ifc_set_action_in_bits set_action_in; struct mlx5_ifc_set_action_in_bits set_action_in;
struct mlx5_ifc_add_action_in_bits add_action_in; struct mlx5_ifc_add_action_in_bits add_action_in;
struct mlx5_ifc_copy_action_in_bits copy_action_in; struct mlx5_ifc_copy_action_in_bits copy_action_in;
u8 reserved_at_0[0x40]; u8 reserved_at_0[0x40];
}; };
...@@ -5746,7 +5746,7 @@ struct mlx5_ifc_alloc_modify_header_context_in_bits { ...@@ -5746,7 +5746,7 @@ struct mlx5_ifc_alloc_modify_header_context_in_bits {
u8 reserved_at_68[0x10]; u8 reserved_at_68[0x10];
u8 num_of_actions[0x8]; u8 num_of_actions[0x8];
union mlx5_ifc_set_action_in_add_action_in_auto_bits actions[0]; union mlx5_ifc_set_add_copy_action_in_auto_bits actions[0];
}; };
struct mlx5_ifc_dealloc_modify_header_context_out_bits { struct mlx5_ifc_dealloc_modify_header_context_out_bits {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment