[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/40] vdpa: add vhost_vdpa_get_vring_desc_group
From: |
Si-Wei Liu |
Subject: |
[PATCH 02/40] vdpa: add vhost_vdpa_get_vring_desc_group |
Date: |
Thu, 7 Dec 2023 09:39:15 -0800 |
Internal API to get the descriptor group index for a specific virtqueue
through the VHOST_VDPA_GET_VRING_DESC_GROUP ioctl.
Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
---
net/vhost-vdpa.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 90f4128..887c329 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -471,6 +471,25 @@ static int64_t vhost_vdpa_get_vring_group(int device_fd,
unsigned vq_index,
return state.num;
}
+static int64_t vhost_vdpa_get_vring_desc_group(int device_fd,
+ unsigned vq_index,
+ Error **errp)
+{
+ struct vhost_vring_state state = {
+ .index = vq_index,
+ };
+ int r = ioctl(device_fd, VHOST_VDPA_GET_VRING_DESC_GROUP, &state);
+
+ if (unlikely(r < 0)) {
+ r = -errno;
+ error_setg_errno(errp, errno, "Cannot get VQ %u descriptor group",
+ vq_index);
+ return r;
+ }
+
+ return state.num;
+}
+
static int vhost_vdpa_set_address_space_id(struct vhost_vdpa *v,
unsigned vq_group,
unsigned asid_num)
--
1.8.3.1
- [PATCH 00/40] vdpa-net: improve migration downtime through descriptor ASID and persistent IOTLB, Si-Wei Liu, 2023/12/07
- [PATCH 01/40] linux-headers: add vhost_types.h and vhost.h, Si-Wei Liu, 2023/12/07
- [PATCH 05/40] vdpa: populate desc_group from net_vhost_vdpa_init, Si-Wei Liu, 2023/12/07
- [PATCH 03/40] vdpa: probe descriptor group index for data vqs, Si-Wei Liu, 2023/12/07
- [PATCH 02/40] vdpa: add vhost_vdpa_get_vring_desc_group,
Si-Wei Liu <=
- [PATCH 06/40] vhost: make svq work with gpa without iova translation, Si-Wei Liu, 2023/12/07
- [PATCH 07/40] vdpa: move around vhost_vdpa_set_address_space_id, Si-Wei Liu, 2023/12/07
- [PATCH 04/40] vdpa: piggyback desc_group index when probing isolated cvq, Si-Wei Liu, 2023/12/07
- [PATCH 09/40] vdpa: no repeat setting shadow_data, Si-Wei Liu, 2023/12/07
- [PATCH 10/40] vdpa: assign svq descriptors a separate ASID when possible, Si-Wei Liu, 2023/12/07
- [PATCH 13/40] vdpa: ref counting VhostVDPAShared, Si-Wei Liu, 2023/12/07