[dpdk-stable] patch 'eal: fix positive error codes from probe/remove' has been queued to LTS release 18.11.3

Kevin Traynor ktraynor at redhat.com
Fri Aug 23 11:43:06 CEST 2019


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 at 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 at samsung.com>
Reviewed-by: David Marchand <david.marchand at 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 at 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


More information about the stable mailing list