DPDK patches and discussions
 help / color / mirror / Atom feed
From: Michael Savisko <michaelsav@nvidia.com>
To: <dev@dpdk.org>
Cc: <michaelsav@nvidia.com>, <orika@nvidia.com>,
	<viacheslavo@nvidia.com>, <asafp@nvidia.com>,
	Matan Azrad <matan@nvidia.com>
Subject: [PATCH 10/10] net/mlx5: translation of rte flow send to kernel action
Date: Tue, 20 Sep 2022 17:04:22 +0300	[thread overview]
Message-ID: <20220920140422.98165-11-michaelsav@nvidia.com> (raw)
In-Reply-To: <20220920140422.98165-1-michaelsav@nvidia.com>

Add flow_dv_translate_action_send_to_kernel() function which
will allocate rdma-core send_to_kernel action object.
Called from flow_dv_translate().

Signed-off-by: Michael Savisko <michaelsav@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 62 +++++++++++++++++++++++++++++++--
 1 file changed, 59 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 01bdd34d1d..bb9b8f9800 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -12175,6 +12175,56 @@ flow_dv_translate_action_sample(struct rte_eth_dev *dev,
 	return 0;
 }
 
+static void *
+flow_dv_translate_action_send_to_kernel(struct rte_eth_dev *dev,
+					struct rte_flow_error *error)
+{
+	struct mlx5_flow_tbl_resource *tbl;
+	struct mlx5_dev_ctx_shared *sh;
+	uint32_t priority;
+	void *action;
+	int ret;
+
+	sh = MLX5_SH(dev);
+	if (sh->send_to_kernel_action.action)
+		return sh->send_to_kernel_action.action;
+
+	priority = mlx5_get_send_to_kernel_priority(dev);
+	if (priority == (uint32_t)-1) {
+		rte_flow_error_set(error, ENOTSUP,
+				   RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+				   "required priority is not available");
+		return NULL;
+	}
+
+	tbl = flow_dv_tbl_resource_get(dev, 0, 0, 0, false, NULL, 0, 0, 0,
+				       error);
+	if (!tbl) {
+		rte_flow_error_set(error, ENODATA,
+				   RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+				   "cannot find destination root table");
+		return NULL;
+	}
+
+	ret = mlx5_flow_os_create_flow_action_send_to_kernel(tbl->obj,
+				priority, &action);
+	if (ret) {
+		rte_flow_error_set(error, ENOMEM,
+				   RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+				   "cannot create action");
+		goto err;
+	}
+
+	MLX5_ASSERT(action);
+	sh->send_to_kernel_action.action = action;
+	sh->send_to_kernel_action.tbl = tbl;
+	return action;
+
+err:
+	flow_dv_tbl_resource_release(sh, tbl);
+	return NULL;
+}
+
 /**
  * Convert Sample action to DV specification.
  *
@@ -13680,9 +13730,15 @@ flow_dv_translate(struct rte_eth_dev *dev,
 			action_flags |= MLX5_FLOW_ACTION_CT;
 			break;
 		case RTE_FLOW_ACTION_TYPE_SEND_TO_KERNEL:
-			return rte_flow_error_set(error, ENOTSUP,
-				RTE_FLOW_ERROR_TYPE_ACTION,
-				NULL, "send to kernel action is not supported.");
+			dev_flow->dv.actions[actions_n] =
+				flow_dv_translate_action_send_to_kernel(dev,
+							error);
+			if (!dev_flow->dv.actions[actions_n])
+				return -rte_errno;
+			actions_n++;
+			action_flags |= MLX5_FLOW_ACTION_SEND_TO_KERNEL;
+			dev_flow->handle->fate_action =
+					MLX5_FLOW_FATE_SEND_TO_KERNEL;
 			break;
 		case RTE_FLOW_ACTION_TYPE_END:
 			actions_end = true;
-- 
2.27.0


      parent reply	other threads:[~2022-09-20 14:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20 14:04 [PATCH 00/10] net/mlx5: implement " Michael Savisko
2022-09-20 14:04 ` [PATCH 01/10] common/mlx5: update meson build file Michael Savisko
2022-09-20 14:04 ` [PATCH 02/10] net/mlx5: disable send to kernel action in HW streering Michael Savisko
2022-09-20 14:04 ` [PATCH 03/10] common/mlx5: new glue callback for send to kernel action Michael Savisko
2022-09-20 14:04 ` [PATCH 04/10] net/mlx5: add function to create " Michael Savisko
2022-09-20 14:04 ` [PATCH 05/10] net/mlx5: introduce new mlx5 action flag Michael Savisko
2022-09-20 14:04 ` [PATCH 06/10] net/mlx5: introduce new mlx5 flow fate Michael Savisko
2022-09-20 14:04 ` [PATCH 07/10] net/mlx5: get priority to send traffic to kernel Michael Savisko
2022-09-20 14:04 ` [PATCH 08/10] net/mlx5: expose table resource release function Michael Savisko
2022-09-20 14:04 ` [PATCH 09/10] net/mlx5: add send to kernel action resource holder Michael Savisko
2022-09-20 14:04 ` Michael Savisko [this message]

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=20220920140422.98165-11-michaelsav@nvidia.com \
    --to=michaelsav@nvidia.com \
    --cc=asafp@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --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).