[02/10] net/virtio: fix interrupt helper for packed ring

Message ID 20190319064312.13743-3-tiwei.bie@intel.com
State Accepted, archived
Delegated to: Maxime Coquelin
Headers show
Series
  • net/virtio: cleanups and fixes for packed/split ring
Related show

Checks

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

Commit Message

Tiwei Bie March 19, 2019, 6:43 a.m.
When disabling interrupt, the shadow event flags should also be
updated accordingly. The unnecessary wmb is also dropped.

Fixes: e9f4feb7e622 ("net/virtio: add packed virtqueue helpers")
Cc: stable@dpdk.org

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 drivers/net/virtio/virtqueue.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Maxime Coquelin March 19, 2019, 12:48 p.m. | #1
On 3/19/19 7:43 AM, Tiwei Bie wrote:
> When disabling interrupt, the shadow event flags should also be
> updated accordingly. The unnecessary wmb is also dropped.
> 
> Fixes: e9f4feb7e622 ("net/virtio: add packed virtqueue helpers")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
>   drivers/net/virtio/virtqueue.h | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 

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

Thanks,
Maxime

Patch

diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h
index ca9d8e6e3..24fa873c3 100644
--- a/drivers/net/virtio/virtqueue.h
+++ b/drivers/net/virtio/virtqueue.h
@@ -321,12 +321,13 @@  vring_desc_init_split(struct vring_desc *dp, uint16_t n)
 static inline void
 virtqueue_disable_intr_packed(struct virtqueue *vq)
 {
-	uint16_t *event_flags = &vq->ring_packed.driver_event->desc_event_flags;
-
-	*event_flags = RING_EVENT_FLAGS_DISABLE;
+	if (vq->event_flags_shadow != RING_EVENT_FLAGS_DISABLE) {
+		vq->event_flags_shadow = RING_EVENT_FLAGS_DISABLE;
+		vq->ring_packed.driver_event->desc_event_flags =
+			vq->event_flags_shadow;
+	}
 }
 
-
 /**
  * Tell the backend not to interrupt us.
  */
@@ -348,7 +349,6 @@  virtqueue_enable_intr_packed(struct virtqueue *vq)
 	uint16_t *event_flags = &vq->ring_packed.driver_event->desc_event_flags;
 
 	if (vq->event_flags_shadow == RING_EVENT_FLAGS_DISABLE) {
-		virtio_wmb(vq->hw->weak_barriers);
 		vq->event_flags_shadow = RING_EVENT_FLAGS_ENABLE;
 		*event_flags = vq->event_flags_shadow;
 	}