DPDK patches and discussions
 help / color / mirror / Atom feed
From: Itamar Gozlan <igozlan@nvidia.com>
To: <igozlan@nvidia.com>, <erezsh@nvidia.com>, <hamdani@nvidia.com>,
	<kliteyn@nvidia.com>, <viacheslavo@nvidia.com>,
	<thomas@monjalon.net>, <suanmingm@nvidia.com>,
	Dariusz Sosnowski <dsosnowski@nvidia.com>,
	Ori Kam <orika@nvidia.com>, Matan Azrad <matan@nvidia.com>
Cc: <dev@dpdk.org>
Subject: [PATCH 7/9] net/mlx5/hws: extend action template creation API
Date: Tue, 13 Feb 2024 11:50:35 +0200	[thread overview]
Message-ID: <20240213095038.451299-7-igozlan@nvidia.com> (raw)
In-Reply-To: <20240213095038.451299-1-igozlan@nvidia.com>

From: Hamdan Igbaria <hamdani@nvidia.com>

Extend mlx5dr_action_template_create function params
to include flags parameter.

Signed-off-by: Hamdan Igbaria <hamdani@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/hws/mlx5dr.h         | 10 +++++++++-
 drivers/net/mlx5/hws/mlx5dr_action.c  | 11 ++++++++++-
 drivers/net/mlx5/hws/mlx5dr_action.h  |  1 +
 drivers/net/mlx5/hws/mlx5dr_matcher.c | 16 ++++++++++------
 drivers/net/mlx5/mlx5_flow_hw.c       |  2 +-
 5 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/drivers/net/mlx5/hws/mlx5dr.h b/drivers/net/mlx5/hws/mlx5dr.h
index 9d8f8e13dc..c11ec08616 100644
--- a/drivers/net/mlx5/hws/mlx5dr.h
+++ b/drivers/net/mlx5/hws/mlx5dr.h
@@ -84,6 +84,11 @@ enum mlx5dr_match_template_flags {
 	MLX5DR_MATCH_TEMPLATE_FLAG_RELAXED_MATCH = 1,
 };
 
+enum mlx5dr_action_template_flags {
+	/* Allow relaxed actions order. */
+	MLX5DR_ACTION_TEMPLATE_FLAG_RELAXED_ORDER = 1 << 0,
+};
+
 enum mlx5dr_send_queue_actions {
 	/* Start executing all pending queued rules */
 	MLX5DR_SEND_QUEUE_ACTION_DRAIN_ASYNC = 1 << 0,
@@ -362,10 +367,13 @@ int mlx5dr_match_template_destroy(struct mlx5dr_match_template *mt);
  *	An array of actions based on the order of actions which will be provided
  *	with rule_actions to mlx5dr_rule_create. The last action is marked
  *	using MLX5DR_ACTION_TYP_LAST.
+ * @param[in] flags
+ *	Template creation flags
  * @return pointer to mlx5dr_action_template on success NULL otherwise
  */
 struct mlx5dr_action_template *
-mlx5dr_action_template_create(const enum mlx5dr_action_type action_type[]);
+mlx5dr_action_template_create(const enum mlx5dr_action_type action_type[],
+			      uint32_t flags);
 
 /* Destroy action template.
  *
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.c b/drivers/net/mlx5/hws/mlx5dr_action.c
index 862ee3e332..370886907f 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.c
+++ b/drivers/net/mlx5/hws/mlx5dr_action.c
@@ -3385,12 +3385,19 @@ int mlx5dr_action_template_process(struct mlx5dr_action_template *at)
 }
 
 struct mlx5dr_action_template *
-mlx5dr_action_template_create(const enum mlx5dr_action_type action_type[])
+mlx5dr_action_template_create(const enum mlx5dr_action_type action_type[],
+			      uint32_t flags)
 {
 	struct mlx5dr_action_template *at;
 	uint8_t num_actions = 0;
 	int i;
 
+	if (flags > MLX5DR_ACTION_TEMPLATE_FLAG_RELAXED_ORDER) {
+		DR_LOG(ERR, "Unsupported action template flag provided");
+		rte_errno = EINVAL;
+		return NULL;
+	}
+
 	at = simple_calloc(1, sizeof(*at));
 	if (!at) {
 		DR_LOG(ERR, "Failed to allocate action template");
@@ -3398,6 +3405,8 @@ mlx5dr_action_template_create(const enum mlx5dr_action_type action_type[])
 		return NULL;
 	}
 
+	at->flags = flags;
+
 	while (action_type[num_actions++] != MLX5DR_ACTION_TYP_LAST)
 		;
 
diff --git a/drivers/net/mlx5/hws/mlx5dr_action.h b/drivers/net/mlx5/hws/mlx5dr_action.h
index fad35a845b..a8d9720c42 100644
--- a/drivers/net/mlx5/hws/mlx5dr_action.h
+++ b/drivers/net/mlx5/hws/mlx5dr_action.h
@@ -119,6 +119,7 @@ struct mlx5dr_action_template {
 	uint8_t num_of_action_stes;
 	uint8_t num_actions;
 	uint8_t only_term;
+	uint32_t flags;
 };
 
 struct mlx5dr_action {
diff --git a/drivers/net/mlx5/hws/mlx5dr_matcher.c b/drivers/net/mlx5/hws/mlx5dr_matcher.c
index 0d5c462734..402242308d 100644
--- a/drivers/net/mlx5/hws/mlx5dr_matcher.c
+++ b/drivers/net/mlx5/hws/mlx5dr_matcher.c
@@ -686,12 +686,16 @@ static int mlx5dr_matcher_check_and_process_at(struct mlx5dr_matcher *matcher,
 	bool valid;
 	int ret;
 
-	/* Check if action combinabtion is valid */
-	valid = mlx5dr_action_check_combo(at->action_type_arr, matcher->tbl->type);
-	if (!valid) {
-		DR_LOG(ERR, "Invalid combination in action template");
-		rte_errno = EINVAL;
-		return rte_errno;
+	if (!(at->flags & MLX5DR_ACTION_TEMPLATE_FLAG_RELAXED_ORDER)) {
+		/* Check if actions combinabtion is valid,
+		 * in the case of not relaxed actions order.
+		 */
+		valid = mlx5dr_action_check_combo(at->action_type_arr, matcher->tbl->type);
+		if (!valid) {
+			DR_LOG(ERR, "Invalid combination in action template");
+			rte_errno = EINVAL;
+			return rte_errno;
+		}
 	}
 
 	/* Process action template to setters */
diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 3af5e1f160..5ad45ce2ae 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -6198,7 +6198,7 @@ flow_hw_dr_actions_template_create(struct rte_eth_dev *dev,
 		at->recom_off = recom_off;
 		action_types[recom_off] = recom_type;
 	}
-	dr_template = mlx5dr_action_template_create(action_types);
+	dr_template = mlx5dr_action_template_create(action_types, 0);
 	if (dr_template) {
 		at->dr_actions_num = curr_off;
 	} else {
-- 
2.39.3


  parent reply	other threads:[~2024-02-13  9:51 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13  9:50 [PATCH 1/9] net/mlx5/hws: skip RTE item when inserting rules by index Itamar Gozlan
2024-02-13  9:50 ` [PATCH 2/9] net/mlx5/hws: add check for not supported fields in VXLAN Itamar Gozlan
2024-02-13  9:50 ` [PATCH 3/9] net/mlx5/hws: add support for resizable matchers Itamar Gozlan
2024-02-13  9:50 ` [PATCH 4/9] net/mlx5/hws: reordering the STE fields to improve hash Itamar Gozlan
2024-02-13  9:50 ` [PATCH 5/9] net/mlx5/hws: check the rule status on rule update Itamar Gozlan
2024-02-13  9:50 ` [PATCH 6/9] net/mlx5/hws: fix VLAN item handling on non relaxed mode Itamar Gozlan
2024-02-13  9:50 ` Itamar Gozlan [this message]
2024-02-13  9:50 ` [PATCH 8/9] net/mlx5/hws: add missing actions STE limitation Itamar Gozlan
2024-02-13  9:50 ` [PATCH 9/9] net/mlx5/hws: support push_esp flag for insert header action Itamar Gozlan
2024-02-18  5:11   ` [v2 01/10] net/mlx5/hws: skip RTE item when inserting rules by index Itamar Gozlan
2024-02-18  5:11     ` [v2 02/10] net/mlx5/hws: add check for not supported fields in VXLAN Itamar Gozlan
2024-02-18  5:11     ` [v2 03/10] net/mlx5/hws: add support for resizable matchers Itamar Gozlan
2024-02-18  5:11     ` [v2 04/10] net/mlx5/hws: reordering the STE fields to improve hash Itamar Gozlan
2024-02-18  5:11     ` [v2 05/10] net/mlx5/hws: check the rule status on rule update Itamar Gozlan
2024-02-18  5:11     ` [v2 06/10] net/mlx5/hws: fix VLAN item handling on non relaxed mode Itamar Gozlan
2024-02-18  5:11     ` [v2 07/10] net/mlx5/hws: extend action template creation API Itamar Gozlan
2024-02-18  5:11     ` [v2 08/10] net/mlx5/hws: add missing actions STE limitation Itamar Gozlan
2024-02-18  5:11     ` [v2 09/10] net/mlx5/hws: support push_esp flag for insert header action Itamar Gozlan
2024-02-18  5:11     ` [v2 10/10] net/mlx5/hws: typo fix parm to param Itamar Gozlan
2024-02-26 10:16     ` [v2 01/10] net/mlx5/hws: skip RTE item when inserting rules by index Raslan Darawsheh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240213095038.451299-7-igozlan@nvidia.com \
    --to=igozlan@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=erezsh@nvidia.com \
    --cc=hamdani@nvidia.com \
    --cc=kliteyn@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=suanmingm@nvidia.com \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).