From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id CE159A04B5;
	Sun, 13 Dec 2020 15:16:23 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 823754F90;
	Sun, 13 Dec 2020 15:16:20 +0100 (CET)
Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])
 by dpdk.org (Postfix) with ESMTP id ECF7C3257
 for <dev@dpdk.org>; Sun, 13 Dec 2020 15:16:18 +0100 (CET)
Received: from Internal Mail-Server by MTLPINE1 (envelope-from
 talshn@nvidia.com) with SMTP; 13 Dec 2020 16:16:13 +0200
Received: from nvidia.com (l-wincomp04-vm.mtl.labs.mlnx [10.237.1.5])
 by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 0BDEGCBg009656;
 Sun, 13 Dec 2020 16:16:12 +0200
From: Tal Shnaiderman <talshn@nvidia.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com,
 navasile@linux.microsoft.com, dmitrym@microsoft.com, odia@nvidia.com,
 stable@dpdk.org
Date: Sun, 13 Dec 2020 16:16:04 +0200
Message-Id: <20201213141604.12560-1-talshn@nvidia.com>
X-Mailer: git-send-email 2.16.1.windows.4
Subject: [dpdk-dev] [PATCH] pci/windows: do not fail on missing NUMA node
	for PCIe
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
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>

On older processors, NUMA isn't bound to PCIe locality.
those cases return ERROR_NOT_FOUND in response to the
SetupDiGetDevicePropertyW call with DEVPKEY_Device_Numa_Node
attribute.

This error fails the probe process for the PCIe device.
this commit will ignore such failure and will set the
numa_node to 0.

Fixes: b762221ac24f ("bus/pci: support Windows with bifurcated drivers")
Cc: stable@dpdk.org

Reported-by: Odi Assli <odia@nvidia.com>
Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
---
 drivers/bus/pci/windows/pci.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index 33a5fb1d83..62bac4b8ec 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -234,6 +234,15 @@ get_device_resource_info(HDEVINFO dev_info,
 		&DEVPKEY_Device_Numa_Node, &property_type,
 		(BYTE *)&numa_node, sizeof(numa_node), NULL, 0);
 	if (!res) {
+		DWORD error = GetLastError();
+		if (error == ERROR_NOT_FOUND) {
+			/* On older CPUs, NUMA isn't bound to PCIe locality
+			 * We do not want to fail the probing process
+			 * Setting 0 for numa_node and returnng ERROR_SUCCESS.
+			 */
+			dev->device.numa_node = 0;
+			return ERROR_SUCCESS;
+		}
 		RTE_LOG_WIN32_ERR("SetupDiGetDevicePropertyW"
 			"(DEVPKEY_Device_Numa_Node)");
 		return -1;
-- 
2.16.1.windows.4