Skip to contentSkip to conversation

virtio_ring: remove unnecessary to_vvq call in vring hot path

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 vring hot path

It passes '_vq' to virtqueue_enable_cb_delayed_packed(), which still calls to_vvq to get 'vq', let's directly pass to_vvq to gunnecessary call of to_vvq in hot path.

---
 drivers/virtio/virtio_ring.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/virtio/virtio_ring.c +2 -3
index 13a7348cedff..4d41d5a90816 100644
@@ -1534,9 +1534,8 @@ static bool virtqueue_poll_packed(struct virtqueue *_vq, u16 off_wrap)
 	return is_used_desc_packed(vq, used_idx, wrap_counter);
 }
 
-static bool virtqueue_enable_cb_delayed_packed(struct virtqueue *_vq)
+static bool virtqueue_enable_cb_delayed_packed(struct vring_virtqueue *vq)
 {
-	struct vring_virtqueue *vq = to_vvq(_vq);
 	u16 used_idx, wrap_counter;
 	u16 bufs;
 
@@ -2098,7 +2097,7 @@ bool virtqueue_enable_cb_delayed(struct virtqueue *_vq)
 	if (vq->event_triggered)
 		vq->event_triggered = false;
 
-	return vq->packed_ring ? virtqueue_enable_cb_delayed_packed(_vq) :
+	return vq->packed_ring ? virtqueue_enable_cb_delayed_packed(vq) :
 				 virtqueue_enable_cb_delayed_split(_vq);
 }
 EXPORT_SYMBOL_GPL(virtqueue_enable_cb_delayed);
Signature · 1 line
2.27.0