From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: talshn@mellanox.com
Cc: dev@dpdk.org, thomas@monjalon.net, pallavi.kadam@intel.com,
david.marchand@redhat.com, grive@u256.net,
ranjit.menon@intel.com, navasile@linux.microsoft.com
Subject: Re: [dpdk-dev] [PATCH v2 7/7] bus/pci: support Windows with bifurcated drivers
Date: Wed, 29 Apr 2020 03:01:52 +0300 [thread overview]
Message-ID: <20200429030152.0ebaae32@Sovereign> (raw)
In-Reply-To: <20200428091111.13416-8-talshn@mellanox.com>
On 2020-04-28 12:11 GMT+0300 talshn@mellanox.com wrote:
[snip]
> + switch (dev->kdrv) {
> + case RTE_KDRV_NONE:
> + /* Get NUMA node using DEVPKEY_Device_Numa_Node */
> + bResult = SetupDiGetDevicePropertyW(hDevInfo, pDeviceInfoData,
> + &DEVPKEY_Device_Numa_Node, &uPropertyType,
> + (BYTE *)&uNumaNode, sizeof(uNumaNode), NULL, 0);
> + if (!bResult) {
> + ret = GetLastError();
> + goto end;
> + }
> + dev->device.numa_node = uNumaNode;
Note: NUMA node != socket ID, but this field is used as socket ID by PMDs.
I suggest adding Windows-only EAL API to do the translation.
[snip]
> + /* We now have the various hw IDs in tokens in the str[] array */
> + /* Isolate the numerical IDs - '_' as the delimiter */
> + if (parse_hardware_ids(str[0], strlen(str[0]), vendorID, NULL))
> + goto end;
> +
> + if (parse_hardware_ids(str[1], strlen(str[1]), deviceID, NULL))
> + goto end;
> +
> + if (parse_hardware_ids(str[2], strlen(str[2]), subdeviceID,
> + subvendorID)) {
> + goto end;
> + }
You could avoid hand-written string parsing by using sscanf(), because
hardware ID formats are fixed, limited, and documented:
https://docs.microsoft.com/en-us/windows-hardware/drivers/install/identifiers-for-pci-devices
[snip]
> +
> + bResult = SetupDiGetDeviceRegistryPropertyA(hDevInfo, pDeviceInfoData,
> + SPDRP_LOCATION_INFORMATION, NULL, (BYTE *)&strPCIDeviceInfo,
> + sizeof(strPCIDeviceInfo), NULL);
> +
> + /* Some devices don't have location information - simply return 0 */
> + /* Also, if we don't find 'PCI' in the description, we'll skip it */
> + if (!bResult) {
> + ret = (GetLastError() == ERROR_INVALID_DATA) ? ERROR_CONTINUE
> + : -1;
> + goto end;
> + } else if (!strstr(strPCIDeviceInfo, "PCI")) {
> + ret = ERROR_CONTINUE;
> + goto end;
> + }
You could get PCI address without parsing strings with SPDRP_BUSNUMBER and
SPDRP_ADDRESS.
> +
> + struct rte_pci_addr addr;
> +
> + if (parse_pci_addr_format((const char *)&strPCIDeviceInfo,
> + sizeof(strPCIDeviceInfo), &addr) != 0) {
> + ret = -1;
> + goto end;
> + }
> +
> + dev->addr.domain = addr.domain;
> + dev->addr.bus = addr.bus;
> + dev->addr.devid = addr.devid;
> + dev->addr.function = addr.function;
Why not dev->addr = addr?
[snip]
> diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def
> index edbb6b277..7a0468a02 100644
> --- a/lib/librte_eal/rte_eal_exports.def
> +++ b/lib/librte_eal/rte_eal_exports.def
> @@ -18,6 +18,7 @@ EXPORTS
> rte_eal_tailq_lookup
> rte_eal_tailq_register
> rte_eal_using_phys_addrs
> + rte_find_numerical_value
> rte_free
> rte_log
> rte_malloc
This belongs to the patch that added the API, doesn't it?
--
Dmitry Kozlyuk
next prev parent reply other threads:[~2020-04-29 0:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-28 9:11 [dpdk-dev] [PATCH v2 0/7] Windows bus/pci support talshn
2020-04-28 9:11 ` [dpdk-dev] [PATCH v2 1/7] eal: move OS common functions to single file talshn
2020-04-28 9:11 ` [dpdk-dev] [PATCH v2 2/7] pci: build on Windows talshn
2020-04-28 23:52 ` Dmitry Kozlyuk
2020-04-28 9:11 ` [dpdk-dev] [PATCH v2 3/7] eal: add function finding integer in a string talshn
2020-04-28 9:11 ` [dpdk-dev] [PATCH v2 4/7] drivers: ignore pmdinfogen generation for Windows talshn
2020-04-28 9:11 ` [dpdk-dev] [PATCH v2 5/7] drivers: fix incorrect meson import folder " talshn
2020-04-28 9:11 ` [dpdk-dev] [PATCH v2 6/7] bus/pci: introduce Windows support with stubs talshn
2020-04-28 9:11 ` [dpdk-dev] [PATCH v2 7/7] bus/pci: support Windows with bifurcated drivers talshn
2020-04-29 0:01 ` Dmitry Kozlyuk [this message]
2020-05-03 11:53 ` Tal Shnaiderman
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=20200429030152.0ebaae32@Sovereign \
--to=dmitry.kozliuk@gmail.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=grive@u256.net \
--cc=navasile@linux.microsoft.com \
--cc=pallavi.kadam@intel.com \
--cc=ranjit.menon@intel.com \
--cc=talshn@mellanox.com \
--cc=thomas@monjalon.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.