586cba
From cefd6583a8483c7a80f9cde8f7ad4705983af9e7 Mon Sep 17 00:00:00 2001
586cba
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
586cba
Date: Thu, 21 Jul 2022 15:38:55 +0200
586cba
Subject: [PATCH 18/32] vhost: Expose vhost_svq_add
586cba
MIME-Version: 1.0
586cba
Content-Type: text/plain; charset=UTF-8
586cba
Content-Transfer-Encoding: 8bit
586cba
586cba
RH-Author: Eugenio Pérez <eperezma@redhat.com>
586cba
RH-MergeRequest: 108: Net Control Virtqueue shadow Support
586cba
RH-Commit: [18/27] bfb44f597d350336113783bcc9b3c9d9d32ff8c0 (eperezmartin/qemu-kvm)
586cba
RH-Bugzilla: 1939363
586cba
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
586cba
RH-Acked-by: Cindy Lu <lulu@redhat.com>
586cba
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
586cba
586cba
Bugzilla: https://bugzilla.redhat.com/1939363
586cba
586cba
Upstream Status: git://git.qemu.org/qemu.git
586cba
586cba
commit d0291f3f284d3bc220cdb13b0d8ac8a44eb5fd4c
586cba
Author: Eugenio Pérez <eperezma@redhat.com>
586cba
Date:   Wed Jul 20 08:59:37 2022 +0200
586cba
586cba
    vhost: Expose vhost_svq_add
586cba
586cba
    This allows external parts of SVQ to forward custom buffers to the
586cba
    device.
586cba
586cba
    Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
586cba
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
586cba
    Signed-off-by: Jason Wang <jasowang@redhat.com>
586cba
586cba
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
586cba
---
586cba
 hw/virtio/vhost-shadow-virtqueue.c | 6 +++---
586cba
 hw/virtio/vhost-shadow-virtqueue.h | 3 +++
586cba
 2 files changed, 6 insertions(+), 3 deletions(-)
586cba
586cba
diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vhost-shadow-virtqueue.c
586cba
index 1ce52d5b4a..cb879e7b88 100644
586cba
--- a/hw/virtio/vhost-shadow-virtqueue.c
586cba
+++ b/hw/virtio/vhost-shadow-virtqueue.c
586cba
@@ -238,9 +238,9 @@ static void vhost_svq_kick(VhostShadowVirtqueue *svq)
586cba
  *
586cba
  * Return -EINVAL if element is invalid, -ENOSPC if dev queue is full
586cba
  */
586cba
-static int vhost_svq_add(VhostShadowVirtqueue *svq, const struct iovec *out_sg,
586cba
-                          size_t out_num, const struct iovec *in_sg,
586cba
-                          size_t in_num, VirtQueueElement *elem)
586cba
+int vhost_svq_add(VhostShadowVirtqueue *svq, const struct iovec *out_sg,
586cba
+                  size_t out_num, const struct iovec *in_sg, size_t in_num,
586cba
+                  VirtQueueElement *elem)
586cba
 {
586cba
     unsigned qemu_head;
586cba
     unsigned ndescs = in_num + out_num;
586cba
diff --git a/hw/virtio/vhost-shadow-virtqueue.h b/hw/virtio/vhost-shadow-virtqueue.h
586cba
index d9fc1f1799..dd78f4bec2 100644
586cba
--- a/hw/virtio/vhost-shadow-virtqueue.h
586cba
+++ b/hw/virtio/vhost-shadow-virtqueue.h
586cba
@@ -86,6 +86,9 @@ bool vhost_svq_valid_features(uint64_t features, Error **errp);
586cba
 
586cba
 void vhost_svq_push_elem(VhostShadowVirtqueue *svq,
586cba
                          const VirtQueueElement *elem, uint32_t len);
586cba
+int vhost_svq_add(VhostShadowVirtqueue *svq, const struct iovec *out_sg,
586cba
+                  size_t out_num, const struct iovec *in_sg, size_t in_num,
586cba
+                  VirtQueueElement *elem);
586cba
 
586cba
 void vhost_svq_set_svq_kick_fd(VhostShadowVirtqueue *svq, int svq_kick_fd);
586cba
 void vhost_svq_set_svq_call_fd(VhostShadowVirtqueue *svq, int call_fd);
586cba
-- 
586cba
2.31.1
586cba