[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v9 21/23] vdpa: Add vhost_vdpa_start_control_svq
From: |
Eugenio Pérez |
Subject: |
[RFC PATCH v9 21/23] vdpa: Add vhost_vdpa_start_control_svq |
Date: |
Wed, 6 Jul 2022 20:40:06 +0200 |
As a first step we only enable CVQ first than others. Future patches add
state restore.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
net/vhost-vdpa.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index e415cc8de5..77d013833f 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -370,6 +370,24 @@ static CVQElement
*vhost_vdpa_cvq_alloc_elem(VhostVDPAState *s,
return g_steal_pointer(&cvq_elem);
}
+static int vhost_vdpa_start_control_svq(VhostShadowVirtqueue *svq,
+ void *opaque)
+{
+ struct vhost_vring_state state = {
+ .index = virtio_get_queue_index(svq->vq),
+ .num = 1,
+ };
+ VhostVDPAState *s = opaque;
+ struct vhost_dev *dev = s->vhost_vdpa.dev;
+ struct vhost_vdpa *v = dev->opaque;
+ int r;
+
+ assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_VDPA);
+
+ r = ioctl(v->device_fd, VHOST_VDPA_SET_VRING_ENABLE, &state);
+ return r < 0 ? -errno : r;
+}
+
/**
* iov_size with an upper limit. It's assumed UINT64_MAX is an invalid
* iov_size.
@@ -554,6 +572,7 @@ static const VhostShadowVirtqueueOps vhost_vdpa_net_svq_ops
= {
.avail_handler = vhost_vdpa_net_handle_ctrl_avail,
.used_handler = vhost_vdpa_net_handle_ctrl_used,
.detach_handler = vhost_vdpa_net_handle_ctrl_detach,
+ .start = vhost_vdpa_start_control_svq,
};
static NetClientState *net_vhost_vdpa_init(NetClientState *peer,
--
2.31.1
- [RFC PATCH v9 10/23] vhost: Reorder vhost_svq_last_desc_of_chain, (continued)
- [RFC PATCH v9 10/23] vhost: Reorder vhost_svq_last_desc_of_chain, Eugenio Pérez, 2022/07/06
- [RFC PATCH v9 14/23] vhost: add vhost_svq_poll, Eugenio Pérez, 2022/07/06
- [RFC PATCH v9 15/23] vhost: Add custom used buffer callback, Eugenio Pérez, 2022/07/06
- [RFC PATCH v9 17/23] vhost: add detach SVQ operation, Eugenio Pérez, 2022/07/06
- [RFC PATCH v9 18/23] vdpa: Export vhost_vdpa_dma_map and unmap calls, Eugenio Pérez, 2022/07/06
- [RFC PATCH v9 19/23] vdpa: Extract get features part from vhost_vdpa_get_max_queue_pairs, Eugenio Pérez, 2022/07/06
- [RFC PATCH v9 21/23] vdpa: Add vhost_vdpa_start_control_svq,
Eugenio Pérez <=
- [RFC PATCH v9 22/23] vdpa: Inject virtio-net mac address via CVQ at start, Eugenio Pérez, 2022/07/06
- [RFC PATCH v9 20/23] vdpa: Buffer CVQ support on shadow virtqueue, Eugenio Pérez, 2022/07/06