DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shreyansh Jain <shreyansh.jain@nxp.com>
To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Cc: <dev@dpdk.org>, <declan.doherty@intel.com>,
	<david.marchand@6wind.com>, <thomas.monjalon@6wind.com>
Subject: Re: [dpdk-dev] [PATCH v2 2/2] eal: rename dev init API for consistency
Date: Mon, 5 Dec 2016 15:42:18 +0530	[thread overview]
Message-ID: <d6387545-5cd4-ce73-c1d2-a52c413e5820@nxp.com> (raw)
In-Reply-To: <1480798539-13360-3-git-send-email-jerin.jacob@caviumnetworks.com>

Hello Jerin,

On Sunday 04 December 2016 02:25 AM, Jerin Jacob wrote:
> 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 <shreyansh.jain@nxp.com>
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
>  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 <sys/queue.h>
>
>  #include <rte_dev.h>
> -#include <rte_devargs.h>
>  #include <rte_debug.h>
>  #include <rte_devargs.h>
>  #include <rte_log.h>
> @@ -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 <stdint.h>
>  #include <sys/queue.h>
>
> +#include <rte_devargs.h>
>  #include <rte_vdev.h>
>  #include <rte_common.h>
>
> @@ -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,

The situation now is:
rte_eal_init=>rte_eal_vdev_probe()=>rte_eal_vdev_init()=> driver->probe()

Even though I had suggested this, my intention was to completely do away 
with rte_*_[v]dev_init as it is misleading.

rte_eal_init=>rte_eal_vdev_probe=>driver->probe()

should be the ideal order, IMO.
Apologies, I was not completely clear then.

> +					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;
>

  reply	other threads:[~2016-12-05 10:09 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-20  8:00 [dpdk-dev] [PATCH] eal: postpone vdev initialization Jerin Jacob
2016-11-20 16:05 ` David Marchand
2016-11-21  5:09 ` Shreyansh Jain
2016-11-21 16:56   ` Jerin Jacob
2016-11-21  9:54 ` Ferruh Yigit
2016-11-21 17:02   ` Jerin Jacob
2016-11-21 17:35     ` Ferruh Yigit
2016-11-23  0:07       ` Jerin Jacob
2016-11-23 13:29         ` Thomas Monjalon
2016-12-03 20:55 ` [dpdk-dev] [PATCH v2 0/2] " Jerin Jacob
2016-12-03 20:55   ` [dpdk-dev] [PATCH v2 1/2] eal: " Jerin Jacob
2016-12-03 20:55   ` [dpdk-dev] [PATCH v2 2/2] eal: rename dev init API for consistency Jerin Jacob
2016-12-05 10:12     ` Shreyansh Jain [this message]
2016-12-05 10:24       ` Jerin Jacob
2016-12-05 14:03         ` Shreyansh Jain
2016-12-18 14:21   ` [dpdk-dev] [PATCH v3 0/6] libeventdev API and northbound implementation Jerin Jacob
2016-12-18 14:21     ` [dpdk-dev] [PATCH v3 1/6] eventdev: introduce event driven programming model Jerin Jacob
2016-12-18 14:21     ` [dpdk-dev] [PATCH v3 2/6] eventdev: define southbound driver interface Jerin Jacob
2016-12-19 15:50       ` Bruce Richardson
2016-12-18 14:21     ` [dpdk-dev] [PATCH v3 3/6] eventdev: implement the northbound APIs Jerin Jacob
2016-12-18 14:21     ` [dpdk-dev] [PATCH v3 4/6] eventdev: implement PMD registration functions Jerin Jacob
2016-12-18 14:21     ` [dpdk-dev] [PATCH v3 5/6] event/skeleton: add skeleton eventdev driver Jerin Jacob
2016-12-19 11:58       ` Bruce Richardson
2016-12-18 14:21     ` [dpdk-dev] [PATCH v3 6/6] app/test: unit test case for eventdev APIs Jerin Jacob
2016-12-19  5:16     ` [dpdk-dev] [PATCH v3 0/6] libeventdev API and northbound implementation Shreyansh Jain
2016-12-20 11:13     ` Bruce Richardson
2016-12-20 13:09       ` Jerin Jacob
2016-12-20 13:22         ` Bruce Richardson
2017-01-11 15:52           ` Jerin Jacob
2016-12-21 14:39   ` [dpdk-dev] [PATCH v2 0/2] postpone vdev initialization Thomas Monjalon
2016-12-21 14:42 ` [dpdk-dev] [PATCH] eal: " Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d6387545-5cd4-ce73-c1d2-a52c413e5820@nxp.com \
    --to=shreyansh.jain@nxp.com \
    --cc=david.marchand@6wind.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=thomas.monjalon@6wind.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).