[dpdk-dev,6/7] eal: add struct rte_vdev_device

Message ID 1487152929-23627-7-git-send-email-jblunck@infradead.org (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Jan Blunck Feb. 15, 2017, 10:02 a.m. UTC
  This adds the rte_vdev_device structure which embeds a generic rte_device.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
---
 lib/librte_eal/common/eal_common_vdev.c  | 5 +++++
 lib/librte_eal/common/include/rte_vdev.h | 5 +++++
 2 files changed, 10 insertions(+)
  

Comments

Ferruh Yigit Feb. 15, 2017, 5:11 p.m. UTC | #1
On 2/15/2017 10:02 AM, Jan Blunck wrote:
> This adds the rte_vdev_device structure which embeds a generic rte_device.
> 
> Signed-off-by: Jan Blunck <jblunck@infradead.org>

<...>

>  
> +struct rte_vdev_device {
> +	TAILQ_ENTRY(rte_vdev_device) next;      /**< Next attached vdev */
> +	struct rte_device device;               /**< Inherit core device */

What do you think adding a name field here ?

"dev->device.devargs->virt.drv_name" used a few times, since probing
virtual devices done based on name.

This is device name, and accessing it via "devargs->virt.drv_name" is
not that clear. It is possible to create a name field here, set it
during probe or init to point devargs field and use it wherever
required, does it make sense?

> +};
> +
>  /** Double linked list of virtual device drivers. */
>  TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);
>  
>
  
Jan Blunck Feb. 16, 2017, 3:55 p.m. UTC | #2
On Wed, Feb 15, 2017 at 6:11 PM, Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> On 2/15/2017 10:02 AM, Jan Blunck wrote:
>> This adds the rte_vdev_device structure which embeds a generic rte_device.
>>
>> Signed-off-by: Jan Blunck <jblunck@infradead.org>
>
> <...>
>
>>
>> +struct rte_vdev_device {
>> +     TAILQ_ENTRY(rte_vdev_device) next;      /**< Next attached vdev */
>> +     struct rte_device device;               /**< Inherit core device */
>
> What do you think adding a name field here ?
>
> "dev->device.devargs->virt.drv_name" used a few times, since probing
> virtual devices done based on name.
>
> This is device name, and accessing it via "devargs->virt.drv_name" is
> not that clear. It is possible to create a name field here, set it
> during probe or init to point devargs field and use it wherever
> required, does it make sense?
>

Why don't we add such a thing to the generic rte_device instead? While
we are at it we might want to also add a driver private data field.

Thoughts?
  

Patch

diff --git a/lib/librte_eal/common/eal_common_vdev.c b/lib/librte_eal/common/eal_common_vdev.c
index 6ba3c91..61677de 100644
--- a/lib/librte_eal/common/eal_common_vdev.c
+++ b/lib/librte_eal/common/eal_common_vdev.c
@@ -42,6 +42,11 @@ 
 #include <rte_common.h>
 #include <rte_devargs.h>
 
+/** Double linked list of virtual device drivers. */
+TAILQ_HEAD(vdev_device_list, rte_vdev_device);
+
+static struct vdev_device_list vdev_device_list =
+	TAILQ_HEAD_INITIALIZER(vdev_device_list);
 struct vdev_driver_list vdev_driver_list =
 	TAILQ_HEAD_INITIALIZER(vdev_driver_list);
 
diff --git a/lib/librte_eal/common/include/rte_vdev.h b/lib/librte_eal/common/include/rte_vdev.h
index 784e837..8f98372 100644
--- a/lib/librte_eal/common/include/rte_vdev.h
+++ b/lib/librte_eal/common/include/rte_vdev.h
@@ -40,6 +40,11 @@  extern "C" {
 #include <sys/queue.h>
 #include <rte_dev.h>
 
+struct rte_vdev_device {
+	TAILQ_ENTRY(rte_vdev_device) next;      /**< Next attached vdev */
+	struct rte_device device;               /**< Inherit core device */
+};
+
 /** Double linked list of virtual device drivers. */
 TAILQ_HEAD(vdev_driver_list, rte_vdev_driver);