DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gaetan Rivet <gaetan.rivet@6wind.com>
To: dev@dpdk.org
Cc: Gaetan Rivet <gaetan.rivet@6wind.com>
Subject: [dpdk-dev] [PATCH v2 3/6] pci: propagate PMD removal error value for unplug
Date: Tue, 24 Oct 2017 12:35:39 +0200	[thread overview]
Message-ID: <10ff1c8858c7aabbc057df5ae3b466c28b6a9291.1508840586.git.gaetan.rivet@6wind.com> (raw)
In-Reply-To: <cover.1508840456.git.gaetan.rivet@6wind.com>
In-Reply-To: <409639fdf67753288cff5bf7d91f725666ff5678.1508840586.git.gaetan.rivet@6wind.com>

If a PCI device detach removal fails, returns the actual removal
operator error value.

Use this value within pci->unplug, as it may help applications solve an
issue with the feature or more accurately warn their users.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
 lib/librte_eal/common/eal_common_pci.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 0f0e4b9..fb92ee7 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -263,6 +263,7 @@ rte_pci_detach_dev(struct rte_pci_device *dev)
 {
 	struct rte_pci_addr *loc;
 	struct rte_pci_driver *dr;
+	int ret = 0;
 
 	if (dev == NULL)
 		return -EINVAL;
@@ -277,8 +278,11 @@ rte_pci_detach_dev(struct rte_pci_device *dev)
 	RTE_LOG(DEBUG, EAL, "  remove driver: %x:%x %s\n", dev->id.vendor_id,
 			dev->id.device_id, dr->driver.name);
 
-	if (dr->remove && (dr->remove(dev) < 0))
-		return -1;	/* negative value is an error */
+	if (dr->remove) {
+		ret = dr->remove(dev);
+		if (ret < 0)
+			return ret;
+	}
 
 	/* clear driver structure */
 	dev->driver = NULL;
@@ -551,8 +555,10 @@ pci_unplug(struct rte_device *dev)
 
 	pdev = RTE_DEV_TO_PCI(dev);
 	ret = rte_pci_detach_dev(pdev);
-	rte_pci_remove_device(pdev);
-	free(pdev);
+	if (ret == 0) {
+		rte_pci_remove_device(pdev);
+		free(pdev);
+	}
 	return ret;
 }
 
-- 
2.1.4

  parent reply	other threads:[~2017-10-24 10:36 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24  8:59 [dpdk-dev] [PATCH v1 0/3] Remove RTE_ETH_DEV_DETACHABLE Gaetan Rivet
2017-10-24  8:59 ` [dpdk-dev] [PATCH v1 1/3] ethdev: remove detachable device flag Gaetan Rivet
2017-10-24  9:13   ` Andrew Rybchenko
2017-10-24  9:23   ` Thomas Monjalon
2017-10-24  9:27     ` Gaëtan Rivet
2017-10-24  8:59 ` [dpdk-dev] [PATCH v1 2/3] doc: follow detachable flag disappearance Gaetan Rivet
2017-10-25  8:55   ` Mcnamara, John
2017-10-25  8:56   ` Mcnamara, John
2017-10-24  8:59 ` [dpdk-dev] [PATCH v1 3/3] pci: propagate PMD removal error value for unplug Gaetan Rivet
2017-10-24 10:35 ` [dpdk-dev] [PATCH v2 0/6] Remove RTE_ETH_DEV_DETACHABLE Gaetan Rivet
2017-10-24 10:35   ` [dpdk-dev] [PATCH v2 1/6] ethdev: do not rely on detachable flag in detach Gaetan Rivet
2017-10-24 10:35     ` [dpdk-dev] [PATCH v2 2/6] ethdev: remove detachable device flag Gaetan Rivet
2017-10-24 10:35     ` Gaetan Rivet [this message]
2017-10-24 10:35     ` [dpdk-dev] [PATCH v2 4/6] doc: follow detachable flag disappearance Gaetan Rivet
2017-10-25  8:57       ` Mcnamara, John
2017-10-24 10:35     ` [dpdk-dev] [PATCH v2 5/6] doc: update detachable flag deprecation notice Gaetan Rivet
2017-10-25  9:03       ` Mcnamara, John
2017-10-24 10:35     ` [dpdk-dev] [PATCH v2 6/6] doc: note ether API change for detachable flag Gaetan Rivet
2017-10-25  8:58       ` Mcnamara, John
2017-10-25  9:01       ` Mcnamara, John
2017-10-24 12:35   ` [dpdk-dev] [PATCH v2 0/6] Remove RTE_ETH_DEV_DETACHABLE Thomas Monjalon
2017-10-25 17:37     ` Ferruh Yigit
2017-10-30  9:45       ` Alejandro Lucero
2017-10-31 11:09         ` Alejandro Lucero
2017-10-31 17:24           ` Ferruh Yigit
2017-10-24 23:56   ` Ferruh Yigit
2017-10-25 16:11     ` Ferruh Yigit

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=10ff1c8858c7aabbc057df5ae3b466c28b6a9291.1508840586.git.gaetan.rivet@6wind.com \
    --to=gaetan.rivet@6wind.com \
    --cc=dev@dpdk.org \
    /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).