[v3] vhost: add device reset status

Message ID 20200810131802.63619-1-chenbo.xia@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series [v3] vhost: add device reset status |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS

Commit Message

Chenbo Xia Aug. 10, 2020, 1:18 p.m. UTC
  vhost lib now does not have definition of reset status. This patch
adds the reset status definition and changes related log.

Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
---
 lib/librte_vhost/vhost.h      | 1 +
 lib/librte_vhost/vhost_user.c | 2 ++
 2 files changed, 3 insertions(+)
  

Comments

Maxime Coquelin Sept. 18, 2020, 9:38 a.m. UTC | #1
On 8/10/20 3:18 PM, Chenbo Xia wrote:
> vhost lib now does not have definition of reset status. This patch
> adds the reset status definition and changes related log.
> 
> Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
> ---
>  lib/librte_vhost/vhost.h      | 1 +
>  lib/librte_vhost/vhost_user.c | 2 ++
>  2 files changed, 3 insertions(+)
> 
> diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
> index 632f66d53..73a1ed889 100644
> --- a/lib/librte_vhost/vhost.h
> +++ b/lib/librte_vhost/vhost.h
> @@ -239,6 +239,7 @@ struct vhost_virtqueue {
>  } __rte_cache_aligned;
>  
>  /* Virtio device status as per Virtio specification */
> +#define VIRTIO_DEVICE_STATUS_RESET		0x00
>  #define VIRTIO_DEVICE_STATUS_ACK		0x01
>  #define VIRTIO_DEVICE_STATUS_DRIVER		0x02
>  #define VIRTIO_DEVICE_STATUS_DRIVER_OK		0x04
> diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
> index c3c924fae..501218e19 100644
> --- a/lib/librte_vhost/vhost_user.c
> +++ b/lib/librte_vhost/vhost_user.c
> @@ -2531,6 +2531,7 @@ vhost_user_set_status(struct virtio_net **pdev, struct VhostUserMsg *msg,
>  	}
>  
>  	VHOST_LOG_CONFIG(INFO, "New device status(0x%08x):\n"
> +			"\t-RESET: %u\n"
>  			"\t-ACKNOWLEDGE: %u\n"
>  			"\t-DRIVER: %u\n"
>  			"\t-FEATURES_OK: %u\n"
> @@ -2538,6 +2539,7 @@ vhost_user_set_status(struct virtio_net **pdev, struct VhostUserMsg *msg,
>  			"\t-DEVICE_NEED_RESET: %u\n"
>  			"\t-FAILED: %u\n",
>  			dev->status,
> +			(dev->status == VIRTIO_DEVICE_STATUS_RESET),
>  			!!(dev->status & VIRTIO_DEVICE_STATUS_ACK),
>  			!!(dev->status & VIRTIO_DEVICE_STATUS_DRIVER),
>  			!!(dev->status & VIRTIO_DEVICE_STATUS_FEATURES_OK),
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  
Maxime Coquelin Sept. 18, 2020, 12:28 p.m. UTC | #2
On 8/10/20 3:18 PM, Chenbo Xia wrote:
> vhost lib now does not have definition of reset status. This patch
> adds the reset status definition and changes related log.
> 
> Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
> ---
>  lib/librte_vhost/vhost.h      | 1 +
>  lib/librte_vhost/vhost_user.c | 2 ++
>  2 files changed, 3 insertions(+)

Applied to dpdk-next-virtio/master.

Thanks,
Maxime
  

Patch

diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
index 632f66d53..73a1ed889 100644
--- a/lib/librte_vhost/vhost.h
+++ b/lib/librte_vhost/vhost.h
@@ -239,6 +239,7 @@  struct vhost_virtqueue {
 } __rte_cache_aligned;
 
 /* Virtio device status as per Virtio specification */
+#define VIRTIO_DEVICE_STATUS_RESET		0x00
 #define VIRTIO_DEVICE_STATUS_ACK		0x01
 #define VIRTIO_DEVICE_STATUS_DRIVER		0x02
 #define VIRTIO_DEVICE_STATUS_DRIVER_OK		0x04
diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index c3c924fae..501218e19 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -2531,6 +2531,7 @@  vhost_user_set_status(struct virtio_net **pdev, struct VhostUserMsg *msg,
 	}
 
 	VHOST_LOG_CONFIG(INFO, "New device status(0x%08x):\n"
+			"\t-RESET: %u\n"
 			"\t-ACKNOWLEDGE: %u\n"
 			"\t-DRIVER: %u\n"
 			"\t-FEATURES_OK: %u\n"
@@ -2538,6 +2539,7 @@  vhost_user_set_status(struct virtio_net **pdev, struct VhostUserMsg *msg,
 			"\t-DEVICE_NEED_RESET: %u\n"
 			"\t-FAILED: %u\n",
 			dev->status,
+			(dev->status == VIRTIO_DEVICE_STATUS_RESET),
 			!!(dev->status & VIRTIO_DEVICE_STATUS_ACK),
 			!!(dev->status & VIRTIO_DEVICE_STATUS_DRIVER),
 			!!(dev->status & VIRTIO_DEVICE_STATUS_FEATURES_OK),