[PATCH v2 03/11] net/mlx5/hws: add check if matcher contains complex rules
Dariusz Sosnowski
dsosnowski at nvidia.com
Thu Feb 29 12:51:48 CET 2024
From: Erez Shitrit <erezsh at nvidia.com>
The function returns true if that matcher can contain complicated rule,
which means rule that needs more than one writing to the HW in order to
have it.
Signed-off-by: Erez Shitrit <erezsh at nvidia.com>
Acked-by: Ori Kam <orika at nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr.h | 8 ++++++++
drivers/net/mlx5/hws/mlx5dr_action.c | 6 ++++++
drivers/net/mlx5/hws/mlx5dr_action.h | 2 ++
drivers/net/mlx5/hws/mlx5dr_matcher.c | 17 +++++++++++++++++
4 files changed, 33 insertions(+)
diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index c5824a6480..36ecccf9ac 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -500,6 +500,14 @@ int mlx5dr_matcher_resize_rule_move(struct mlx5dr_matcher *src_matcher,
*/
bool mlx5dr_matcher_is_updatable(struct mlx5dr_matcher *matcher);
+/* Check matcher if might contain rules that need complex structure
+ *
+ * @param[in] matcher
+ * that the rule belongs to.
+ * @return true when the matcher is contains such rules, false otherwise.
+ */
+bool mlx5dr_matcher_is_dependent(struct mlx5dr_matcher *matcher);
+
/* Get the size of the rule handle (mlx5dr_rule) to be used on rule creation.
*
* @return size in bytes of rule handle struct.
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 96cad553aa..084d4d606e 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -3686,6 +3686,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
setter->flags |= ASF_SINGLE1 | ASF_REMOVE;
setter->set_single = &mlx5dr_action_setter_ipv6_route_ext_pop;
setter->idx_single = i;
+ at->need_dep_write = true;
break;
case MLX5DR_ACTION_TYP_PUSH_IPV6_ROUTE_EXT:
@@ -3712,6 +3713,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
setter->set_double = &mlx5dr_action_setter_ipv6_route_ext_mhdr;
setter->idx_double = i;
setter->extra_data = 2;
+ at->need_dep_write = true;
break;
case MLX5DR_ACTION_TYP_MODIFY_HDR:
@@ -3720,6 +3722,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
setter->flags |= ASF_DOUBLE | ASF_MODIFY;
setter->set_double = &mlx5dr_action_setter_modify_header;
setter->idx_double = i;
+ at->need_dep_write = true;
break;
case MLX5DR_ACTION_TYP_ASO_METER:
@@ -3747,6 +3750,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
setter->flags |= ASF_DOUBLE | ASF_INSERT;
setter->set_double = &mlx5dr_action_setter_insert_ptr;
setter->idx_double = i;
+ at->need_dep_write = true;
break;
case MLX5DR_ACTION_TYP_REFORMAT_L2_TO_TNL_L3:
@@ -3757,6 +3761,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
setter->idx_double = i;
setter->set_single = &mlx5dr_action_setter_common_decap;
setter->idx_single = i;
+ at->need_dep_write = true;
break;
case MLX5DR_ACTION_TYP_REFORMAT_TNL_L3_TO_L2:
@@ -3765,6 +3770,7 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
setter->flags |= ASF_DOUBLE | ASF_MODIFY | ASF_INSERT;
setter->set_double = &mlx5dr_action_setter_tnl_l3_to_l2;
setter->idx_double = i;
+ at->need_dep_write = true;
break;
case MLX5DR_ACTION_TYP_TAG:
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.h b/drivers/net/mlx5/hws/mlx5dr_action.h
index 064c18a90c..57e059a572 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.h
+++ b/drivers/net/mlx5/hws/mlx5dr_action.h
@@ -151,6 +151,8 @@ struct mlx5dr_action_template {
uint8_t num_of_action_stes;
uint8_t num_actions;
uint8_t only_term;
+ /* indicates rule might require dependent wqe */
+ bool need_dep_write;
uint32_t flags;
};
diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c
index 4e4da8e8f6..1c64abfa57 100644
--- a/drivers/net/mlx5/hws/mlx5dr_matcher.c
+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c
@@ -1542,6 +1542,23 @@ bool mlx5dr_matcher_is_updatable(struct mlx5dr_matcher *matcher)
return true;
}
+bool mlx5dr_matcher_is_dependent(struct mlx5dr_matcher *matcher)
+{
+ int i;
+
+ if (matcher->action_ste.max_stes || mlx5dr_matcher_req_fw_wqe(matcher))
+ return true;
+
+ for (i = 0; i < matcher->num_of_at; i++) {
+ struct mlx5dr_action_template *at = &matcher->at[i];
+
+ if (at->need_dep_write)
+ return true;
+ }
+
+ return false;
+}
+
static int mlx5dr_matcher_resize_precheck(struct mlx5dr_matcher *src_matcher,
struct mlx5dr_matcher *dst_matcher)
{
--
2.39.2
More information about the dev
mailing list