DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
To: <dev@dpdk.org>
Cc: Raslan Darawsheh <rasland@nvidia.com>,
	Matan Azrad <matan@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Subject: [PATCH 1/2] net/mlx5: fix indirect RSS creation when port is stopped
Date: Wed, 24 Nov 2021 00:31:58 +0200	[thread overview]
Message-ID: <20211123223159.3324247-2-dkozlyuk@nvidia.com> (raw)
In-Reply-To: <20211123223159.3324247-1-dkozlyuk@nvidia.com>

mlx5_ind_table_obj_setup() was incrementing RxQ reference counters
even when the port was stopped, which prevented RxQ release
and triggered an internal assertion.
Only increment reference counter when the port is started.

Fixes: ec4e11d41d12 ("net/mlx5: preserve indirect actions on restart")

Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
---
 drivers/net/mlx5/mlx5_rxq.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 47dc24793b..8f9a94572f 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -2270,6 +2270,7 @@ mlx5_ind_table_obj_setup(struct rte_eth_dev *dev,
 			 struct mlx5_ind_table_obj *ind_tbl)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
+	bool dev_started = priv->dev_data->dev_started;
 	uint32_t queues_n = ind_tbl->queues_n;
 	uint16_t *queues = ind_tbl->queues;
 	unsigned int i, j;
@@ -2278,22 +2279,25 @@ mlx5_ind_table_obj_setup(struct rte_eth_dev *dev,
 			       log2above(queues_n) :
 			       log2above(priv->config.ind_table_max_size);
 
-	for (i = 0; i != queues_n; ++i) {
-		if (mlx5_rxq_ref(dev, queues[i]) == NULL) {
-			ret = -rte_errno;
-			goto error;
+	if (dev_started)
+		for (i = 0; i != queues_n; ++i) {
+			if (mlx5_rxq_ref(dev, queues[i]) == NULL) {
+				ret = -rte_errno;
+				goto error;
+			}
 		}
-	}
 	ret = priv->obj_ops.ind_table_new(dev, n, ind_tbl);
 	if (ret)
 		goto error;
 	__atomic_fetch_add(&ind_tbl->refcnt, 1, __ATOMIC_RELAXED);
 	return 0;
 error:
-	err = rte_errno;
-	for (j = 0; j < i; j++)
-		mlx5_rxq_deref(dev, ind_tbl->queues[j]);
-	rte_errno = err;
+	if (dev_started) {
+		err = rte_errno;
+		for (j = 0; j < i; j++)
+			mlx5_rxq_deref(dev, queues[j]);
+		rte_errno = err;
+	}
 	DRV_LOG(DEBUG, "Port %u cannot setup indirection table.",
 		dev->data->port_id);
 	return ret;
-- 
2.25.1


  reply	other threads:[~2021-11-23 22:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-23 22:31 [PATCH 0/2] next/mlx5: fix indirect RSS reference counting Dmitry Kozlyuk
2021-11-23 22:31 ` Dmitry Kozlyuk [this message]
2021-11-23 22:31 ` [PATCH 2/2] net/mlx5: fix RxQ reference counting for indirect RSS Dmitry Kozlyuk
2021-11-24  9:35 ` [PATCH 0/2] next/mlx5: fix indirect RSS reference counting Dmitry Kozlyuk
2021-11-24  9:35   ` [PATCH 1/2] net/mlx5: fix indirect RSS creation when port is stopped Dmitry Kozlyuk
2021-11-24  9:35   ` [PATCH 2/2] net/mlx5: fix RxQ reference counting for indirect RSS Dmitry Kozlyuk
2021-11-24  9:35   ` [PATCH v2 0/2] net/mlx5: fix indirect RSS reference counting Dmitry Kozlyuk
2021-11-24  9:35   ` [PATCH v2 1/2] net/mlx5: fix indirect RSS creation when port is stopped Dmitry Kozlyuk
2021-11-24  9:40 ` [PATCH v3 0/2] net/mlx5: fix indirect RSS reference counting Dmitry Kozlyuk
2021-11-24  9:40   ` [PATCH v3 1/2] net/mlx5: fix indirect RSS creation when port is stopped Dmitry Kozlyuk
2021-11-24  9:40   ` [PATCH v3 2/2] net/mlx5: fix RxQ reference counting for indirect RSS Dmitry Kozlyuk
2021-11-24 13:04   ` [PATCH v3 0/2] net/mlx5: fix indirect RSS reference counting 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=20211123223159.3324247-2-dkozlyuk@nvidia.com \
    --to=dkozlyuk@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=rasland@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).