[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 07/12] vdpa: add vhost_vdpa_reset_queue
From: |
Eugenio Pérez |
Subject: |
[RFC PATCH 07/12] vdpa: add vhost_vdpa_reset_queue |
Date: |
Thu, 20 Jul 2023 20:14:54 +0200 |
Split out vq reset operation in its own function, as it may be called
with ring reset.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
hw/virtio/vhost-vdpa.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index 6ae276ccde..df2515a247 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -547,6 +547,21 @@ int vhost_vdpa_set_vring_ready(struct vhost_vdpa *v,
unsigned idx)
return vhost_vdpa_set_vring_ready_internal(v, idx, true);
}
+/* TODO: Properly reorder static functions */
+static void vhost_vdpa_svq_stop(struct vhost_dev *dev, unsigned idx);
+static void vhost_vdpa_reset_queue(struct vhost_dev *dev, int idx)
+{
+ struct vhost_vdpa *v = dev->opaque;
+
+ if (dev->features & VIRTIO_F_RING_RESET) {
+ vhost_vdpa_set_vring_ready_internal(v, idx, false);
+ }
+
+ if (v->shadow_vqs_enabled) {
+ vhost_vdpa_svq_stop(dev, idx - dev->vq_index);
+ }
+}
+
/*
* The use of this function is for requests that only need to be
* applied once. Typically such request occurs at the beginning
@@ -1543,4 +1558,5 @@ const VhostOps vdpa_ops = {
.vhost_force_iommu = vhost_vdpa_force_iommu,
.vhost_set_config_call = vhost_vdpa_set_config_call,
.vhost_reset_status = vhost_vdpa_reset_status,
+ .vhost_reset_queue = vhost_vdpa_reset_queue,
};
--
2.39.3
- [RFC PATCH 00/12] Prefer to use SVQ to stall dataplane at NIC state restore through CVQ, Eugenio Pérez, 2023/07/20
- [RFC PATCH 01/12] vhost: add vhost_reset_queue_op, Eugenio Pérez, 2023/07/20
- [RFC PATCH 03/12] vhost_net: Use ops->vhost_restart_queue in vhost_net_virtqueue_restart, Eugenio Pérez, 2023/07/20
- [RFC PATCH 05/12] vdpa: add vhost_vdpa_set_vring_ready_internal, Eugenio Pérez, 2023/07/20
- [RFC PATCH 04/12] vhost_net: Use ops->vhost_reset_queue in vhost_net_virtqueue_reset, Eugenio Pérez, 2023/07/20
- [RFC PATCH 02/12] vhost: add vhost_restart_queue_op, Eugenio Pérez, 2023/07/20
- [RFC PATCH 08/12] vdpa: add vhost_vdpa_svq_start, Eugenio Pérez, 2023/07/20
- [RFC PATCH 07/12] vdpa: add vhost_vdpa_reset_queue,
Eugenio Pérez <=
- [RFC PATCH 06/12] vdpa: add vhost_vdpa_svq_stop, Eugenio Pérez, 2023/07/20
- [RFC PATCH 09/12] vdpa: add vhost_vdpa_restart_queue, Eugenio Pérez, 2023/07/20
- [RFC PATCH 11/12] vdpa: use SVQ to stall dataplane while NIC state is being restored, Eugenio Pérez, 2023/07/20
- [RFC PATCH 10/12] vdpa: enable all vqs if the device support RING_RESET feature, Eugenio Pérez, 2023/07/20
- [RFC PATCH 12/12] vhost: Allow _F_RING_RESET with shadow virtqueue, Eugenio Pérez, 2023/07/20