DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bing Zhao <bingz@nvidia.com>
To: <matan@nvidia.com>, <viacheslavo@nvidia.com>, <orika@nvidia.com>,
	<suanmingm@nvidia.com>, <rasland@nvidia.com>
Cc: <dev@dpdk.org>, <getelson@nvidia.com>
Subject: [PATCH 7/7] net/mlx5: fix the error in VLAN actions creation
Date: Fri, 30 Jun 2023 09:39:50 +0300	[thread overview]
Message-ID: <20230630063950.432641-1-bingz@nvidia.com> (raw)

When a failure occurs during the VLAN actions creating, the value
of "rte_errno" is already set by the mlx5dr_action_create*. The
value can be returned directly to reflect the actual reason.

In the meanwhile, the "rte_flow_error" structure should also be set
with explict message.

Fixes: 773ca0e91ba1 ("net/mlx5: support VLAN push/pop/modify with HWS")
Cc: getelson@nvidia.com

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_hw.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c
index 20941b4fc7..36a7f0989c 100644
--- a/drivers/net/mlx5/mlx5_flow_hw.c
+++ b/drivers/net/mlx5/mlx5_flow_hw.c
@@ -7125,27 +7125,28 @@ flow_hw_create_vlan(struct rte_eth_dev *dev)
 		MLX5DR_ACTION_FLAG_HWS_FDB
 	};
 
+	/* rte_errno is set in the mlx5dr_action* functions. */
 	for (i = MLX5DR_TABLE_TYPE_NIC_RX; i <= MLX5DR_TABLE_TYPE_NIC_TX; i++) {
 		priv->hw_pop_vlan[i] =
 			mlx5dr_action_create_pop_vlan(priv->dr_ctx, flags[i]);
 		if (!priv->hw_pop_vlan[i])
-			return -ENOENT;
+			return -rte_errno;
 		priv->hw_push_vlan[i] =
 			mlx5dr_action_create_push_vlan(priv->dr_ctx, flags[i]);
 		if (!priv->hw_pop_vlan[i])
-			return -ENOENT;
+			return -rte_errno;
 	}
 	if (priv->sh->config.dv_esw_en && priv->master) {
 		priv->hw_pop_vlan[MLX5DR_TABLE_TYPE_FDB] =
 			mlx5dr_action_create_pop_vlan
 				(priv->dr_ctx, MLX5DR_ACTION_FLAG_HWS_FDB);
 		if (!priv->hw_pop_vlan[MLX5DR_TABLE_TYPE_FDB])
-			return -ENOENT;
+			return -rte_errno;
 		priv->hw_push_vlan[MLX5DR_TABLE_TYPE_FDB] =
 			mlx5dr_action_create_push_vlan
 				(priv->dr_ctx, MLX5DR_ACTION_FLAG_HWS_FDB);
 		if (!priv->hw_pop_vlan[MLX5DR_TABLE_TYPE_FDB])
-			return -ENOENT;
+			return -rte_errno;
 	}
 	return 0;
 }
@@ -7920,8 +7921,11 @@ flow_hw_configure(struct rte_eth_dev *dev,
 		}
 	}
 	ret = flow_hw_create_vlan(dev);
-	if (ret)
+	if (ret) {
+		rte_flow_error_set(error, -ret, RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+				   NULL, "Failed to VLAN actions.");
 		goto err;
+	}
 	if (_queue_attr)
 		mlx5_free(_queue_attr);
 	if (port_attr->flags & RTE_FLOW_PORT_FLAG_STRICT_QUEUE)
-- 
2.34.1


             reply	other threads:[~2023-06-30  6:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-30  6:39 Bing Zhao [this message]
2023-06-30 10:51 ` [PATCH v2] " Bing Zhao
2023-06-30 11:02   ` [PATCH v3] " Bing Zhao
2023-07-03 13:57     ` 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=20230630063950.432641-1-bingz@nvidia.com \
    --to=bingz@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=getelson@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=suanmingm@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).