From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 3FA0AA054A;
	Thu, 18 Feb 2021 19:40:21 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 2D9B140040;
	Thu, 18 Feb 2021 19:40:21 +0100 (CET)
Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182])
 by mails.dpdk.org (Postfix) with ESMTP id 734494003D
 for <dev@dpdk.org>; Thu, 18 Feb 2021 19:40:20 +0100 (CET)
Received: from
 linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net
 (linux.microsoft.com [13.77.154.182])
 by linux.microsoft.com (Postfix) with ESMTPSA id B4B4F20B6C40;
 Thu, 18 Feb 2021 10:40:19 -0800 (PST)
DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B4B4F20B6C40
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;
 s=default; t=1613673619;
 bh=jX68EV4NE6FsUK12fPN9g9kp8um4ptNeC7cqYncTtXw=;
 h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
 b=HENv0tbP7i+w0DihXHeO3WwGD0OGwILxF67tyKvv8Ilkz32+jUYas6eoHZOdisS1y
 aqjdZlCl7BmVHe9OkNuk+74ysk8CoQLY86WGmPtYqdgadHAD1nnmT0HI6ypVrCb0O2
 BwTcWhwYs631WwLfMMDNdJJchaFjK6xXYG0Y801I=
From: Khoa To <khot@linux.microsoft.com>
To: dev@dpdk.org
Cc: dmitry.kozliuk@gmail.com,
	pallavi.kadam@intel.com
Date: Thu, 18 Feb 2021 10:40:02 -0800
Message-Id: <1613673602-6291-1-git-send-email-khot@linux.microsoft.com>
X-Mailer: git-send-email 1.8.3.1
In-Reply-To: <1613626805-9313-1-git-send-email-khot@linux.microsoft.com>
References: <1613626805-9313-1-git-send-email-khot@linux.microsoft.com>
Subject: [dpdk-dev] [PATCH v2] bus/pci/windows: support for PCI scan allowed
 and blocked lists
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

EAL -a and -b options are used to specify which PCI devices are
explicitly allowed or blocked during PCI bus scan.  This evaluation
is missing in the Windows implementation of rte_pci_scan.
This patch provides this missing functionality, so that apps can specify
which NetUIO devices to ignore during PCI bus scan.

Signed-off-by: Khoa To <khot@linux.microsoft.com>
---

v2:
* Truncate commit description lines to 75 charaters or less


 drivers/bus/pci/windows/pci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index f66258452..0bba05eb4 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -396,6 +396,7 @@ rte_pci_scan(void)
 	DWORD device_index = 0, found_device = 0;
 	HDEVINFO dev_info;
 	SP_DEVINFO_DATA device_info_data;
+	struct rte_pci_addr addr;
 
 	/* for debug purposes, PCI can be disabled */
 	if (!rte_eal_has_pci())
@@ -420,6 +421,13 @@ rte_pci_scan(void)
 		    &GUID_DEVCLASS_NET) ||
 			IsEqualGUID(&(device_info_data.ClassGuid),
 			    &GUID_DEVCLASS_NETUIO)) {
+
+			if (get_device_pci_address(dev_info, &device_info_data, &addr) != 0)
+				continue;
+
+			if (rte_pci_ignore_device(&addr))
+				continue;
+
 			ret = pci_scan_one(dev_info, &device_info_data);
 			if (ret == ERROR_SUCCESS)
 				found_device++;
-- 
2.29.0.vfs.0.0