[PATCH] virtio_ring: remove unnecessary to_vvq call in vring hot path

From: Deming Wang
Date: Wed Jun 22 2022 - 04:51:18 EST


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.

Signed-off-by: Deming Wang <wangdeming@xxxxxxxxxx>
---
drivers/virtio/virtio_ring.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 13a7348cedff..4d41d5a90816 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -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);
--
2.27.0