patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Michael Baum <michaelba@nvidia.com>
To: <stable@dpdk.org>
Cc: Matan Azrad <matan@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Subject: [PATCH 20.11 5/5] common/mlx5: fix error handling in multi-class probe
Date: Mon, 21 Feb 2022 21:46:35 +0200	[thread overview]
Message-ID: <20220221194635.2458173-6-michaelba@nvidia.com> (raw)
In-Reply-To: <20220221194635.2458173-1-michaelba@nvidia.com>

[ upstream commit 8928997a1388ba1b045a55732acced4baf00b21d ]

The common drivers_probe function calls in a loop to all probe functions
for classes requested by the user. After it manages to probe them all,
it updates this on the device in the "classes_loaded" field.

If one of them fails, all those probed to it are remove using the
drivers_remove function. However, this function only releases the
classes in the "classes_loaded" field on the given device and misses the
newly probed classes.

This patch removes the condition from the release function, and ensures
that the caller function sends a more accurate parameter.

Fixes: 8a41f4deccc3 ("common/mlx5: introduce layer for multiple class drivers")

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/common/mlx5/mlx5_common_pci.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index 5208972bb6..fa6e89efd3 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -203,7 +203,6 @@ drivers_remove(struct mlx5_pci_device *dev, uint32_t enabled_classes)
 	unsigned int i = 0;
 	int ret = 0;
 
-	enabled_classes &= dev->classes_loaded;
 	while (enabled_classes) {
 		driver = driver_get(RTE_BIT64(i));
 		if (driver) {
@@ -254,9 +253,11 @@ drivers_probe(struct mlx5_pci_device *dev, struct rte_pci_driver *pci_drv,
 	dev->classes_loaded |= enabled_classes;
 	return 0;
 probe_err:
-	/* Only unload drivers which are enabled which were enabled
-	 * in this probe instance.
+	/*
+	 * Need to remove only drivers which were not probed before this probe
+	 * instance, but have already been probed before this failure.
 	 */
+	enabled_classes &= ~dev->classes_loaded;
 	drivers_remove(dev, enabled_classes);
 	return ret;
 }
-- 
2.25.1


  parent reply	other threads:[~2022-02-21 19:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-21 19:46 [PATCH 20.11 0/5] mlx5: some fixes Michael Baum
2022-02-21 19:46 ` [PATCH 20.11 1/5] common/mlx5: add minimum WQE size for striding RQ Michael Baum
2022-02-21 19:46 ` [PATCH 20.11 2/5] net/mlx5: improve stride parameter names Michael Baum
2022-02-21 19:46 ` [PATCH 20.11 3/5] net/mlx5: fix MPRQ stride devargs adjustment Michael Baum
2022-02-21 19:46 ` [PATCH 20.11 4/5] net/mlx5: fix memory socket selection in ASO management Michael Baum
2022-02-21 19:46 ` Michael Baum [this message]
2022-02-22 14:32 ` [PATCH 20.11 0/5] mlx5: some fixes Luca Boccassi
2022-02-23 16:06   ` Michael Baum

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=20220221194635.2458173-6-michaelba@nvidia.com \
    --to=michaelba@nvidia.com \
    --cc=matan@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).