[dpdk-dev] vhost: Add a hint on how to add or remove the device to a data core

Message ID 1425032565-497-1-git-send-email-benoit.canet@nodalink.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Benoît Canet Feb. 27, 2015, 10:22 a.m. UTC
  Let's make sure people will not forget to set and unset VIRTIO_DEV_RUNNING.

Signed-off-by: Benoît Canet <benoit.canet@nodalink.com>
---
 doc/guides/prog_guide/vhost_lib.rst | 3 ++-
 lib/librte_vhost/rte_virtio_net.h   | 4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)
  

Comments

Thomas Monjalon March 16, 2015, 11:40 p.m. UTC | #1
Huawei, any opinion about this patch?

2015-02-27 11:22, Benoît Canet:
> Let's make sure people will not forget to set and unset VIRTIO_DEV_RUNNING.
> 
> Signed-off-by: Benoît Canet <benoit.canet@nodalink.com>
> ---
>  doc/guides/prog_guide/vhost_lib.rst | 3 ++-
>  lib/librte_vhost/rte_virtio_net.h   | 4 ++++
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/guides/prog_guide/vhost_lib.rst b/doc/guides/prog_guide/vhost_lib.rst
> index 0b6eda7..ba6065d 100644
> --- a/doc/guides/prog_guide/vhost_lib.rst
> +++ b/doc/guides/prog_guide/vhost_lib.rst
> @@ -58,7 +58,8 @@ Vhost API Overview
>        register two callbacks, new_destory and destroy_device.
>        When virtio device is activated or deactivated by guest virtual machine,
>        the callback will be called, then vSwitch could put the device onto data
> -      core or remove the device from data core.
> +      core or remove the device from data core by setting or unsetting
> +      VIRTIO_DEV_RUNNING on the device flags.
>  
>  *   Read/write packets from/to guest virtual machine
>  
> diff --git a/lib/librte_vhost/rte_virtio_net.h b/lib/librte_vhost/rte_virtio_net.h
> index 611a3d4..b9d34c7 100644
> --- a/lib/librte_vhost/rte_virtio_net.h
> +++ b/lib/librte_vhost/rte_virtio_net.h
> @@ -130,6 +130,10 @@ struct virtio_memory {
>  
>  /**
>   * Device operations to add/remove device.
> + *
> + * Make sure to set VIRTIO_DEV_RUNNING to the device flags in new_device and
> + * remove it in destroy_device.
> + *
>   */
>  struct virtio_net_device_ops {
>  	int (*new_device)(struct virtio_net *);	/**< Add device. */
>
  
Huawei Xie March 17, 2015, 9:08 a.m. UTC | #2
Acked-by Huawei Xie <huawei.xie@intel.com>


On 2/27/2015 6:22 PM, Benoît Canet wrote:
> Let's make sure people will not forget to set and unset VIRTIO_DEV_RUNNING.
>
> Signed-off-by: Benoît Canet <benoit.canet@nodalink.com>
> ---
>  doc/guides/prog_guide/vhost_lib.rst | 3 ++-
>  lib/librte_vhost/rte_virtio_net.h   | 4 ++++
>  2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/doc/guides/prog_guide/vhost_lib.rst b/doc/guides/prog_guide/vhost_lib.rst
> index 0b6eda7..ba6065d 100644
> --- a/doc/guides/prog_guide/vhost_lib.rst
> +++ b/doc/guides/prog_guide/vhost_lib.rst
> @@ -58,7 +58,8 @@ Vhost API Overview
>        register two callbacks, new_destory and destroy_device.
>        When virtio device is activated or deactivated by guest virtual machine,
>        the callback will be called, then vSwitch could put the device onto data
> -      core or remove the device from data core.
> +      core or remove the device from data core by setting or unsetting
> +      VIRTIO_DEV_RUNNING on the device flags.
>  
>  *   Read/write packets from/to guest virtual machine
>  
> diff --git a/lib/librte_vhost/rte_virtio_net.h b/lib/librte_vhost/rte_virtio_net.h
> index 611a3d4..b9d34c7 100644
> --- a/lib/librte_vhost/rte_virtio_net.h
> +++ b/lib/librte_vhost/rte_virtio_net.h
> @@ -130,6 +130,10 @@ struct virtio_memory {
>  
>  /**
>   * Device operations to add/remove device.
> + *
> + * Make sure to set VIRTIO_DEV_RUNNING to the device flags in new_device and
> + * remove it in destroy_device.
> + *
>   */
>  struct virtio_net_device_ops {
>  	int (*new_device)(struct virtio_net *);	/**< Add device. */
  
Thomas Monjalon March 17, 2015, 11:37 a.m. UTC | #3
> > Let's make sure people will not forget to set and unset VIRTIO_DEV_RUNNING.
> >
> > Signed-off-by: Benoît Canet <benoit.canet@nodalink.com>
> 
> Acked-by Huawei Xie <huawei.xie@intel.com>

Applied, thanks
  

Patch

diff --git a/doc/guides/prog_guide/vhost_lib.rst b/doc/guides/prog_guide/vhost_lib.rst
index 0b6eda7..ba6065d 100644
--- a/doc/guides/prog_guide/vhost_lib.rst
+++ b/doc/guides/prog_guide/vhost_lib.rst
@@ -58,7 +58,8 @@  Vhost API Overview
       register two callbacks, new_destory and destroy_device.
       When virtio device is activated or deactivated by guest virtual machine,
       the callback will be called, then vSwitch could put the device onto data
-      core or remove the device from data core.
+      core or remove the device from data core by setting or unsetting
+      VIRTIO_DEV_RUNNING on the device flags.
 
 *   Read/write packets from/to guest virtual machine
 
diff --git a/lib/librte_vhost/rte_virtio_net.h b/lib/librte_vhost/rte_virtio_net.h
index 611a3d4..b9d34c7 100644
--- a/lib/librte_vhost/rte_virtio_net.h
+++ b/lib/librte_vhost/rte_virtio_net.h
@@ -130,6 +130,10 @@  struct virtio_memory {
 
 /**
  * Device operations to add/remove device.
+ *
+ * Make sure to set VIRTIO_DEV_RUNNING to the device flags in new_device and
+ * remove it in destroy_device.
+ *
  */
 struct virtio_net_device_ops {
 	int (*new_device)(struct virtio_net *);	/**< Add device. */