[dpdk-dev] [RFC 4/6] eal: move numa_node from rte_pci_device to rte_device

Jan Viktorin viktorin at rehivetech.com
Mon Jan 18 17:03:05 CET 2016


Signed-off-by: Jan Viktorin <viktorin at rehivetech.com>
---
 app/test/virtual_pmd.c                  | 2 +-
 lib/librte_eal/bsdapp/eal/eal_pci.c     | 2 +-
 lib/librte_eal/common/eal_common_pci.c  | 4 ++--
 lib/librte_eal/common/include/rte_dev.h | 1 +
 lib/librte_eal/common/include/rte_pci.h | 1 -
 lib/librte_eal/linuxapp/eal/eal_pci.c   | 4 ++--
 lib/librte_ether/rte_ethdev.c           | 2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c
index a538c8a..0fe957f 100644
--- a/app/test/virtual_pmd.c
+++ b/app/test/virtual_pmd.c
@@ -585,7 +585,7 @@ virtual_ethdev_create(const char *name, struct ether_addr *mac_addr,
 	if (eth_dev == NULL)
 		goto err;
 
-	pci_dev->numa_node = socket_id;
+	pci_dev->dev.numa_node = socket_id;
 	pci_drv->name = virtual_ethdev_driver_name;
 	pci_drv->id_table = id_table;
 
diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c
index 6c21fbd..07fd6c8 100644
--- a/lib/librte_eal/bsdapp/eal/eal_pci.c
+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c
@@ -277,7 +277,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)
 	dev->max_vfs = 0;
 
 	/* FreeBSD has no NUMA support (yet) */
-	dev->numa_node = 0;
+	dev->dev.numa_node = 0;
 
 	/* FreeBSD has only one pass through driver */
 	dev->kdrv = RTE_KDRV_NIC_UIO;
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 60501a5..4ac180d 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -167,7 +167,7 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
 
 		RTE_LOG(DEBUG, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n",
 				loc->domain, loc->bus, loc->devid, loc->function,
-				dev->numa_node);
+				dev->dev.numa_node);
 
 		RTE_LOG(DEBUG, EAL, "  probe driver: %x:%x %s\n", dev->id.vendor_id,
 				dev->id.device_id, dr->name);
@@ -241,7 +241,7 @@ rte_eal_pci_detach_dev(struct rte_pci_driver *dr,
 
 		RTE_LOG(DEBUG, EAL, "PCI device "PCI_PRI_FMT" on NUMA socket %i\n",
 				loc->domain, loc->bus, loc->devid,
-				loc->function, dev->numa_node);
+				loc->function, dev->dev.numa_node);
 
 		RTE_LOG(DEBUG, EAL, "  remove driver: %x:%x %s\n", dev->id.vendor_id,
 				dev->id.device_id, dr->name);
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 1ab47f9..593ceb3 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -161,6 +161,7 @@ struct rte_devargs;
 struct rte_bus_device {
 	const char *name;
 	struct rte_devargs *devargs;
+	int numa_node;
 };
 
 /**
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index b894913..5566e3d 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -164,7 +164,6 @@ struct rte_pci_device {
 	struct rte_intr_handle intr_handle;     /**< Interrupt handle */
 	struct rte_pci_driver *driver;          /**< Associated driver */
 	uint16_t max_vfs;                       /**< sriov enable if not zero */
-	int numa_node;                          /**< NUMA node connection */
 	enum rte_kernel_driver kdrv;            /**< Kernel driver passthrough */
 	struct rte_bus_device dev;              /**< Generic device */
 };
diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c
index bc5b5be..c87dd37 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c
@@ -326,13 +326,13 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
 		 dirname);
 	if (access(filename, R_OK) != 0) {
 		/* if no NUMA support, set default to 0 */
-		dev->numa_node = 0;
+		dev->dev.numa_node = 0;
 	} else {
 		if (eal_parse_sysfs_value(filename, &tmp) < 0) {
 			free(dev);
 			return -1;
 		}
-		dev->numa_node = tmp;
+		dev->dev.numa_node = tmp;
 	}
 
 	/* parse resources */
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index ed971b4..908997a 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -3236,6 +3236,6 @@ rte_eth_copy_pci_info(struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_de
 		eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
 
 	eth_dev->data->kdrv = pci_dev->kdrv;
-	eth_dev->data->numa_node = pci_dev->numa_node;
+	eth_dev->data->numa_node = pci_dev->dev.numa_node;
 	eth_dev->data->drv_name = pci_dev->driver->name;
 }
-- 
2.7.0



More information about the dev mailing list