[v2] vhost: fix notification for packed ring

Message ID 20181011142234.17823-1-tiwei.bie@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series [v2] vhost: fix notification for packed ring |

Checks

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

Commit Message

Tiwei Bie Oct. 11, 2018, 2:22 p.m. UTC
  The notification can't be disabled in packed ring when
application tries to disable notification, because the
device event flags field is overwritten by an unexpected
value. This patch fixes this issue.

Fixes: b1cce26af1dc ("vhost: add notification for packed ring")
Cc: stable@dpdk.org

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
---
v2: return directly after disabling the interrupt (Jason/MST)

 lib/librte_vhost/vhost.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Maxime Coquelin Oct. 11, 2018, 3:21 p.m. UTC | #1
On 10/11/2018 04:22 PM, Tiwei Bie wrote:
> The notification can't be disabled in packed ring when
> application tries to disable notification, because the
> device event flags field is overwritten by an unexpected
> value. This patch fixes this issue.
> 
> Fixes: b1cce26af1dc ("vhost: add notification for packed ring")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

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

> ---
> v2: return directly after disabling the interrupt (Jason/MST)
> 
>   lib/librte_vhost/vhost.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
> index e62f4c594..047ee535c 100644
> --- a/lib/librte_vhost/vhost.c
> +++ b/lib/librte_vhost/vhost.c
> @@ -667,8 +667,10 @@ vhost_enable_notify_packed(struct virtio_net *dev,
>   {
>   	uint16_t flags;
>   
> -	if (!enable)
> +	if (!enable) {
>   		vq->device_event->flags = VRING_EVENT_F_DISABLE;
> +		return;
> +	}
>   
>   	flags = VRING_EVENT_F_ENABLE;
>   	if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) {
>
  
Jason Wang Oct. 11, 2018, 11:47 p.m. UTC | #2
On 2018年10月11日 22:22, Tiwei Bie wrote:
> The notification can't be disabled in packed ring when
> application tries to disable notification, because the
> device event flags field is overwritten by an unexpected
> value. This patch fixes this issue.
>
> Fixes: b1cce26af1dc ("vhost: add notification for packed ring")
> Cc: stable@dpdk.org
>
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> v2: return directly after disabling the interrupt (Jason/MST)
>
>   lib/librte_vhost/vhost.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
> index e62f4c594..047ee535c 100644
> --- a/lib/librte_vhost/vhost.c
> +++ b/lib/librte_vhost/vhost.c
> @@ -667,8 +667,10 @@ vhost_enable_notify_packed(struct virtio_net *dev,
>   {
>   	uint16_t flags;
>   
> -	if (!enable)
> +	if (!enable) {
>   		vq->device_event->flags = VRING_EVENT_F_DISABLE;
> +		return;
> +	}
>   
>   	flags = VRING_EVENT_F_ENABLE;
>   	if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) {

Acked-by: Jason Wang <jasowang@redhat.com>
  
Maxime Coquelin Oct. 16, 2018, 8:36 a.m. UTC | #3
On 10/11/2018 04:22 PM, Tiwei Bie wrote:
> The notification can't be disabled in packed ring when
> application tries to disable notification, because the
> device event flags field is overwritten by an unexpected
> value. This patch fixes this issue.
> 
> Fixes: b1cce26af1dc ("vhost: add notification for packed ring")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> v2: return directly after disabling the interrupt (Jason/MST)
> 
>   lib/librte_vhost/vhost.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)

Applied to dpdk-next-virtio/master.

Thanks,
Maxime
  

Patch

diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
index e62f4c594..047ee535c 100644
--- a/lib/librte_vhost/vhost.c
+++ b/lib/librte_vhost/vhost.c
@@ -667,8 +667,10 @@  vhost_enable_notify_packed(struct virtio_net *dev,
 {
 	uint16_t flags;
 
-	if (!enable)
+	if (!enable) {
 		vq->device_event->flags = VRING_EVENT_F_DISABLE;
+		return;
+	}
 
 	flags = VRING_EVENT_F_ENABLE;
 	if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) {