[v3,5/8] net/mlx5: store expected type on indirect action
Checks
Commit Message
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_INDIRECT actions in
this list with information about expected indirect action type.
This will be used in follow up commits which add flow rule operation
validation. Specifically, this will be used to verify if indirect action
provided by the user references an action of a correct type.
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
drivers/net/mlx5/mlx5_flow.h | 4 ++++
drivers/net/mlx5/mlx5_flow_hw.c | 22 ++++++++++++++++++++--
2 files changed, 24 insertions(+), 2 deletions(-)
@@ -1442,6 +1442,10 @@ struct mlx5_action_construct_data {
uint16_t action_dst; /* mlx5dr_rule_action dst offset. */
indirect_list_callback_t indirect_list_cb;
union {
+ struct {
+ /* Expected type of indirection action. */
+ enum rte_flow_action_type expected_type;
+ } indirect;
struct {
/* encap data len. */
uint16_t len;
@@ -997,6 +997,24 @@ __flow_hw_act_data_general_append(struct mlx5_priv *priv,
return 0;
}
+static __rte_always_inline int
+__flow_hw_act_data_indirect_append(struct mlx5_priv *priv,
+ struct mlx5_hw_actions *acts,
+ enum rte_flow_action_type type,
+ enum rte_flow_action_type mask_type,
+ uint16_t action_src,
+ uint16_t action_dst)
+{
+ struct mlx5_action_construct_data *act_data;
+
+ act_data = __flow_hw_act_data_alloc(priv, type, action_src, action_dst);
+ if (!act_data)
+ return -1;
+ act_data->indirect.expected_type = mask_type;
+ LIST_INSERT_HEAD(&acts->act_list, act_data, next);
+ return 0;
+}
+
static __rte_always_inline int
flow_hw_act_data_indirect_list_append(struct mlx5_priv *priv,
struct mlx5_hw_actions *acts,
@@ -2486,9 +2504,9 @@ __flow_hw_translate_actions_template(struct rte_eth_dev *dev,
if (flow_hw_shared_action_translate
(dev, actions, acts, src_pos, dr_pos))
goto err;
- } else if (__flow_hw_act_data_general_append
+ } else if (__flow_hw_act_data_indirect_append
(priv, acts, RTE_FLOW_ACTION_TYPE_INDIRECT,
- src_pos, dr_pos)){
+ masks->type, src_pos, dr_pos)){
goto err;
}
break;