}
break;
case DR_ACTION_TYP_MODIFY_HDR:
- if (action->rewrite->ptrn && action->rewrite->arg) {
- 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;
+ if (action->rewrite->single_action_opt) {
attr.modify_actions = action->rewrite->num_of_actions;
- attr.modify_pat_idx = MLX5DR_INVALID_PATTERN_INDEX;
+ attr.single_modify_action = action->rewrite->data;
+ } else {
+ if (action->rewrite->ptrn && action->rewrite->arg) {
+ 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)
dr_action_modify_ttl_adjust(dmn, &attr, rx_rule,
action->rewrite->data = (u8 *)hw_actions;
action->rewrite->num_of_actions = num_hw_actions;
- ret = mlx5dr_ste_alloc_modify_hdr(action);
- if (ret)
- goto free_hw_actions;
+ if (num_hw_actions == 1 &&
+ dmn->info.caps.sw_format_ver >= MLX5_STEERING_FORMAT_CONNECTX_6DX) {
+ action->rewrite->single_action_opt = true;
+ } else {
+ action->rewrite->single_action_opt = false;
+ ret = mlx5dr_ste_alloc_modify_hdr(action);
+ if (ret)
+ goto free_hw_actions;
+ }
return 0;
break;
case DR_ACTION_TYP_TNL_L3_TO_L2:
mlx5dr_ste_free_modify_hdr(action);
+ kfree(action->rewrite->data);
refcount_dec(&action->rewrite->dmn->refcount);
break;
case DR_ACTION_TYP_L2_TO_TNL_L2:
refcount_dec(&action->reformat->dmn->refcount);
break;
case DR_ACTION_TYP_MODIFY_HDR:
- mlx5dr_ste_free_modify_hdr(action);
+ if (!action->rewrite->single_action_opt)
+ mlx5dr_ste_free_modify_hdr(action);
+ kfree(action->rewrite->data);
refcount_dec(&action->rewrite->dmn->refcount);
break;
case DR_ACTION_TYP_SAMPLER:
u8 *d_action,
u16 num_of_actions,
u32 rewrite_pattern,
- u32 rewrite_args)
+ u32 rewrite_args,
+ u8 *action_data)
{
- MLX5_SET(ste_double_action_accelerated_modify_action_list_v1, d_action,
- action_id, DR_STE_V1_ACTION_ID_ACCELERATED_LIST);
- MLX5_SET(ste_double_action_accelerated_modify_action_list_v1, d_action,
- modify_actions_pattern_pointer, rewrite_pattern);
- MLX5_SET(ste_double_action_accelerated_modify_action_list_v1, d_action,
- number_of_modify_actions, num_of_actions);
- MLX5_SET(ste_double_action_accelerated_modify_action_list_v1, d_action,
- modify_actions_argument_pointer, rewrite_args);
+ if (action_data) {
+ memcpy(d_action, action_data, DR_MODIFY_ACTION_SIZE);
+ } else {
+ MLX5_SET(ste_double_action_accelerated_modify_action_list_v1, d_action,
+ action_id, DR_STE_V1_ACTION_ID_ACCELERATED_LIST);
+ MLX5_SET(ste_double_action_accelerated_modify_action_list_v1, d_action,
+ modify_actions_pattern_pointer, rewrite_pattern);
+ MLX5_SET(ste_double_action_accelerated_modify_action_list_v1, d_action,
+ number_of_modify_actions, num_of_actions);
+ MLX5_SET(ste_double_action_accelerated_modify_action_list_v1, d_action,
+ modify_actions_argument_pointer, rewrite_args);
+ }
dr_ste_v1_set_reparse(hw_ste_p);
}
u8 *action,
u16 num_of_actions,
u32 rewrite_pattern,
- u32 rewrite_args)
+ u32 rewrite_args,
+ u8 *action_data)
{
if (rewrite_pattern != MLX5DR_INVALID_PATTERN_INDEX)
return dr_ste_v1_set_accelerated_rewrite_actions(hw_ste_p,
action,
num_of_actions,
rewrite_pattern,
- rewrite_args);
+ rewrite_args,
+ action_data);
/* fall back to the code that doesn't support accelerated modify header */
return dr_ste_v1_set_basic_rewrite_actions(hw_ste_p,
dr_ste_v1_set_rewrite_actions(last_ste, action,
attr->modify_actions,
attr->modify_pat_idx,
- attr->modify_index);
+ attr->modify_index,
+ attr->single_modify_action);
action_sz -= DR_STE_ACTION_DOUBLE_SZ;
action += DR_STE_ACTION_DOUBLE_SZ;
allow_encap = false;
dr_ste_v1_set_rewrite_actions(last_ste, action,
attr->decap_actions,
attr->decap_pat_idx,
- attr->decap_index);
+ attr->decap_index,
+ NULL);
action_sz -= DR_STE_ACTION_DOUBLE_SZ;
action += DR_STE_ACTION_DOUBLE_SZ;
allow_modify_hdr = false;
dr_ste_v1_set_rewrite_actions(last_ste, action,
attr->modify_actions,
attr->modify_pat_idx,
- attr->modify_index);
+ attr->modify_index,
+ attr->single_modify_action);
action_sz -= DR_STE_ACTION_DOUBLE_SZ;
action += DR_STE_ACTION_DOUBLE_SZ;
}