From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from wes1-so1.wedos.net (wes1-so1.wedos.net [46.28.106.15]) by dpdk.org (Postfix) with ESMTP id 79558ADB3 for ; Fri, 8 Jul 2016 21:10:36 +0200 (CEST) Received: from pcviktorin.fit.vutbr.cz (pcviktorin.fit.vutbr.cz [147.229.13.147]) by wes1-so1.wedos.net (Postfix) with ESMTPSA id 3rmPG41hrPzCCF; Fri, 8 Jul 2016 21:10:36 +0200 (CEST) From: Jan Viktorin To: dev@dpdk.org Cc: Jan Viktorin , Shreyansh Jain , thomas.monjalon@6wind.com, David Marchand Date: Fri, 8 Jul 2016 21:09:35 +0200 Message-Id: <20160708190945.24225-6-viktorin@rehivetech.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160708190945.24225-1-viktorin@rehivetech.com> References: <20160708190945.24225-1-viktorin@rehivetech.com> Subject: [dpdk-dev] [PATCH v1 05/15] eal: move init/uninit to rte_vdev_driver X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jul 2016 19:10:36 -0000 These functions are virtual-device specific and they are never called for any PCI driver (after introducing RTE_EAL_PCI_REGISTER, there is no way to do it). All affected drivers are updated. The prototypes are renamed to rte_vdev_init_t and rte_vdev_uninit_t. Signed-off-by: Jan Viktorin --- drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 4 ++-- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 4 ++-- drivers/crypto/kasumi/rte_kasumi_pmd.c | 4 ++-- drivers/crypto/null/null_crypto_pmd.c | 4 ++-- drivers/crypto/snow3g/rte_snow3g_pmd.c | 4 ++-- drivers/net/af_packet/rte_eth_af_packet.c | 4 ++-- drivers/net/bonding/rte_eth_bond_pmd.c | 4 ++-- drivers/net/mpipe/mpipe_tilegx.c | 4 ++-- drivers/net/null/rte_eth_null.c | 4 ++-- drivers/net/pcap/rte_eth_pcap.c | 4 ++-- drivers/net/ring/rte_eth_ring.c | 4 ++-- drivers/net/vhost/rte_eth_vhost.c | 4 ++-- drivers/net/xenvirt/rte_eth_xenvirt.c | 4 ++-- lib/librte_eal/common/eal_common_vdev.c | 4 ++-- lib/librte_eal/common/include/rte_dev.h | 12 ------------ lib/librte_eal/common/include/rte_vdev.h | 15 ++++++++++++++- 16 files changed, 42 insertions(+), 41 deletions(-) diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c index e6720e8..6e45293 100644 --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c @@ -518,9 +518,9 @@ static struct rte_vdev_driver aesni_gcm_pmd_drv = { .driver = { .name = CRYPTODEV_NAME_AESNI_GCM_PMD, .type = PMD_VDEV, - .init = aesni_gcm_init, - .uninit = aesni_gcm_uninit }, + .init = aesni_gcm_init, + .uninit = aesni_gcm_uninit, }; RTE_EAL_VDRV_REGISTER(aesni_gcm_pmd_drv); diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c index 6c6420b..e7cdcfd 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -718,9 +718,9 @@ static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = { .driver = { .name = CRYPTODEV_NAME_AESNI_MB_PMD, .type = PMD_VDEV, - .init = cryptodev_aesni_mb_init, - .uninit = cryptodev_aesni_mb_uninit }, + .init = cryptodev_aesni_mb_init, + .uninit = cryptodev_aesni_mb_uninit, }; RTE_EAL_VDRV_REGISTER(cryptodev_aesni_mb_pmd_drv); diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c index 91181c4..792184a 100644 --- a/drivers/crypto/kasumi/rte_kasumi_pmd.c +++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c @@ -652,9 +652,9 @@ static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = { .driver = { .name = CRYPTODEV_NAME_KASUMI_PMD, .type = PMD_VDEV, - .init = cryptodev_kasumi_init, - .uninit = cryptodev_kasumi_uninit }, + .init = cryptodev_kasumi_init, + .uninit = cryptodev_kasumi_uninit, }; RTE_EAL_VDRV_REGISTER(cryptodev_kasumi_pmd_drv); diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c index a015ee5..5250e3f 100644 --- a/drivers/crypto/null/null_crypto_pmd.c +++ b/drivers/crypto/null/null_crypto_pmd.c @@ -272,9 +272,9 @@ static struct rte_vdev_driver cryptodev_null_pmd_drv = { .driver = { .name = CRYPTODEV_NAME_NULL_PMD, .type = PMD_VDEV, - .init = cryptodev_null_init, - .uninit = cryptodev_null_uninit }, + .init = cryptodev_null_init, + .uninit = cryptodev_null_uninit, }; RTE_EAL_VDRV_REGISTER(cryptodev_null_pmd_drv); diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c index 060e819..6dc9a2e 100644 --- a/drivers/crypto/snow3g/rte_snow3g_pmd.c +++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c @@ -643,9 +643,9 @@ static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = { .driver = { .name = CRYPTODEV_NAME_SNOW3G_PMD, .type = PMD_VDEV, - .init = cryptodev_snow3g_init, - .uninit = cryptodev_snow3g_uninit }, + .init = cryptodev_snow3g_init, + .uninit = cryptodev_snow3g_uninit, }; RTE_EAL_VDRV_REGISTER(cryptodev_snow3g_pmd_drv); diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index a42e1b4..66aaf99 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -875,9 +875,9 @@ static struct rte_vdev_driver pmd_af_packet_drv = { .driver = { .name = "eth_af_packet", .type = PMD_VDEV, - .init = rte_pmd_af_packet_devinit, - .uninit = rte_pmd_af_packet_devuninit, }, + .init = rte_pmd_af_packet_devinit, + .uninit = rte_pmd_af_packet_devuninit, }; RTE_EAL_VDRV_REGISTER(pmd_af_packet_drv); diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 01e94b8..801a481 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -2508,9 +2508,9 @@ static struct rte_vdev_driver bond_drv = { .driver = { .name = "eth_bond", .type = PMD_VDEV, - .init = bond_init, - .uninit = bond_uninit, }, + .init = bond_init, + .uninit = bond_uninit, }; RTE_EAL_VDRV_REGISTER(bond_drv); diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c index fd8c7a4..fe7c0c6 100644 --- a/drivers/net/mpipe/mpipe_tilegx.c +++ b/drivers/net/mpipe/mpipe_tilegx.c @@ -1627,16 +1627,16 @@ static struct rte_vdev_driver pmd_mpipe_xgbe_drv = { .driver = { .name = "xgbe", .type = PMD_VDEV, - .init = rte_pmd_mpipe_devinit, }, + .init = rte_pmd_mpipe_devinit, }; static struct rte_vdev_driver pmd_mpipe_gbe_drv = { .driver = { .name = "gbe", .type = PMD_VDEV, - .init = rte_pmd_mpipe_devinit, }, + .init = rte_pmd_mpipe_devinit, }; RTE_EAL_VDRV_REGISTER(pmd_mpipe_xgbe_drv); diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 56370c9..85c4526 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -686,9 +686,9 @@ static struct rte_vdev_driver pmd_null_drv = { .driver = { .name = "eth_null", .type = PMD_VDEV, - .init = rte_pmd_null_devinit, - .uninit = rte_pmd_null_devuninit, }, + .init = rte_pmd_null_devinit, + .uninit = rte_pmd_null_devuninit, }; RTE_EAL_VDRV_REGISTER(pmd_null_drv); diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index d59d9bb..934b77f 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -1087,9 +1087,9 @@ static struct rte_vdev_driver pmd_pcap_drv = { .driver = { .name = "eth_pcap", .type = PMD_VDEV, - .init = rte_pmd_pcap_devinit, - .uninit = rte_pmd_pcap_devuninit, }, + .init = rte_pmd_pcap_devinit, + .uninit = rte_pmd_pcap_devuninit, }; RTE_EAL_VDRV_REGISTER(pmd_pcap_drv); diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index ff15cfd..95245be 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -627,9 +627,9 @@ static struct rte_vdev_driver pmd_ring_drv = { .driver = { .name = "eth_ring", .type = PMD_VDEV, - .init = rte_pmd_ring_devinit, - .uninit = rte_pmd_ring_devuninit, }, + .init = rte_pmd_ring_devinit, + .uninit = rte_pmd_ring_devuninit, }; RTE_EAL_VDRV_REGISTER(pmd_ring_drv); diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index f10944b..1c8b33d 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -921,9 +921,9 @@ static struct rte_vdev_driver pmd_vhost_drv = { .driver = { .name = "eth_vhost", .type = PMD_VDEV, - .init = rte_pmd_vhost_devinit, - .uninit = rte_pmd_vhost_devuninit, }, + .init = rte_pmd_vhost_devinit, + .uninit = rte_pmd_vhost_devuninit, }; RTE_EAL_VDRV_REGISTER(pmd_vhost_drv); diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c index 1e1a876..b97246b 100644 --- a/drivers/net/xenvirt/rte_eth_xenvirt.c +++ b/drivers/net/xenvirt/rte_eth_xenvirt.c @@ -760,9 +760,9 @@ static struct rte_vdev_driver pmd_xenvirt_drv = { .driver = { .name = "eth_xenvirt", .type = PMD_VDEV, - .init = rte_pmd_xenvirt_devinit, - .uninit = rte_pmd_xenvirt_devuninit, }, + .init = rte_pmd_xenvirt_devinit, + .uninit = rte_pmd_xenvirt_devuninit, }; RTE_EAL_VDRV_REGISTER(pmd_xenvirt_drv); diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c index 5a74da8..7e7ddd1 100644 --- a/lib/librte_eal/common/eal_common_vdev.c +++ b/lib/librte_eal/common/eal_common_vdev.c @@ -67,7 +67,7 @@ rte_eal_vdev_init(const char *name, const char *args) * So use strncmp to compare. */ if (!strncmp(driver->driver.name, name, strlen(driver->driver.name))) - return driver->driver.init(name, args); + return driver->init(name, args); } RTE_LOG(ERR, EAL, "no driver found for %s\n", name); @@ -90,7 +90,7 @@ rte_eal_vdev_uninit(const char *name) * So use strncmp to compare. */ if (!strncmp(driver->driver.name, name, strlen(driver->driver.name))) - return driver->driver.uninit(name); + return driver->uninit(name); } RTE_LOG(ERR, EAL, "no driver found for %s\n", name); diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index 2aeb752..63fc454 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -105,16 +105,6 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...) TAILQ_HEAD(rte_driver_list, rte_driver); /** - * Initialization function called for each device driver once. - */ -typedef int (rte_dev_init_t)(const char *name, const char *args); - -/** - * Uninitilization function called for each device driver once. - */ -typedef int (rte_dev_uninit_t)(const char *name); - -/** * Driver type enumeration */ enum pmd_type { @@ -129,8 +119,6 @@ struct rte_driver { TAILQ_ENTRY(rte_driver) next; /**< Next in list. */ enum pmd_type type; /**< PMD Driver type */ const char *name; /**< Driver name. */ - rte_dev_init_t *init; /**< Device init. function. */ - rte_dev_uninit_t *uninit; /**< Device uninit. function. */ }; /** diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h index 523bd92..709aa2e 100644 --- a/lib/librte_eal/common/include/rte_vdev.h +++ b/lib/librte_eal/common/include/rte_vdev.h @@ -43,12 +43,25 @@ extern "C" { /** Double linked list of virtual device drivers. */ TAILQ_HEAD(vdev_driver_list, rte_vdev_driver); + +/** + * Initialization function called for each device driver once. + */ +typedef int (rte_vdev_init_t)(const char *name, const char *args); + +/** + * Uninitilization function called for each device driver once. + */ +typedef int (rte_vdev_uninit_t)(const char *name); + /** * A virtual device driver abstraction. */ struct rte_vdev_driver { TAILQ_ENTRY(rte_vdev_driver) next; /**< Next in list. */ - struct rte_driver driver; /**< Inherited general driver. */ + struct rte_driver driver; /**< Inherited general driver. */ + rte_vdev_init_t *init; /**< Virtual device init. function. */ + rte_vdev_uninit_t *uninit; /**< Virtual device uninit. function. */ }; /** -- 2.9.0