From 50a3345fa9ea6482f197567497b0b8d201173a59 Mon Sep 17 00:00:00 2001 From: Shreyansh Jain Date: Thu, 6 Oct 2016 19:24:03 +0530 Subject: [PATCH] vdev: rename init/uninit ops to probe/remove Inline with PCI probe and remove, VDEV probe and remove hooks provide a uniform naming. PCI probe represents scan and driver initialization. For VDEV, it will represent argument parsing and initialization. Signed-off-by: Shreyansh Jain --- drivers/crypto/aesni_gcm/aesni_gcm_pmd.c | 12 ++++++------ drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 12 ++++++------ drivers/crypto/kasumi/rte_kasumi_pmd.c | 12 ++++++------ drivers/crypto/null/null_crypto_pmd.c | 12 ++++++------ drivers/crypto/snow3g/rte_snow3g_pmd.c | 12 ++++++------ drivers/net/af_packet/rte_eth_af_packet.c | 8 ++++---- drivers/net/bonding/rte_eth_bond_pmd.c | 8 ++++---- drivers/net/mpipe/mpipe_tilegx.c | 6 +++--- drivers/net/null/rte_eth_null.c | 8 ++++---- drivers/net/pcap/rte_eth_pcap.c | 8 ++++---- drivers/net/ring/rte_eth_ring.c | 8 ++++---- drivers/net/vhost/rte_eth_vhost.c | 8 ++++---- drivers/net/virtio/virtio_user_ethdev.c | 8 ++++---- drivers/net/xenvirt/rte_eth_xenvirt.c | 8 ++++---- lib/librte_eal/common/eal_common_vdev.c | 4 ++-- lib/librte_eal/common/include/rte_vdev.h | 14 +++++++------- 16 files changed, 74 insertions(+), 74 deletions(-) diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c index fc939fa0da..317c556fed 100644 --- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c +++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c @@ -395,7 +395,7 @@ aesni_gcm_pmd_dequeue_burst(void *queue_pair, return nb_dequeued; } -static int aesni_gcm_uninit(const char *name); +static int aesni_gcm_remove(const char *name); static int aesni_gcm_create(const char *name, @@ -477,12 +477,12 @@ aesni_gcm_create(const char *name, init_error: GCM_LOG_ERR("driver %s: create failed", name); - aesni_gcm_uninit(crypto_dev_name); + aesni_gcm_remove(crypto_dev_name); return -EFAULT; } static int -aesni_gcm_init(const char *name, const char *input_args) +aesni_gcm_probe(const char *name, const char *input_args) { struct rte_crypto_vdev_init_params init_params = { RTE_CRYPTODEV_VDEV_DEFAULT_MAX_NB_QUEUE_PAIRS, @@ -503,7 +503,7 @@ aesni_gcm_init(const char *name, const char *input_args) } static int -aesni_gcm_uninit(const char *name) +aesni_gcm_remove(const char *name) { if (name == NULL) return -EINVAL; @@ -515,8 +515,8 @@ aesni_gcm_uninit(const char *name) } static struct rte_vdev_driver aesni_gcm_pmd_drv = { - .init = aesni_gcm_init, - .uninit = aesni_gcm_uninit + .probe = aesni_gcm_probe, + .remove = aesni_gcm_remove }; DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_AESNI_GCM_PMD, 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 2047269c50..ff2fc25e18 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -595,7 +595,7 @@ aesni_mb_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops, } -static int cryptodev_aesni_mb_uninit(const char *name); +static int cryptodev_aesni_mb_remove(const char *name); static int cryptodev_aesni_mb_create(const char *name, @@ -675,13 +675,13 @@ cryptodev_aesni_mb_create(const char *name, init_error: MB_LOG_ERR("driver %s: cryptodev_aesni_create failed", name); - cryptodev_aesni_mb_uninit(crypto_dev_name); + cryptodev_aesni_mb_remove(crypto_dev_name); return -EFAULT; } static int -cryptodev_aesni_mb_init(const char *name, +cryptodev_aesni_mb_probe(const char *name, const char *input_args) { struct rte_crypto_vdev_init_params init_params = { @@ -703,7 +703,7 @@ cryptodev_aesni_mb_init(const char *name, } static int -cryptodev_aesni_mb_uninit(const char *name) +cryptodev_aesni_mb_remove(const char *name) { if (name == NULL) return -EINVAL; @@ -715,8 +715,8 @@ cryptodev_aesni_mb_uninit(const char *name) } static struct rte_vdev_driver cryptodev_aesni_mb_pmd_drv = { - .init = cryptodev_aesni_mb_init, - .uninit = cryptodev_aesni_mb_uninit + .probe = cryptodev_aesni_mb_probe, + .remove = cryptodev_aesni_mb_remove }; DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_AESNI_MB_PMD, cryptodev_aesni_mb_pmd_drv); diff --git a/drivers/crypto/kasumi/rte_kasumi_pmd.c b/drivers/crypto/kasumi/rte_kasumi_pmd.c index d1b0b996c3..8774fc2306 100644 --- a/drivers/crypto/kasumi/rte_kasumi_pmd.c +++ b/drivers/crypto/kasumi/rte_kasumi_pmd.c @@ -556,7 +556,7 @@ kasumi_pmd_dequeue_burst(void *queue_pair, return nb_dequeued; } -static int cryptodev_kasumi_uninit(const char *name); +static int cryptodev_kasumi_remove(const char *name); static int cryptodev_kasumi_create(const char *name, @@ -611,12 +611,12 @@ cryptodev_kasumi_create(const char *name, init_error: KASUMI_LOG_ERR("driver %s: cryptodev_kasumi_create failed", name); - cryptodev_kasumi_uninit(crypto_dev_name); + cryptodev_kasumi_remove(crypto_dev_name); return -EFAULT; } static int -cryptodev_kasumi_init(const char *name, +cryptodev_kasumi_probe(const char *name, const char *input_args) { struct rte_crypto_vdev_init_params init_params = { @@ -638,7 +638,7 @@ cryptodev_kasumi_init(const char *name, } static int -cryptodev_kasumi_uninit(const char *name) +cryptodev_kasumi_remove(const char *name) { if (name == NULL) return -EINVAL; @@ -651,8 +651,8 @@ cryptodev_kasumi_uninit(const char *name) } static struct rte_vdev_driver cryptodev_kasumi_pmd_drv = { - .init = cryptodev_kasumi_init, - .uninit = cryptodev_kasumi_uninit + .probe = cryptodev_kasumi_probe, + .remove = cryptodev_kasumi_remove }; DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_KASUMI_PMD, cryptodev_kasumi_pmd_drv); diff --git a/drivers/crypto/null/null_crypto_pmd.c b/drivers/crypto/null/null_crypto_pmd.c index bd139b4f56..e41e8190c9 100644 --- a/drivers/crypto/null/null_crypto_pmd.c +++ b/drivers/crypto/null/null_crypto_pmd.c @@ -182,7 +182,7 @@ null_crypto_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops, return nb_dequeued; } -static int cryptodev_null_uninit(const char *name); +static int cryptodev_null_remove(const char *name); /** Create crypto device */ static int @@ -227,14 +227,14 @@ cryptodev_null_create(const char *name, init_error: NULL_CRYPTO_LOG_ERR("driver %s: cryptodev_null_create failed", name); - cryptodev_null_uninit(crypto_dev_name); + cryptodev_null_remove(crypto_dev_name); return -EFAULT; } /** Initialise null crypto device */ static int -cryptodev_null_init(const char *name, +cryptodev_null_probe(const char *name, const char *input_args) { struct rte_crypto_vdev_init_params init_params = { @@ -257,7 +257,7 @@ cryptodev_null_init(const char *name, /** Uninitialise null crypto device */ static int -cryptodev_null_uninit(const char *name) +cryptodev_null_remove(const char *name) { if (name == NULL) return -EINVAL; @@ -269,8 +269,8 @@ cryptodev_null_uninit(const char *name) } static struct rte_vdev_driver cryptodev_null_pmd_drv = { - .init = cryptodev_null_init, - .uninit = cryptodev_null_uninit + .probe = cryptodev_null_probe, + .remove = cryptodev_null_remove }; DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_NULL_PMD, cryptodev_null_pmd_drv); diff --git a/drivers/crypto/snow3g/rte_snow3g_pmd.c b/drivers/crypto/snow3g/rte_snow3g_pmd.c index c46d7e5e71..f4b596eb5a 100644 --- a/drivers/crypto/snow3g/rte_snow3g_pmd.c +++ b/drivers/crypto/snow3g/rte_snow3g_pmd.c @@ -545,7 +545,7 @@ snow3g_pmd_dequeue_burst(void *queue_pair, return nb_dequeued; } -static int cryptodev_snow3g_uninit(const char *name); +static int cryptodev_snow3g_remove(const char *name); static int cryptodev_snow3g_create(const char *name, @@ -599,12 +599,12 @@ cryptodev_snow3g_create(const char *name, init_error: SNOW3G_LOG_ERR("driver %s: cryptodev_snow3g_create failed", name); - cryptodev_snow3g_uninit(crypto_dev_name); + cryptodev_snow3g_remove(crypto_dev_name); return -EFAULT; } static int -cryptodev_snow3g_init(const char *name, +cryptodev_snow3g_probe(const char *name, const char *input_args) { struct rte_crypto_vdev_init_params init_params = { @@ -626,7 +626,7 @@ cryptodev_snow3g_init(const char *name, } static int -cryptodev_snow3g_uninit(const char *name) +cryptodev_snow3g_remove(const char *name) { if (name == NULL) return -EINVAL; @@ -639,8 +639,8 @@ cryptodev_snow3g_uninit(const char *name) } static struct rte_vdev_driver cryptodev_snow3g_pmd_drv = { - .init = cryptodev_snow3g_init, - .uninit = cryptodev_snow3g_uninit + .probe = cryptodev_snow3g_probe, + .remove = cryptodev_snow3g_remove }; DRIVER_REGISTER_VDEV(CRYPTODEV_NAME_SNOW3G_PMD, 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 5f48ead4b2..6777c41b52 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -820,7 +820,7 @@ rte_eth_from_packet(const char *name, } static int -rte_pmd_af_packet_devinit(const char *name, const char *params) +rte_pmd_af_packet_probe(const char *name, const char *params) { unsigned numa_node; int ret = 0; @@ -858,7 +858,7 @@ exit: } static int -rte_pmd_af_packet_devuninit(const char *name) +rte_pmd_af_packet_remove(const char *name) { struct rte_eth_dev *eth_dev = NULL; struct pmd_internals *internals; @@ -890,8 +890,8 @@ rte_pmd_af_packet_devuninit(const char *name) } static struct rte_vdev_driver pmd_af_packet_drv = { - .init = rte_pmd_af_packet_devinit, - .uninit = rte_pmd_af_packet_devuninit, + .probe = rte_pmd_af_packet_probe, + .remove = rte_pmd_af_packet_remove, }; DRIVER_REGISTER_VDEV(net_af_packet, 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 92024816a6..970fe0c8b0 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -2177,7 +2177,7 @@ const struct eth_dev_ops default_dev_ops = { }; static int -bond_init(const char *name, const char *params) +bond_probe(const char *name, const char *params) { struct bond_dev_private *internals; struct rte_kvargs *kvlist; @@ -2244,7 +2244,7 @@ parse_error: } static int -bond_uninit(const char *name) +bond_remove(const char *name) { int ret; @@ -2509,8 +2509,8 @@ bond_ethdev_configure(struct rte_eth_dev *dev) } static struct rte_vdev_driver bond_drv = { - .init = bond_init, - .uninit = bond_uninit, + .probe = bond_probe, + .remove = bond_remove, }; DRIVER_REGISTER_VDEV(net_bonding, bond_drv); diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c index 5b2e8cde71..b9eefdf328 100644 --- a/drivers/net/mpipe/mpipe_tilegx.c +++ b/drivers/net/mpipe/mpipe_tilegx.c @@ -1549,7 +1549,7 @@ mpipe_link_mac(const char *ifname, uint8_t *mac) } static int -rte_pmd_mpipe_devinit(const char *ifname, +rte_pmd_mpipe_probe(const char *ifname, const char *params __rte_unused) { gxio_mpipe_context_t *context; @@ -1624,11 +1624,11 @@ rte_pmd_mpipe_devinit(const char *ifname, } static struct rte_vdev_driver pmd_mpipe_xgbe_drv = { - .init = rte_pmd_mpipe_devinit, + .probe = rte_pmd_mpipe_probe, }; static struct rte_vdev_driver pmd_mpipe_gbe_drv = { - .init = rte_pmd_mpipe_devinit, + .probe = rte_pmd_mpipe_probe, }; DRIVER_REGISTER_VDEV(net_mpipe_xgbe, pmd_mpipe_xgbe_drv); diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 2adc43e6bb..c2e10a81ce 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -611,7 +611,7 @@ get_packet_copy_arg(const char *key __rte_unused, } static int -rte_pmd_null_devinit(const char *name, const char *params) +rte_pmd_null_probe(const char *name, const char *params) { unsigned numa_node; unsigned packet_size = default_packet_size; @@ -663,7 +663,7 @@ free_kvlist: } static int -rte_pmd_null_devuninit(const char *name) +rte_pmd_null_remove(const char *name) { struct rte_eth_dev *eth_dev = NULL; @@ -687,8 +687,8 @@ rte_pmd_null_devuninit(const char *name) } static struct rte_vdev_driver pmd_null_drv = { - .init = rte_pmd_null_devinit, - .uninit = rte_pmd_null_devuninit, + .probe = rte_pmd_null_probe, + .remove = rte_pmd_null_remove, }; DRIVER_REGISTER_VDEV(net_null, pmd_null_drv); diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 51ef86f7af..965c999954 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -937,7 +937,7 @@ eth_from_pcaps(const char *name, struct pmd_devargs *rx_queues, } static int -pmd_pcap_devinit(const char *name, const char *params) +pmd_pcap_probe(const char *name, const char *params) { unsigned int is_rx_pcap = 0, is_tx_pcap = 0; struct rte_kvargs *kvlist; @@ -1036,7 +1036,7 @@ free_kvlist: } static int -pmd_pcap_devuninit(const char *name) +pmd_pcap_remove(const char *name) { struct rte_eth_dev *eth_dev = NULL; @@ -1060,8 +1060,8 @@ pmd_pcap_devuninit(const char *name) } static struct rte_vdev_driver pmd_pcap_drv = { - .init = pmd_pcap_devinit, - .uninit = pmd_pcap_devuninit, + .probe = pmd_pcap_probe, + .remove = pmd_pcap_remove, }; DRIVER_REGISTER_VDEV(net_pcap, pmd_pcap_drv); diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index ee435c19d8..b91f222942 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -505,7 +505,7 @@ out: } static int -rte_pmd_ring_devinit(const char *name, const char *params) +rte_pmd_ring_probe(const char *name, const char *params) { struct rte_kvargs *kvlist = NULL; int ret = 0; @@ -580,7 +580,7 @@ out_free: } static int -rte_pmd_ring_devuninit(const char *name) +rte_pmd_ring_remove(const char *name) { struct rte_eth_dev *eth_dev = NULL; struct pmd_internals *internals = NULL; @@ -624,8 +624,8 @@ rte_pmd_ring_devuninit(const char *name) } static struct rte_vdev_driver pmd_ring_drv = { - .init = rte_pmd_ring_devinit, - .uninit = rte_pmd_ring_devuninit, + .probe = rte_pmd_ring_probe, + .remove = rte_pmd_ring_remove, }; DRIVER_REGISTER_VDEV(net_ring, pmd_ring_drv); diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 409e0901e3..c1d09a0230 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -1124,7 +1124,7 @@ open_int(const char *key __rte_unused, const char *value, void *extra_args) } static int -rte_pmd_vhost_devinit(const char *name, const char *params) +rte_pmd_vhost_probe(const char *name, const char *params) { struct rte_kvargs *kvlist = NULL; int ret = 0; @@ -1176,7 +1176,7 @@ out_free: } static int -rte_pmd_vhost_devuninit(const char *name) +rte_pmd_vhost_remove(const char *name) { struct rte_eth_dev *eth_dev = NULL; struct pmd_internal *internal; @@ -1226,8 +1226,8 @@ rte_pmd_vhost_devuninit(const char *name) } static struct rte_vdev_driver pmd_vhost_drv = { - .init = rte_pmd_vhost_devinit, - .uninit = rte_pmd_vhost_devuninit, + .probe = rte_pmd_vhost_probe, + .remove = rte_pmd_vhost_remove, }; DRIVER_REGISTER_VDEV(net_vhost, pmd_vhost_drv); diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index a52a140432..6fcedd967f 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -331,7 +331,7 @@ virtio_user_eth_dev_free(struct rte_eth_dev *eth_dev) * Returns 0 on success. */ static int -virtio_user_pmd_devinit(const char *name, const char *params) +virtio_user_pmd_probe(const char *name, const char *params) { struct rte_kvargs *kvlist = NULL; struct rte_eth_dev *eth_dev; @@ -445,7 +445,7 @@ end: /** Called by rte_eth_dev_detach() */ static int -virtio_user_pmd_devuninit(const char *name) +virtio_user_pmd_remove(const char *name) { struct rte_eth_dev *eth_dev; struct virtio_hw *hw; @@ -474,8 +474,8 @@ virtio_user_pmd_devuninit(const char *name) } static struct rte_vdev_driver virtio_user_driver = { - .init = virtio_user_pmd_devinit, - .uninit = virtio_user_pmd_devuninit, + .probe = virtio_user_pmd_probe, + .remove = virtio_user_pmd_remove, }; DRIVER_REGISTER_VDEV(net_virtio_user, virtio_user_driver); diff --git a/drivers/net/xenvirt/rte_eth_xenvirt.c b/drivers/net/xenvirt/rte_eth_xenvirt.c index 4ade78cfc5..fa01ba099e 100644 --- a/drivers/net/xenvirt/rte_eth_xenvirt.c +++ b/drivers/net/xenvirt/rte_eth_xenvirt.c @@ -729,7 +729,7 @@ eth_dev_xenvirt_free(const char *name, const unsigned numa_node) /*TODO: Support multiple process model */ static int -rte_pmd_xenvirt_devinit(const char *name, const char *params) +rte_pmd_xenvirt_probe(const char *name, const char *params) { if (virtio_idx == 0) { if (xenstore_init() != 0) { @@ -746,7 +746,7 @@ rte_pmd_xenvirt_devinit(const char *name, const char *params) } static int -rte_pmd_xenvirt_devuninit(const char *name) +rte_pmd_xenvirt_remove(const char *name) { eth_dev_xenvirt_free(name, rte_socket_id()); @@ -760,8 +760,8 @@ rte_pmd_xenvirt_devuninit(const char *name) } static struct rte_vdev_driver pmd_xenvirt_drv = { - .init = rte_pmd_xenvirt_devinit, - .uninit = rte_pmd_xenvirt_devuninit, + .probe = rte_pmd_xenvirt_probe, + .remove = rte_pmd_xenvirt_remove, }; DRIVER_REGISTER_VDEV(net_xenvirt, pmd_xenvirt_drv); diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c index 6dab782580..0434390637 100644 --- a/lib/librte_eal/common/eal_common_vdev.c +++ b/lib/librte_eal/common/eal_common_vdev.c @@ -76,7 +76,7 @@ rte_eal_vdev_init(const char *name, const char *args) */ if (!strncmp(driver->driver.name, name, strlen(driver->driver.name))) - return driver->init(name, args); + return driver->probe(name, args); } RTE_LOG(ERR, EAL, "no driver found for %s\n", name); @@ -100,7 +100,7 @@ rte_eal_vdev_uninit(const char *name) */ if (!strncmp(driver->driver.name, name, strlen(driver->driver.name))) - return driver->uninit(name); + return driver->remove(name); } RTE_LOG(ERR, EAL, "no driver found for %s\n", name); diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h index 1e6b33820a..0dec8eb276 100644 --- a/lib/librte_eal/common/include/rte_vdev.h +++ b/lib/librte_eal/common/include/rte_vdev.h @@ -44,23 +44,23 @@ extern "C" { TAILQ_HEAD(vdev_driver_list, rte_vdev_driver); /** - * Initialization function called for each virtual device driver once. + * Probe function called for each virtual device driver once. */ -typedef int (rte_vdev_init_t)(const char *name, const char *args); +typedef int (rte_vdev_probe_t)(const char *name, const char *args); /** - * Uninitilization function called for each virtual device driver once. + * Remove function called for each virtual device driver once. */ -typedef int (rte_vdev_uninit_t)(const char *name); +typedef int (rte_vdev_remove_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. */ - rte_vdev_init_t *init; /**< Virtual device init. function. */ - rte_vdev_uninit_t *uninit; /**< Virtual device uninit. function. */ + struct rte_driver driver; /**< Inherited general driver. */ + rte_vdev_probe_t *probe; /**< Virtual device probe function. */ + rte_vdev_remove_t *remove; /**< Virtual device remove function. */ }; /** -- 2.20.1