From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Marchand Subject: [PATCH v3 12/13] drivers: export pci drivers Date: Wed, 20 Apr 2016 14:43:55 +0200 Message-ID: <1461156236-25349-13-git-send-email-david.marchand@6wind.com> References: <1453120248-28274-1-git-send-email-david.marchand@6wind.com> <1461156236-25349-1-git-send-email-david.marchand@6wind.com> Cc: thomas.monjalon@6wind.com, stephen@networkplumber.org, bruce.richardson@intel.com, nhorman@tuxdriver.com, pmatilai@redhat.com, christian.ehrhardt@canonical.com To: dev@dpdk.org Return-path: Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by dpdk.org (Postfix) with ESMTP id 8B14E5690 for ; Wed, 20 Apr 2016 14:44:16 +0200 (CEST) Received: by mail-wm0-f53.google.com with SMTP id u206so79459303wme.1 for ; Wed, 20 Apr 2016 05:44:16 -0700 (PDT) In-Reply-To: <1461156236-25349-1-git-send-email-david.marchand@6wind.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: David Marchand --- 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