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