Skip to contentSkip to conversation

virtio_ring: remove unnecessary to_vvq call in poll_packed

PATCH New Deming Wang 1 participant 1 message Jun 22, 2022 virtio core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio_ring: remove unnecessary to_vvq call in poll_packed

It passes '_vq' to virtqueue_use_indirect(), which still calls to_vvq to get 'vq', let's directly pass 'vq'. It can avoid unnecessary call of to_vvq in virtqueue_poll_packed.

---
 drivers/virtio/virtio_ring.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/virtio/virtio_ring.c +2 -3
index 13a7348cedff..cb6323e0088b 100644
@@ -1522,9 +1522,8 @@ static unsigned int virtqueue_enable_cb_prepare_packed(struct virtqueue *_vq)
 			VRING_PACKED_EVENT_F_WRAP_CTR);
 }
 
-static bool virtqueue_poll_packed(struct virtqueue *_vq, u16 off_wrap)
+static bool virtqueue_poll_packed(struct vring_virtqueue *vq, u16 off_wrap)
 {
-	struct vring_virtqueue *vq = to_vvq(_vq);
 	bool wrap_counter;
 	u16 used_idx;
 
@@ -2054,7 +2053,7 @@ bool virtqueue_poll(struct virtqueue *_vq, unsigned int last_used_idx)
 		return false;
 
 	virtio_mb(vq->weak_barriers);
-	return vq->packed_ring ? virtqueue_poll_packed(_vq, last_used_idx) :
+	return vq->packed_ring ? virtqueue_poll_packed(vq, last_used_idx) :
 				 virtqueue_poll_split(_vq, last_used_idx);
 }
 EXPORT_SYMBOL_GPL(virtqueue_poll);
Signature · 1 line
2.27.0