[dpdk-dev] [PATCH v3 12/13] drivers: export pci drivers

David Marchand david.marchand at 6wind.com
Wed Apr 20 14:43:55 CEST 2016


Signed-off-by: David Marchand <david.marchand at 6wind.com>
---
 drivers/net/mlx4/mlx4.c                 | 1 +
 drivers/net/mlx5/mlx5.c                 | 1 +
 drivers/net/virtio/virtio_ethdev.c      | 1 +
 lib/librte_eal/common/include/rte_pci.h | 7 +++++++
 4 files changed, 10 insertions(+)

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 0c76e72..14fe9dd 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5789,6 +5789,7 @@ static struct eth_driver mlx4_driver = {
 	.dev_private_size = sizeof(struct priv)
 };
 
+RTE_EAL_PCI_DRIVER_EXPORT(mlx4, mlx4_driver.pci_drv);
 RTE_INIT(rte_mlx4_pmd_init);
 static void
 rte_mlx4_pmd_init(void)
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index f6399fc..975bb3f 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -646,6 +646,7 @@ static struct eth_driver mlx5_driver = {
 	.dev_private_size = sizeof(struct priv)
 };
 
+RTE_EAL_PCI_DRIVER_EXPORT(mlx5, mlx5_driver.pci_drv);
 RTE_INIT(rte_mlx5_pmd_init);
 static void
 rte_mlx5_pmd_init(void)
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index ee95cab..587ba60 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1211,6 +1211,7 @@ static struct eth_driver rte_virtio_pmd = {
 	.dev_private_size = sizeof(struct virtio_hw),
 };
 
+RTE_EAL_PCI_DRIVER_EXPORT(virtio, rte_virtio_pmd.pci_drv);
 RTE_INIT(rte_virtio_pmd_init);
 static void
 rte_virtio_pmd_init(void)
diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h
index 3bb1833..3095f94 100644
--- a/lib/librte_eal/common/include/rte_pci.h
+++ b/lib/librte_eal/common/include/rte_pci.h
@@ -497,12 +497,19 @@ void rte_eal_pci_dump(FILE *f);
 void rte_eal_pci_register(struct rte_pci_driver *driver);
 
 #define RTE_EAL_PCI_REGISTER(name, d) \
+RTE_EAL_PCI_DRIVER_EXPORT(name, d); \
 RTE_INIT(pciinitfn_ ##name); \
 static void pciinitfn_ ##name(void) \
 { \
 	rte_eal_pci_register(&d); \
 }
 
+#define RTE_EAL_PCI_DRIVER_PREFIX "pcidriver_"
+
+#define RTE_EAL_PCI_DRIVER_EXPORT(name, d) \
+extern const typeof(d) *pcidriver_ ##name; \
+const typeof(d) *pcidriver_ ##name = &d
+
 /**
  * Unregister a PCI driver.
  *
-- 
1.9.1



More information about the dev mailing list