bus/pci: fix selection of default device NUMA node
[dpdk.git] / drivers / bus / pci / pci_common.c
index 35d7d09..9bffdf1 100644 (file)
@@ -16,6 +16,7 @@
 #include <rte_bus.h>
 #include <rte_pci.h>
 #include <rte_bus_pci.h>
+#include <rte_lcore.h>
 #include <rte_per_lcore.h>
 #include <rte_memory.h>
 #include <rte_eal.h>
@@ -165,6 +166,7 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
                         struct rte_pci_device *dev)
 {
        int ret;
+       unsigned socket_id;
        bool already_probed;
        struct rte_pci_addr *loc;
 
@@ -190,8 +192,11 @@ rte_pci_probe_one_driver(struct rte_pci_driver *dr,
        }
 
        if (dev->device.numa_node < 0) {
-               RTE_LOG(WARNING, EAL, "  Invalid NUMA socket, default to 0\n");
-               dev->device.numa_node = 0;
+               if (rte_socket_count() > 1)
+                       RTE_LOG(INFO, EAL, "Device %s is not NUMA-aware, defaulting socket to 0\n",
+                                       dev->name);
+               socket_id = rte_lcore_to_socket_id(rte_get_next_lcore(-1, 0, 0));
+               dev->device.numa_node = socket_id;
        }
 
        already_probed = rte_dev_is_probed(&dev->device);
@@ -782,6 +787,7 @@ struct rte_pci_bus rte_pci_bus = {
                .plug = pci_plug,
                .unplug = pci_unplug,
                .parse = pci_parse,
+               .devargs_parse = rte_pci_devargs_parse,
                .dma_map = pci_dma_map,
                .dma_unmap = pci_dma_unmap,
                .get_iommu_class = rte_pci_get_iommu_class,