When template table is created, list of unmasked actions is recorded for future flow rule insertions. This patch expands entries for RTE_FLOW_ACTION_TYPE_MODIFY_FIELD actions in this list with a copy of the action from the template. This will be used in follow up commits which add flow rule operation validation. Specifically, to validate that RTE_FLOW_ACTION_TYPE_MODIFY_FIELD action passed by the user is correctly configured.
Signed-off-by: Dariusz Sosnowski <dsosnow...@nvidia.com> Acked-by: Ori Kam <or...@nvidia.com> --- drivers/net/mlx5/mlx5_flow.h | 2 ++ drivers/net/mlx5/mlx5_flow_hw.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index cd6fed4723..5ea3f22a2e 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -1439,6 +1439,8 @@ struct mlx5_action_construct_data { * PRM actions. */ uint32_t mask[MLX5_ACT_MAX_MOD_FIELDS]; + /* Copy of action passed to the action template. */ + struct rte_flow_action_modify_field action; } modify_header; struct { bool symmetric_hash_function; /* Symmetric RSS hash */ diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 5e9d43ab22..a04e8647cb 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -883,6 +883,7 @@ __flow_hw_act_data_hdr_modify_append(struct mlx5_priv *priv, enum rte_flow_action_type type, uint16_t action_src, uint16_t action_dst, + const struct rte_flow_action_modify_field *mf, uint16_t mhdr_cmds_off, uint16_t mhdr_cmds_end, bool shared, @@ -895,6 +896,7 @@ __flow_hw_act_data_hdr_modify_append(struct mlx5_priv *priv, act_data = __flow_hw_act_data_alloc(priv, type, action_src, action_dst); if (!act_data) return -1; + act_data->modify_header.action = *mf; act_data->modify_header.mhdr_cmds_off = mhdr_cmds_off; act_data->modify_header.mhdr_cmds_end = mhdr_cmds_end; act_data->modify_header.shared = shared; @@ -1372,7 +1374,7 @@ flow_hw_modify_field_compile(struct rte_eth_dev *dev, if (shared) return 0; ret = __flow_hw_act_data_hdr_modify_append(priv, acts, RTE_FLOW_ACTION_TYPE_MODIFY_FIELD, - src_pos, mhdr->pos, + src_pos, mhdr->pos, conf, cmds_start, cmds_end, shared, field, dcopy, mask); if (ret) -- 2.39.2