Commit 0caebadd authored by Yevgeny Kliteynik's avatar Yevgeny Kliteynik Committed by Saeed Mahameed

net/mlx5: DR, Add modify header argument pointer to actions attributes

While building the actions, add the pointer of the arguments for
accelerated modify list action into the action's attributes.
This will be used later on while building the specific STE
for this action.
Signed-off-by: default avatarYevgeny Kliteynik <kliteyn@nvidia.com>
Reviewed-by: default avatarAlex Vesker <valex@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 608d4f17
...@@ -819,14 +819,28 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher, ...@@ -819,14 +819,28 @@ int mlx5dr_actions_build_ste_arr(struct mlx5dr_matcher *matcher,
case DR_ACTION_TYP_TNL_L2_TO_L2: case DR_ACTION_TYP_TNL_L2_TO_L2:
break; break;
case DR_ACTION_TYP_TNL_L3_TO_L2: case DR_ACTION_TYP_TNL_L3_TO_L2:
attr.decap_index = action->rewrite->index; if (action->rewrite->ptrn && action->rewrite->arg) {
attr.decap_actions = action->rewrite->num_of_actions; attr.decap_index = mlx5dr_arg_get_obj_id(action->rewrite->arg);
attr.decap_with_vlan = attr.decap_actions = action->rewrite->ptrn->num_of_actions;
attr.decap_actions == WITH_VLAN_NUM_HW_ACTIONS; attr.decap_pat_idx = action->rewrite->ptrn->index;
} else {
attr.decap_index = action->rewrite->index;
attr.decap_actions = action->rewrite->num_of_actions;
attr.decap_with_vlan =
attr.decap_actions == WITH_VLAN_NUM_HW_ACTIONS;
attr.decap_pat_idx = MLX5DR_INVALID_PATTERN_INDEX;
}
break; break;
case DR_ACTION_TYP_MODIFY_HDR: case DR_ACTION_TYP_MODIFY_HDR:
attr.modify_index = action->rewrite->index; if (action->rewrite->ptrn && action->rewrite->arg) {
attr.modify_actions = action->rewrite->num_of_actions; attr.modify_index = mlx5dr_arg_get_obj_id(action->rewrite->arg);
attr.modify_actions = action->rewrite->ptrn->num_of_actions;
attr.modify_pat_idx = action->rewrite->ptrn->index;
} else {
attr.modify_index = action->rewrite->index;
attr.modify_actions = action->rewrite->num_of_actions;
attr.modify_pat_idx = MLX5DR_INVALID_PATTERN_INDEX;
}
if (action->rewrite->modify_ttl) if (action->rewrite->modify_ttl)
dr_action_modify_ttl_adjust(dmn, &attr, rx_rule, dr_action_modify_ttl_adjust(dmn, &attr, rx_rule,
&recalc_cs_required); &recalc_cs_required);
......
...@@ -2179,27 +2179,44 @@ dr_ste_v1_build_tnl_gtpu_flex_parser_1_init(struct mlx5dr_ste_build *sb, ...@@ -2179,27 +2179,44 @@ dr_ste_v1_build_tnl_gtpu_flex_parser_1_init(struct mlx5dr_ste_build *sb,
int dr_ste_v1_alloc_modify_hdr_ptrn_arg(struct mlx5dr_action *action) int dr_ste_v1_alloc_modify_hdr_ptrn_arg(struct mlx5dr_action *action)
{ {
struct mlx5dr_ptrn_mgr *ptrn_mgr; struct mlx5dr_ptrn_mgr *ptrn_mgr;
int ret;
ptrn_mgr = action->rewrite->dmn->ptrn_mgr; ptrn_mgr = action->rewrite->dmn->ptrn_mgr;
if (!ptrn_mgr) if (!ptrn_mgr)
return -EOPNOTSUPP; return -EOPNOTSUPP;
action->rewrite->arg = mlx5dr_arg_get_obj(action->rewrite->dmn->arg_mgr,
action->rewrite->num_of_actions,
action->rewrite->data);
if (!action->rewrite->arg) {
mlx5dr_err(action->rewrite->dmn, "Failed allocating args for modify header\n");
return -EAGAIN;
}
action->rewrite->ptrn = action->rewrite->ptrn =
mlx5dr_ptrn_cache_get_pattern(ptrn_mgr, mlx5dr_ptrn_cache_get_pattern(ptrn_mgr,
action->rewrite->num_of_actions, action->rewrite->num_of_actions,
action->rewrite->data); action->rewrite->data);
if (!action->rewrite->ptrn) { if (!action->rewrite->ptrn) {
mlx5dr_err(action->rewrite->dmn, "Failed to get pattern\n"); mlx5dr_err(action->rewrite->dmn, "Failed to get pattern\n");
return -EAGAIN; ret = -EAGAIN;
goto put_arg;
} }
return 0; return 0;
put_arg:
mlx5dr_arg_put_obj(action->rewrite->dmn->arg_mgr,
action->rewrite->arg);
return ret;
} }
void dr_ste_v1_free_modify_hdr_ptrn_arg(struct mlx5dr_action *action) void dr_ste_v1_free_modify_hdr_ptrn_arg(struct mlx5dr_action *action)
{ {
mlx5dr_ptrn_cache_put_pattern(action->rewrite->dmn->ptrn_mgr, mlx5dr_ptrn_cache_put_pattern(action->rewrite->dmn->ptrn_mgr,
action->rewrite->ptrn); action->rewrite->ptrn);
mlx5dr_arg_put_obj(action->rewrite->dmn->arg_mgr,
action->rewrite->arg);
} }
static struct mlx5dr_ste_ctx ste_ctx_v1 = { static struct mlx5dr_ste_ctx ste_ctx_v1 = {
......
...@@ -261,11 +261,14 @@ u64 mlx5dr_ste_get_mr_addr(struct mlx5dr_ste *ste); ...@@ -261,11 +261,14 @@ u64 mlx5dr_ste_get_mr_addr(struct mlx5dr_ste *ste);
struct list_head *mlx5dr_ste_get_miss_list(struct mlx5dr_ste *ste); struct list_head *mlx5dr_ste_get_miss_list(struct mlx5dr_ste *ste);
#define MLX5DR_MAX_VLANS 2 #define MLX5DR_MAX_VLANS 2
#define MLX5DR_INVALID_PATTERN_INDEX 0xffffffff
struct mlx5dr_ste_actions_attr { struct mlx5dr_ste_actions_attr {
u32 modify_index; u32 modify_index;
u32 modify_pat_idx;
u16 modify_actions; u16 modify_actions;
u32 decap_index; u32 decap_index;
u32 decap_pat_idx;
u16 decap_actions; u16 decap_actions;
u8 decap_with_vlan:1; u8 decap_with_vlan:1;
u64 final_icm_addr; u64 final_icm_addr;
...@@ -1036,6 +1039,7 @@ struct mlx5dr_action_rewrite { ...@@ -1036,6 +1039,7 @@ struct mlx5dr_action_rewrite {
u8 allow_tx:1; u8 allow_tx:1;
u8 modify_ttl:1; u8 modify_ttl:1;
struct mlx5dr_ptrn_obj *ptrn; struct mlx5dr_ptrn_obj *ptrn;
struct mlx5dr_arg_obj *arg;
}; };
struct mlx5dr_action_reformat { struct mlx5dr_action_reformat {
......
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