[dpdk-dev] [PATCH 1/2] bus/pci: Fail rte_pci_probe if probing all whitelisted devices fail.

Nitin Katiyar nitin.katiyar at ericsson.com
Tue Aug 27 21:30:16 CEST 2019


Even if whitelist of devices is provided, rte_pci_probe() increments
the probed counter for all the devices present in the system. If probe
fails for all the whitelisted devices it still return success because
failed and probed counts don't match.

This patch increments probed count only when devices are actually
probed.

Signed-off-by: Nitin Katiyar <nitin.katiyar at ericsson.com>
Signed-off-by: Venkatesan Pradeep <venkatesan.pradeep at ericsson.com>

---
 drivers/bus/pci/pci_common.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 6b46b4f..25d1002 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -300,15 +300,17 @@ static struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *dev)
 		probe_all = 1;
 
 	FOREACH_DEVICE_ON_PCIBUS(dev) {
-		probed++;
-
 		devargs = dev->device.devargs;
 		/* probe all or only whitelisted devices */
-		if (probe_all)
+		if (probe_all) {
 			ret = pci_probe_all_drivers(dev);
+			probed++;
+		}
 		else if (devargs != NULL &&
-			devargs->policy == RTE_DEV_WHITELISTED)
+			devargs->policy == RTE_DEV_WHITELISTED) {
 			ret = pci_probe_all_drivers(dev);
+			probed++;
+		}
 		if (ret < 0) {
 			if (ret != -EEXIST) {
 				RTE_LOG(ERR, EAL, "Requested device "
-- 
1.9.1



More information about the dev mailing list