DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
To: <dev@dpdk.org>
Cc: <bingz@nvidia.com>, Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	"Matan Azrad" <matan@nvidia.com>,
	Shahaf Shuler <shahafs@nvidia.com>
Subject: [dpdk-dev] [PATCH 1/2] net/mlx5: report error on indirect CT action destroy
Date: Wed, 1 Sep 2021 11:19:57 +0300	[thread overview]
Message-ID: <20210901081958.3643375-2-dkozlyuk@nvidia.com> (raw)
In-Reply-To: <20210901081958.3643375-1-dkozlyuk@nvidia.com>

When an indirect CT action of mlx5 PMD could not be destroyed,
rte_action_handle_destroy() was returning (-1), but the error
structure was not filled. This lead to a segfault in testpmd
on an attempt to print it. Fill the details for each possible
cause of this error.

Fixes: c5a49265fc23 ("net/mlx5: add ASO connection tracking destroy")
Cc: bingz@nvidia.com

Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 3f6f5dcfba..b769ae4007 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -12304,17 +12304,27 @@ flow_dv_aso_ct_dev_release(struct rte_eth_dev *dev, uint32_t idx)
 }
 
 static inline int
-flow_dv_aso_ct_release(struct rte_eth_dev *dev, uint32_t own_idx)
+flow_dv_aso_ct_release(struct rte_eth_dev *dev, uint32_t own_idx,
+		       struct rte_flow_error *error)
 {
 	uint16_t owner = (uint16_t)MLX5_INDIRECT_ACT_CT_GET_OWNER(own_idx);
 	uint32_t idx = MLX5_INDIRECT_ACT_CT_GET_IDX(own_idx);
 	struct rte_eth_dev *owndev = &rte_eth_devices[owner];
-	RTE_SET_USED(dev);
+	int ret;
 
 	MLX5_ASSERT(owner < RTE_MAX_ETHPORTS);
 	if (dev->data->dev_started != 1)
-		return -1;
-	return flow_dv_aso_ct_dev_release(owndev, idx);
+		return rte_flow_error_set(error, EAGAIN,
+					  RTE_FLOW_ERROR_TYPE_ACTION,
+					  NULL,
+					  "Indirect CT action cannot be destroyed when the port is stopped");
+	ret = flow_dv_aso_ct_dev_release(owndev, idx);
+	if (ret < 0)
+		return rte_flow_error_set(error, EAGAIN,
+					  RTE_FLOW_ERROR_TYPE_ACTION,
+					  NULL,
+					  "Current state prevents indirect CT action from being destroyed");
+	return ret;
 }
 
 /*
@@ -14365,7 +14375,7 @@ flow_dv_destroy(struct rte_eth_dev *dev, struct rte_flow *flow)
 	}
 	/* Keep the current age handling by default. */
 	if (flow->indirect_type == MLX5_INDIRECT_ACTION_TYPE_CT && flow->ct)
-		flow_dv_aso_ct_release(dev, flow->ct);
+		flow_dv_aso_ct_release(dev, flow->ct, NULL);
 	else if (flow->age)
 		flow_dv_aso_age_release(dev, flow->age);
 	if (flow->geneve_tlv_option) {
@@ -14900,7 +14910,7 @@ flow_dv_action_destroy(struct rte_eth_dev *dev,
 				" released with references %d.", idx, ret);
 		return 0;
 	case MLX5_INDIRECT_ACTION_TYPE_CT:
-		ret = flow_dv_aso_ct_release(dev, idx);
+		ret = flow_dv_aso_ct_release(dev, idx, error);
 		if (ret < 0)
 			return ret;
 		if (ret > 0)
-- 
2.25.1


  reply	other threads:[~2021-09-01  8:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01  8:19 [dpdk-dev] [PATCH 0/2] net/mlx5: fix flow indirect action reference counting Dmitry Kozlyuk
2021-09-01  8:19 ` Dmitry Kozlyuk [this message]
2021-09-01  8:19 ` [dpdk-dev] [PATCH 2/2] " Dmitry Kozlyuk
2021-09-21  7:58 ` [dpdk-dev] [PATCH 0/2] " Thomas Monjalon

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=20210901081958.3643375-2-dkozlyuk@nvidia.com \
    --to=dkozlyuk@nvidia.com \
    --cc=bingz@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=shahafs@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).