[08/10] net/virtio: add interrupt helper for split ring

Message ID 20190319064312.13743-9-tiwei.bie@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series net/virtio: cleanups and fixes for packed/split ring |

Checks

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

Commit Message

Tiwei Bie March 19, 2019, 6:43 a.m. UTC
  Add a helper for disabling interrupts in split ring to make the
code consistent with the corresponding code in packed ring.

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

Comments

Jens Freimann March 19, 2019, 9:53 a.m. UTC | #1
On Tue, Mar 19, 2019 at 02:43:10PM +0800, Tiwei Bie wrote:
>Add a helper for disabling interrupts in split ring to make the
>code consistent with the corresponding code in packed ring.
>
>Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
>---
> drivers/net/virtio/virtqueue.h | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>

Reviewed-by: Jens Freimann <jfreimann@redhat.com>
  
Maxime Coquelin March 19, 2019, 1:34 p.m. UTC | #2
On 3/19/19 7:43 AM, Tiwei Bie wrote:
> Add a helper for disabling interrupts in split ring to make the
> code consistent with the corresponding code in packed ring.
> 
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
>   drivers/net/virtio/virtqueue.h | 13 +++++++++++--
>   1 file changed, 11 insertions(+), 2 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 6dab7db8e..5cea7cb4a 100644
--- a/drivers/net/virtio/virtqueue.h
+++ b/drivers/net/virtio/virtqueue.h
@@ -317,7 +317,7 @@  vring_desc_init_split(struct vring_desc *dp, uint16_t n)
 }
 
 /**
- * Tell the backend not to interrupt us.
+ * Tell the backend not to interrupt us. Implementation for packed virtqueues.
  */
 static inline void
 virtqueue_disable_intr_packed(struct virtqueue *vq)
@@ -329,6 +329,15 @@  virtqueue_disable_intr_packed(struct virtqueue *vq)
 	}
 }
 
+/**
+ * Tell the backend not to interrupt us. Implementation for split virtqueues.
+ */
+static inline void
+virtqueue_disable_intr_split(struct virtqueue *vq)
+{
+	vq->vq_split.ring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
+}
+
 /**
  * Tell the backend not to interrupt us.
  */
@@ -338,7 +347,7 @@  virtqueue_disable_intr(struct virtqueue *vq)
 	if (vtpci_packed_queue(vq->hw))
 		virtqueue_disable_intr_packed(vq);
 	else
-		vq->vq_split.ring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
+		virtqueue_disable_intr_split(vq);
 }
 
 /**