DPDK patches and discussions
 help / color / mirror / Atom feed
From: Alexander Kozyrev <akozyrev@nvidia.com>
To: <dev@dpdk.org>
Cc: <stable@dpdk.org>, <rasland@nvidia.com>, <viacheslavo@nvidia.com>,
	<matan@nvidia.com>, Bing Zhao <bingz@nvidia.com>
Subject: [PATCH 1/3] net/mlx5: fix validation for conntrack indirect action
Date: Tue, 11 Jul 2023 18:20:42 +0300	[thread overview]
Message-ID: <20230711152044.3141138-1-akozyrev@nvidia.com> (raw)

From: Bing Zhao <bingz@nvidia.com>

After rte_flow_shared_action_* API was replaced with
rte_flow_action_handle_* API, one input parameter of the update
interface was also changed. A generic pointer was used instead of the
"const struct rte_flow_action *" pointer.

In the entrance of mlx5 PMD callback for update, the validation is
called for all indirect actions. But for conntrack type, the pointer
is no longer with rte_flow_action pointer type and it will cause an
incorrect casting and error.

The content for updating should only be validated when needed. It
should skip the validation in the entrance. Right now, the content
was already added before updating the hardware by WQE. So the type
of the indirect action should be checked before calling the action
validate function.

When creating a new conntrack object, the validation is still needed
since all the content will be used to update the hardware context.

Fixes: 40327aab1491 ("ethdev: introduce indirect flow action")

Signed-off-by: Bing Zhao <bingz@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 4b567f61dd..9bd92f28fd 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -10753,9 +10753,18 @@ mlx5_action_handle_update(struct rte_eth_dev *dev,
 	const struct mlx5_flow_driver_ops *fops =
 			flow_get_drv_ops(flow_get_drv_type(dev, &attr));
 	int ret;
+	uint32_t act_idx = (uint32_t)(uintptr_t)handle;
+	uint32_t type = act_idx >> MLX5_INDIRECT_ACTION_TYPE_OFFSET;
 
-	ret = flow_drv_action_validate(dev, NULL,
-			(const struct rte_flow_action *)update, fops, error);
+	switch (type) {
+	case MLX5_INDIRECT_ACTION_TYPE_CT:
+		ret = 0;
+		break;
+	default:
+		ret = flow_drv_action_validate(dev, NULL,
+				(const struct rte_flow_action *)update,
+				fops, error);
+	}
 	if (ret)
 		return ret;
 	return flow_drv_action_update(dev, handle, update, fops,
-- 
2.18.2


             reply	other threads:[~2023-07-11 15:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-11 15:20 Alexander Kozyrev [this message]
2023-07-11 15:20 ` [PATCH 2/3] net/mlx5: fix handle validation for meter mark Alexander Kozyrev
2023-07-18  9:02   ` Suanming Mou
2023-07-11 15:20 ` [PATCH 3/3] app/testpmd: fix meter mark handle update Alexander Kozyrev
2023-07-11 16:15   ` Stephen Hemminger
2023-07-18 13:27     ` Alexander Kozyrev
2023-07-18  9:01 ` [PATCH 1/3] net/mlx5: fix validation for conntrack indirect action Suanming Mou
2023-07-18 13:32 ` [PATCH v2 " Alexander Kozyrev
2023-07-18 13:32   ` [PATCH v2 2/3] net/mlx5: fix handle validation for meter mark Alexander Kozyrev
2023-07-18 14:31     ` Ori Kam
2023-07-18 13:32   ` [PATCH v2 3/3] app/testpmd: fix meter mark handle update Alexander Kozyrev
2023-07-18 14:32     ` Ori Kam
2023-07-18 14:29   ` [PATCH v2 1/3] net/mlx5: fix validation for conntrack indirect action Ori Kam
2023-07-18 15:51   ` 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=20230711152044.3141138-1-akozyrev@nvidia.com \
    --to=akozyrev@nvidia.com \
    --cc=bingz@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=stable@dpdk.org \
    --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).