[v2,02/11] net/mlx5/hws: add check for matcher rule update support
Checks
Commit Message
From: Erez Shitrit <erezsh@nvidia.com>
The user want to know before trying to update a rule if that matcher that
keeps the original rule supports updating.
Signed-off-by: Erez Shitrit <erezsh@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
drivers/net/mlx5/hws/mlx5dr.h | 8 ++++++++
drivers/net/mlx5/hws/mlx5dr_matcher.c | 12 ++++++++++++
2 files changed, 20 insertions(+)
@@ -492,6 +492,14 @@ int mlx5dr_matcher_resize_rule_move(struct mlx5dr_matcher *src_matcher,
struct mlx5dr_rule *rule,
struct mlx5dr_rule_attr *attr);
+/* Check matcher ability to update existing rules
+ *
+ * @param[in] matcher
+ * that the rule belongs to.
+ * @return true when the matcher is updatable false otherwise.
+ */
+bool mlx5dr_matcher_is_updatable(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.
@@ -1530,6 +1530,18 @@ int mlx5dr_match_template_destroy(struct mlx5dr_match_template *mt)
return 0;
}
+bool mlx5dr_matcher_is_updatable(struct mlx5dr_matcher *matcher)
+{
+ if (mlx5dr_table_is_root(matcher->tbl) ||
+ mlx5dr_matcher_req_fw_wqe(matcher) ||
+ mlx5dr_matcher_is_resizable(matcher) ||
+ (!matcher->attr.optimize_using_rule_idx &&
+ !mlx5dr_matcher_is_insert_by_idx(matcher)))
+ return false;
+
+ return true;
+}
+
static int mlx5dr_matcher_resize_precheck(struct mlx5dr_matcher *src_matcher,
struct mlx5dr_matcher *dst_matcher)
{