patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Ilya Maximets <i.maximets@samsung.com>
Cc: David Marchand <david.marchand@redhat.com>,
	dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'eal: fix positive error codes from probe/remove' has been queued to LTS release 18.11.3
Date: Fri, 23 Aug 2019 10:43:06 +0100	[thread overview]
Message-ID: <20190823094336.12078-16-ktraynor@redhat.com> (raw)
In-Reply-To: <20190823094336.12078-1-ktraynor@redhat.com>

Hi,

FYI, your patch has been queued to LTS release 18.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 08/28/19. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/2b6f661d58c5054bed31b5fd3b5b6fd6062ba7c6

Thanks.

Kevin Traynor

---
From 2b6f661d58c5054bed31b5fd3b5b6fd6062ba7c6 Mon Sep 17 00:00:00 2001
From: Ilya Maximets <i.maximets@samsung.com>
Date: Thu, 6 Jun 2019 13:02:28 +0300
Subject: [PATCH] eal: fix positive error codes from probe/remove

[ upstream commit 75b66decdbd52948721f5c286244dc1d29d71711 ]

According to API, 'rte_dev_probe()' and 'rte_dev_remove()' must
return 0 or negative error code. Bus code returns positive values
if device wasn't recognized by any driver, so the result of
'bus->plug/unplug()' must be converted. 'local_dev_probe()' and
'local_dev_remove()' also has their internal API, so the conversion
should be done there.

Positive on remove means that device not found by driver.
Positive on probe means that there are no suitable buses/drivers,
i.e. device is not supported.

Users of these API fixed to provide a good example by respecting
DPDK API. This also will allow to catch such issues in the future.

Fixes: a3ee360f4440 ("eal: add hotplug add/remove device")
Fixes: 244d5130719c ("eal: enable hotplug on multi-process")

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
---
 app/test-pmd/testpmd.c                 | 4 ++--
 drivers/net/failsafe/failsafe_eal.c    | 4 ++--
 drivers/net/failsafe/failsafe_ether.c  | 2 +-
 drivers/net/vdev_netvsc/vdev_netvsc.c  | 2 +-
 lib/librte_eal/common/eal_common_dev.c | 5 ++++-
 5 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index cf983b16b..b4215c75d 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2291,5 +2291,5 @@ attach_port(char *identifier)
 	}
 
-	if (rte_dev_probe(identifier) != 0) {
+	if (rte_dev_probe(identifier) < 0) {
 		TESTPMD_LOG(ERR, "Failed to attach port %s\n", identifier);
 		return;
@@ -2361,5 +2361,5 @@ detach_port_device(portid_t port_id)
 	}
 
-	if (rte_dev_remove(dev) != 0) {
+	if (rte_dev_remove(dev) < 0) {
 		TESTPMD_LOG(ERR, "Failed to detach device %s\n", dev->name);
 		return;
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index 8a888b1ff..88df6ea0c 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -48,5 +48,5 @@ fs_bus_init(struct rte_eth_dev *dev)
 						  da->name,
 						  da->args);
-			if (ret) {
+			if (ret < 0) {
 				ERROR("sub_device %d probe failed %s%s%s", i,
 				      rte_errno ? "(" : "",
@@ -146,5 +146,5 @@ fs_bus_uninit(struct rte_eth_dev *dev)
 	FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) {
 		sdev_ret = rte_dev_remove(sdev->dev);
-		if (sdev_ret) {
+		if (sdev_ret < 0) {
 			ERROR("Failed to remove requested device %s (err: %d)",
 			      sdev->dev->name, sdev_ret);
diff --git a/drivers/net/failsafe/failsafe_ether.c b/drivers/net/failsafe/failsafe_ether.c
index 178316521..2ff234ea3 100644
--- a/drivers/net/failsafe/failsafe_ether.c
+++ b/drivers/net/failsafe/failsafe_ether.c
@@ -284,5 +284,5 @@ fs_dev_remove(struct sub_device *sdev)
 	case DEV_PROBED:
 		ret = rte_dev_remove(sdev->dev);
-		if (ret) {
+		if (ret < 0) {
 			ERROR("Bus detach failed for sub_device %u",
 			      SUB_ID(sdev));
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index 94d067b20..a865a8281 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -637,5 +637,5 @@ vdev_netvsc_netvsc_probe(const struct if_nameindex *iface,
 	vdev_netvsc_foreach_iface(vdev_netvsc_device_probe, 0, ctx);
 	ret = rte_eal_hotplug_add("vdev", ctx->devname, ctx->devargs);
-	if (ret)
+	if (ret < 0)
 		goto error;
 	LIST_INSERT_HEAD(&vdev_netvsc_ctx_list, ctx, entry);
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index fd7f5ca7d..dc2bc0c98 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -173,4 +173,7 @@ local_dev_probe(const char *devargs, struct rte_device **new_dev)
 
 	ret = dev->bus->plug(dev);
+	if (ret > 0)
+		ret = -ENOTSUP;
+
 	if (ret && !rte_dev_is_probed(dev)) { /* if hasn't ever succeeded */
 		RTE_LOG(ERR, EAL, "Driver cannot attach the device (%s)\n",
@@ -320,5 +323,5 @@ local_dev_remove(struct rte_device *dev)
 		RTE_LOG(ERR, EAL, "Driver cannot detach the device (%s)\n",
 			dev->name);
-		return ret;
+		return (ret < 0) ? ret : -ENOENT;
 	}
 
-- 
2.20.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-08-22 19:38:21.508825800 +0100
+++ 0016-eal-fix-positive-error-codes-from-probe-remove.patch	2019-08-22 19:38:20.417027356 +0100
@@ -1 +1 @@
-From 75b66decdbd52948721f5c286244dc1d29d71711 Mon Sep 17 00:00:00 2001
+From 2b6f661d58c5054bed31b5fd3b5b6fd6062ba7c6 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 75b66decdbd52948721f5c286244dc1d29d71711 ]
+
@@ -22 +23,0 @@
-Cc: stable@dpdk.org
@@ -28 +28,0 @@
- drivers/net/failsafe/failsafe.c        | 2 +-
@@ -33 +33 @@
- 6 files changed, 11 insertions(+), 8 deletions(-)
+ 5 files changed, 10 insertions(+), 7 deletions(-)
@@ -36 +36 @@
-index 0dd47b3e0..c578f75e7 100644
+index cf983b16b..b4215c75d 100644
@@ -39 +39 @@
-@@ -2384,5 +2384,5 @@ attach_port(char *identifier)
+@@ -2291,5 +2291,5 @@ attach_port(char *identifier)
@@ -46 +46 @@
-@@ -2454,5 +2454,5 @@ detach_port_device(portid_t port_id)
+@@ -2361,5 +2361,5 @@ detach_port_device(portid_t port_id)
@@ -53,11 +52,0 @@
-diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
-index e91c274d8..19dd71d4e 100644
---- a/drivers/net/failsafe/failsafe.c
-+++ b/drivers/net/failsafe/failsafe.c
-@@ -375,5 +375,5 @@ rte_pmd_failsafe_probe(struct rte_vdev_device *vdev)
- 			if (!devargs_already_listed(&devargs)) {
- 				ret = rte_dev_probe(devargs.name);
--				if (ret != 0) {
-+				if (ret < 0) {
- 					ERROR("Failed to probe devargs %s",
- 					      devargs.name);
@@ -65 +54 @@
-index 820a915f7..b9fc50867 100644
+index 8a888b1ff..88df6ea0c 100644
@@ -68 +57 @@
-@@ -49,5 +49,5 @@ fs_bus_init(struct rte_eth_dev *dev)
+@@ -48,5 +48,5 @@ fs_bus_init(struct rte_eth_dev *dev)
@@ -75 +64 @@
-@@ -148,5 +148,5 @@ fs_bus_uninit(struct rte_eth_dev *dev)
+@@ -146,5 +146,5 @@ fs_bus_uninit(struct rte_eth_dev *dev)
@@ -83 +72 @@
-index 4746fad36..504c76edb 100644
+index 178316521..2ff234ea3 100644
@@ -86 +75 @@
-@@ -285,5 +285,5 @@ fs_dev_remove(struct sub_device *sdev)
+@@ -284,5 +284,5 @@ fs_dev_remove(struct sub_device *sdev)
@@ -94 +83 @@
-index edab63e3a..1fcf90d7b 100644
+index 94d067b20..a865a8281 100644
@@ -97 +86 @@
-@@ -634,5 +634,5 @@ vdev_netvsc_netvsc_probe(const struct if_nameindex *iface,
+@@ -637,5 +637,5 @@ vdev_netvsc_netvsc_probe(const struct if_nameindex *iface,
@@ -105 +94 @@
-index 86f801da7..9e4f09d83 100644
+index fd7f5ca7d..dc2bc0c98 100644

  parent reply	other threads:[~2019-08-23  9:44 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-23  9:42 [dpdk-stable] patch 'net/bnx2x: fix warnings from invalid assert' " Kevin Traynor
2019-08-23  9:42 ` [dpdk-stable] patch 'net/qede: " Kevin Traynor
2019-08-23  9:42 ` [dpdk-stable] patch 'eal: correct log for alarm error' " Kevin Traynor
2019-08-23  9:42 ` [dpdk-stable] patch 'eal/linux: fix return after alarm registration failure' " Kevin Traynor
2019-08-23  9:42 ` [dpdk-stable] patch 'kernel/freebsd: fix module build on latest head' " Kevin Traynor
2019-08-23  9:42 ` [dpdk-stable] patch 'kernel/linux: fix modules install path' " Kevin Traynor
2019-08-23 10:04   ` Igor Ryzhov
2019-08-23  9:42 ` [dpdk-stable] patch 'ip_frag: fix IPv6 fragment size calculation' " Kevin Traynor
2019-08-23  9:42 ` [dpdk-stable] patch 'test/hash: fix off-by-one check on core count' " Kevin Traynor
2019-08-23  9:42 ` [dpdk-stable] patch 'test/hash: rectify slave id to point to valid cores' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'bus/vmbus: skip non-network devices' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'bpf: fix check array size' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'eal: hide internal hotplug function' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'vfio: remove incorrect experimental tag' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'mem: remove incorrect experimental tag on static symbol' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'telemetry: add missing header include' " Kevin Traynor
2019-08-23  9:43 ` Kevin Traynor [this message]
2019-08-23  9:43 ` [dpdk-stable] patch 'net/bnx2x: fix invalid free on unplug' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'drivers/net: fix double free on init failure' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'net: fix encapsulation markers for inner L3 offset' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'net/mlx5: fix 32-bit build' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'net/netvsc: fix RSS offload settings' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'net/netvsc: fix xstats id' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'net/netvsc: fix xstats for VF device' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'doc: fix typos in flow API guide' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'net: fix how L4 checksum choice is tested' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'eal/freebsd: fix init completion' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'raw/skeleton: fix test of attribute set/get' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'examples/l3fwd-vf: remove unused Rx/Tx configuration' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'doc: remove useless Rx configuration in l2fwd guide' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'test: add rawdev autotest to meson' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'event/dpaa2: fix timeout ticks' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'eventdev: fix doxygen comment' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'app/eventdev: fix order test port creation' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'test/eventdev: fix producer core validity checks' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'net/mvneta: fix ierror statistics' " Kevin Traynor
2019-08-25 11:41   ` [dpdk-stable] [EXT] " Liron Himi
2019-08-23  9:43 ` [dpdk-stable] patch 'net: fix definition of IPv6 traffic class mask' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'examples: fix pkg-config detection with older make' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'bpf: fix validate for function return value' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'raw/ifpga/base: fix use of untrusted scalar " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'raw/ifpga/base: fix physical address info' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'usertools: fix refresh binding infos' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'doc: add a note for multi-process in mempool guide' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'table: fix crash in LPM IPv6' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'test: fix autotest crash' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'telemetry: fix build' " Kevin Traynor
2019-08-23  9:43 ` [dpdk-stable] patch 'app/testpmd: fix offloads config' " Kevin Traynor
2019-08-23  9:59   ` Kevin Traynor
2019-09-04 17:44     ` Kevin Traynor
2019-09-05  2:14       ` Zhao1, Wei
2019-09-11 14:46         ` Kevin Traynor
2019-09-13  9:27           ` Iremonger, Bernard

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=20190823094336.12078-16-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=david.marchand@redhat.com \
    --cc=i.maximets@samsung.com \
    --cc=stable@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).