bus/pci: fix unknown NUMA node value on Windows
authorPallavi Kadam <pallavi.kadam@intel.com>
Mon, 27 Sep 2021 18:43:22 +0000 (11:43 -0700)
committerThomas Monjalon <thomas@monjalon.net>
Thu, 30 Sep 2021 16:30:27 +0000 (18:30 +0200)
Based on the rte_eth_dev_socket_id() documentation,
set the default numa_node to -1. When the API is unsuccessful,
set numa_node to 0.
This change more correctly resembles the Linux code.

Fixes: bf7cf1f947bd ("bus/pci: fix unknown NUMA node value on Windows")
Cc: stable@dpdk.org
Reported-by: Vipin Varghese <vipin.varghese@intel.com>
Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Acked-by: Ranjit Menon <ranjit.menon@intel.com>
drivers/bus/pci/windows/pci.c

index 343ef6f..644c452 100644 (file)
@@ -237,6 +237,7 @@ get_device_resource_info(HDEVINFO dev_info,
        }
 
        /* Get NUMA node using DEVPKEY_Device_Numa_Node */
+       dev->device.numa_node = SOCKET_ID_ANY;
        res = SetupDiGetDevicePropertyW(dev_info, dev_info_data,
                &DEVPKEY_Device_Numa_Node, &property_type,
                (BYTE *)&numa_node, sizeof(numa_node), NULL, 0);
@@ -244,7 +245,7 @@ get_device_resource_info(HDEVINFO dev_info,
                DWORD error = GetLastError();
                if (error == ERROR_NOT_FOUND) {
                        /* On older CPUs, NUMA is not bound to PCIe locality. */
-                       dev->device.numa_node = SOCKET_ID_ANY;
+                       dev->device.numa_node = 0;
                        return ERROR_SUCCESS;
                }
                RTE_LOG_WIN32_ERR("SetupDiGetDevicePropertyW"