[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH for 8.0 12/13] vhost: expose vhost_svq_add_element
From: |
Eugenio Pérez |
Subject: |
[RFC PATCH for 8.0 12/13] vhost: expose vhost_svq_add_element |
Date: |
Mon, 5 Dec 2022 18:04:35 +0100 |
Needed to inject new inflight elements
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
hw/virtio/vhost-shadow-virtqueue.h | 1 +
hw/virtio/vhost-shadow-virtqueue.c | 12 +++++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/hw/virtio/vhost-shadow-virtqueue.h
b/hw/virtio/vhost-shadow-virtqueue.h
index e82da4b55c..69910597dd 100644
--- a/hw/virtio/vhost-shadow-virtqueue.h
+++ b/hw/virtio/vhost-shadow-virtqueue.h
@@ -122,6 +122,7 @@ void vhost_svq_push_elem(VhostShadowVirtqueue *svq,
int vhost_svq_add(VhostShadowVirtqueue *svq, const struct iovec *out_sg,
size_t out_num, const struct iovec *in_sg, size_t in_num,
VirtQueueElement *elem);
+int vhost_svq_add_element(VhostShadowVirtqueue *svq, VirtQueueElement *elem);
size_t vhost_svq_poll(VhostShadowVirtqueue *svq);
void vhost_svq_set_svq_kick_fd(VhostShadowVirtqueue *svq, int svq_kick_fd);
diff --git a/hw/virtio/vhost-shadow-virtqueue.c
b/hw/virtio/vhost-shadow-virtqueue.c
index 029ccee957..0668114897 100644
--- a/hw/virtio/vhost-shadow-virtqueue.c
+++ b/hw/virtio/vhost-shadow-virtqueue.c
@@ -271,9 +271,15 @@ int vhost_svq_add(VhostShadowVirtqueue *svq, const struct
iovec *out_sg,
return 0;
}
-/* Convenience wrapper to add a guest's element to SVQ */
-static int vhost_svq_add_element(VhostShadowVirtqueue *svq,
- VirtQueueElement *elem)
+/*
+ * Add a guest's element to SVQ. SVQ return the element When the device mark
+ * the descriptor as used, so make sure the guest will understand it.
+ *
+ * This function can be used to add the elements after a migration event or in
+ * the case the device is reset. To add elements that must not be seen by the
+ * guest use vhost_svq_add.
+ */
+int vhost_svq_add_element(VhostShadowVirtqueue *svq, VirtQueueElement *elem)
{
return vhost_svq_add(svq, elem->out_sg, elem->out_num, elem->in_sg,
elem->in_num, elem);
--
2.31.1
- [RFC PATCH for 8.0 03/13] vhost: merge avail list and next avail descriptors detach, (continued)
- [RFC PATCH for 8.0 03/13] vhost: merge avail list and next avail descriptors detach, Eugenio Pérez, 2022/12/05
- [RFC PATCH for 8.0 04/13] vhost: add vhost_svq_save_inflight, Eugenio Pérez, 2022/12/05
- [RFC PATCH for 8.0 07/13] virtio: refactor qemu_put_virtqueue_element, Eugenio Pérez, 2022/12/05
- [RFC PATCH for 8.0 05/13] virtio: Specify uint32_t as VirtQueueElementOld members type, Eugenio Pérez, 2022/12/05
- [RFC PATCH for 8.0 06/13] virtio: refactor qemu_get_virtqueue_element, Eugenio Pérez, 2022/12/05
- [RFC PATCH for 8.0 10/13] virtio-net: Migrate vhost inflight descriptors, Eugenio Pérez, 2022/12/05
- [RFC PATCH for 8.0 12/13] vhost: expose vhost_svq_add_element,
Eugenio Pérez <=
- [RFC PATCH for 8.0 11/13] virtio-net: save inflight descriptors at vhost shutdown, Eugenio Pérez, 2022/12/05
- [RFC PATCH for 8.0 09/13] virtio: add vmstate_virtqueue_element_old, Eugenio Pérez, 2022/12/05
- [RFC PATCH for 8.0 08/13] virtio: expose VirtQueueElementOld, Eugenio Pérez, 2022/12/05
- [RFC PATCH for 8.0 13/13] vdpa: Recover inflight descriptors, Eugenio Pérez, 2022/12/05
- Re: [RFC PATCH for 8.0 00/13] vDPA-net inflight descriptors migration with SVQ, Jason Wang, 2022/12/06