From: Khoa To <khot@linux.microsoft.com>
To: dev@dpdk.org
Cc: dmitry.kozliuk@gmail.com, pallavi.kadam@intel.com
Subject: [dpdk-dev] [PATCH v4] bus/pci/windows: support for PCI scan allowed and blocked lists
Date: Sun, 28 Feb 2021 22:52:41 -0800 [thread overview]
Message-ID: <20210301065241.237-1-khot@linux.microsoft.com> (raw)
In-Reply-To: <20210301062208.1904-1-khot@linux.microsoft.com>
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>
---
v4:
* Fix coding style warning with unaligned comments
v3:
* Move the check inside pci_scan_one
* Small change to pci_scan_one to malloc only after checks succeeded
v2:
* Truncate commit description lines to 75 charaters or less
drivers/bus/pci/windows/pci.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index f66258452..0d184f24d 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -308,17 +308,24 @@ set_kernel_driver_type(PSP_DEVINFO_DATA device_info_data,
static int
pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
{
- struct rte_pci_device *dev;
+ struct rte_pci_device *dev = NULL;
int ret = -1;
char pci_device_info[REGSTR_VAL_MAX_HCID_LEN];
struct rte_pci_addr addr;
struct rte_pci_id pci_id;
- dev = malloc(sizeof(*dev));
- if (dev == NULL)
+ ret = get_device_pci_address(dev_info, device_info_data, &addr);
+ if (ret != 0)
goto end;
- memset(dev, 0, sizeof(*dev));
+ if (rte_pci_ignore_device(&addr)) {
+ /*
+ * We won't add this device, but we want to continue
+ * looking for supported devices
+ */
+ ret = ERROR_CONTINUE;
+ goto end;
+ }
ret = get_pci_hardware_id(dev_info, device_info_data,
pci_device_info, sizeof(pci_device_info));
@@ -335,10 +342,12 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
goto end;
}
- ret = get_device_pci_address(dev_info, device_info_data, &addr);
- if (ret != 0)
+ dev = malloc(sizeof(*dev));
+ if (dev == NULL)
goto end;
+ memset(dev, 0, sizeof(*dev));
+
dev->addr = addr;
dev->id = pci_id;
dev->max_vfs = 0; /* TODO: get max_vfs */
@@ -417,7 +426,7 @@ rte_pci_scan(void)
device_index++;
/* we only want to enumerate net & netuio class devices */
if (IsEqualGUID(&(device_info_data.ClassGuid),
- &GUID_DEVCLASS_NET) ||
+ &GUID_DEVCLASS_NET) ||
IsEqualGUID(&(device_info_data.ClassGuid),
&GUID_DEVCLASS_NETUIO)) {
ret = pci_scan_one(dev_info, &device_info_data);
--
2.29.0.vfs.0.0
next prev parent reply other threads:[~2021-03-01 6:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-18 5:40 [dpdk-dev] [PATCH] " Khoa To
2021-02-18 18:40 ` [dpdk-dev] [PATCH v2] " Khoa To
2021-02-18 18:53 ` Ranjit Menon
2021-02-18 21:23 ` Dmitry Kozlyuk
2021-03-01 6:22 ` [dpdk-dev] [PATCH v3] " Khoa To
2021-03-01 6:52 ` Khoa To [this message]
2021-03-04 0:21 ` [dpdk-dev] [PATCH v4] " Ranjit Menon
2021-03-04 0:26 ` Khoa To
2021-03-04 7:14 ` Dmitry Kozlyuk
2021-03-16 21:35 ` Thomas Monjalon
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=20210301065241.237-1-khot@linux.microsoft.com \
--to=khot@linux.microsoft.com \
--cc=dev@dpdk.org \
--cc=dmitry.kozliuk@gmail.com \
--cc=pallavi.kadam@intel.com \
/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).