From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerin Jacob Subject: [PATCH v2 2/2] eal: rename dev init API for consistency Date: Sun, 4 Dec 2016 02:25:39 +0530 Message-ID: <1480798539-13360-3-git-send-email-jerin.jacob@caviumnetworks.com> References: <1479628850-27202-1-git-send-email-jerin.jacob@caviumnetworks.com> <1480798539-13360-1-git-send-email-jerin.jacob@caviumnetworks.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , , , , Jerin Jacob To: Return-path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0076.outbound.protection.outlook.com [104.47.38.76]) by dpdk.org (Postfix) with ESMTP id E08CC559C for ; Sat, 3 Dec 2016 21:56:03 +0100 (CET) In-Reply-To: <1480798539-13360-1-git-send-email-jerin.jacob@caviumnetworks.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" rte_eal_dev_init() is a misleading name. It actually performs the driver->probe for vdev, which is parallel to rte_eal_pci_probe. Changed to rte_eal_vdev_probe for consistency and moved the vdev specific probe to eal_common_vdev.c Suggested-by: Shreyansh Jain Signed-off-by: Jerin Jacob --- drivers/net/virtio/virtio_user_ethdev.c | 2 +- lib/librte_eal/bsdapp/eal/eal.c | 4 ++-- lib/librte_eal/bsdapp/eal/rte_eal_version.map | 2 +- lib/librte_eal/common/eal_common_dev.c | 29 ------------------------- lib/librte_eal/common/eal_common_vdev.c | 29 +++++++++++++++++++++++++ lib/librte_eal/common/include/rte_dev.h | 4 ++-- lib/librte_eal/linuxapp/eal/eal.c | 4 ++-- lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 +- 8 files changed, 38 insertions(+), 38 deletions(-) diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 406beea..3b8f111 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -327,7 +327,7 @@ virtio_user_eth_dev_free(struct rte_eth_dev *eth_dev) } /* Dev initialization routine. Invoked once for each virtio vdev at - * EAL init time, see rte_eal_dev_init(). + * EAL init time, see rte_eal_vdev_probe(). * Returns 0 on success. */ static int diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index 2206277..62245f3 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -613,8 +613,8 @@ rte_eal_init(int argc, char **argv) if (rte_eal_pci_probe()) rte_panic("Cannot probe PCI\n"); - if (rte_eal_dev_init() < 0) - rte_panic("Cannot init pmd devices\n"); + if (rte_eal_vdev_probe() < 0) + rte_panic("Cannot probe vdev drivers\n"); rte_eal_mcfg_complete(); diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index 2f81f7c..f90bde9 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -22,7 +22,7 @@ DPDK_2.0 { rte_dump_tailq; rte_eal_alarm_cancel; rte_eal_alarm_set; - rte_eal_dev_init; + rte_eal_vdev_probe; rte_eal_devargs_add; rte_eal_devargs_dump; rte_eal_devargs_type_count; diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c index 4f3b493..6d6868f 100644 --- a/lib/librte_eal/common/eal_common_dev.c +++ b/lib/librte_eal/common/eal_common_dev.c @@ -38,7 +38,6 @@ #include #include -#include #include #include #include @@ -76,34 +75,6 @@ void rte_eal_device_remove(struct rte_device *dev) TAILQ_REMOVE(&dev_device_list, dev, next); } -int -rte_eal_dev_init(void) -{ - struct rte_devargs *devargs; - - /* - * Note that the dev_driver_list is populated here - * from calls made to rte_eal_driver_register from constructor functions - * embedded into PMD modules via the RTE_PMD_REGISTER_VDEV macro - */ - - /* call the init function for each virtual device */ - TAILQ_FOREACH(devargs, &devargs_list, next) { - - if (devargs->type != RTE_DEVTYPE_VIRTUAL) - continue; - - if (rte_eal_vdev_init(devargs->virt.drv_name, - devargs->args)) { - RTE_LOG(ERR, EAL, "failed to initialize %s device\n", - devargs->virt.drv_name); - return -1; - } - } - - return 0; -} - int rte_eal_dev_attach(const char *name, const char *devargs) { struct rte_pci_addr addr; diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c index 0ff2377..ed6a751 100644 --- a/lib/librte_eal/common/eal_common_vdev.c +++ b/lib/librte_eal/common/eal_common_vdev.c @@ -37,6 +37,7 @@ #include #include +#include #include #include @@ -114,3 +115,31 @@ rte_eal_vdev_uninit(const char *name) RTE_LOG(ERR, EAL, "no driver found for %s\n", name); return -EINVAL; } + +int +rte_eal_vdev_probe(void) +{ + struct rte_devargs *devargs; + + /* + * Note that the dev_driver_list is populated here + * from calls made to rte_eal_driver_register from constructor functions + * embedded into PMD modules via the RTE_PMD_REGISTER_VDEV macro + */ + + /* call the init function for each virtual device */ + TAILQ_FOREACH(devargs, &devargs_list, next) { + + if (devargs->type != RTE_DEVTYPE_VIRTUAL) + continue; + + if (rte_eal_vdev_init(devargs->virt.drv_name, + devargs->args)) { + RTE_LOG(ERR, EAL, "failed to initialize %s device\n", + devargs->virt.drv_name); + return -1; + } + } + + return 0; +} diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h index 8840380..146f505 100644 --- a/lib/librte_eal/common/include/rte_dev.h +++ b/lib/librte_eal/common/include/rte_dev.h @@ -171,9 +171,9 @@ void rte_eal_driver_register(struct rte_driver *driver); void rte_eal_driver_unregister(struct rte_driver *driver); /** - * Initalize all the registered drivers in this process + * Probe all the registered vdev drivers in this process */ -int rte_eal_dev_init(void); +int rte_eal_vdev_probe(void); /** * Initialize a driver specified by name. diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 16dd5b9..faf75cf 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -884,8 +884,8 @@ rte_eal_init(int argc, char **argv) if (rte_eal_pci_probe()) rte_panic("Cannot probe PCI\n"); - if (rte_eal_dev_init() < 0) - rte_panic("Cannot init pmd devices\n"); + if (rte_eal_vdev_probe() < 0) + rte_panic("Cannot probe vdev drivers\n"); rte_eal_mcfg_complete(); diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index 83721ba..67fc95b 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -22,7 +22,7 @@ DPDK_2.0 { rte_dump_tailq; rte_eal_alarm_cancel; rte_eal_alarm_set; - rte_eal_dev_init; + rte_eal_vdev_probe; rte_eal_devargs_add; rte_eal_devargs_dump; rte_eal_devargs_type_count; -- 2.5.5