From patchwork Tue Aug 27 19:30:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nitin Katiyar X-Patchwork-Id: 58035 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 791341BF7B; Tue, 27 Aug 2019 13:30:09 +0200 (CEST) Received: from sessmg23.ericsson.net (sessmg23.ericsson.net [193.180.251.45]) by dpdk.org (Postfix) with ESMTP id D2F5E1BF77 for ; Tue, 27 Aug 2019 13:30:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/relaxed; q=dns/txt; i=@ericsson.com; t=1566905407; x=1569497407; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xMOq8cIJ8wN2oTBY2NCOhaxFNO9Y1gIDSw0glj3sMRs=; b=M6sS2wc/Iyoil6QuN4kNOJJoH5ItG6QWqIb/ef5Y5zgG6lKKWA0B7WeAXGvmaife 0vDIU/7R6eK1YyiMjMv4itrYgcp1OX/ymABpugUIXPtJuB72bmxR5WYAWktRHU3C RtVTbY/MVDX1aae6OTK3h6DDMgIf8vgzBYWn4jAggM0=; X-AuditID: c1b4fb2d-175ff70000000d01-f5-5d65143f9286 Received: from ESESBMB501.ericsson.se (Unknown_Domain [153.88.183.114]) by sessmg23.ericsson.net (Symantec Mail Security) with SMTP id 62.0A.03329.F34156D5; Tue, 27 Aug 2019 13:30:07 +0200 (CEST) Received: from ESESBMB501.ericsson.se (153.88.183.168) by ESESBMB501.ericsson.se (153.88.183.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 27 Aug 2019 13:30:06 +0200 Received: from ESESSHC002.ericsson.se (153.88.183.24) by ESESBMB501.ericsson.se (153.88.183.168) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P256) id 15.1.1713.5 via Frontend Transport; Tue, 27 Aug 2019 13:30:06 +0200 Received: from ESGSCHC006.ericsson.se (146.11.116.83) by ESESSHC002.ericsson.se (153.88.183.24) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 27 Aug 2019 13:30:06 +0200 Received: from localhost.localdomain (146.11.116.127) by smtps-ao.internal.ericsson.com (146.11.116.83) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 27 Aug 2019 19:29:43 +0800 From: Nitin Katiyar To: CC: Nitin Katiyar , Venkatesan Pradeep Date: Wed, 28 Aug 2019 01:00:16 +0530 Message-ID: <1566934217-23824-1-git-send-email-nitin.katiyar@ericsson.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [146.11.116.127] Subject: [dpdk-dev] [PATCH 1/2] bus/pci: Fail rte_pci_probe if probing all whitelisted devices fail. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Signed-off-by: Venkatesan Pradeep --- 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 "