The series reuses it to check for SUSPEND feature bit.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
net/vhost-vdpa.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 11241ebac4..85b10799bd 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -602,9 +602,17 @@ static const VhostShadowVirtqueueOps vhost_vdpa_net_svq_ops = {
.avail_handler = vhost_vdpa_net_handle_ctrl_avail,
};
-static uint32_t vhost_vdpa_get_as_num(int vdpa_device_fd)
+static uint64_t vhost_vdpa_get_backend_features(int fd)
{
uint64_t features;
+
+ /* No need to treat the error, only to know there is one */
+ int ret = ioctl(fd, VHOST_GET_BACKEND_FEATURES, &features);
+ return ret < 0 ? 0 : features;
+}
+
+static uint32_t vhost_vdpa_get_as_num(int vdpa_device_fd, uint64_t features)
+{
unsigned num_as;
int r;
@@ -733,7 +741,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
NetClientState *peer, Error **errp)
{
const NetdevVhostVDPAOptions *opts;
- uint64_t features;
+ uint64_t features, backend_features;
int vdpa_device_fd;
g_autofree NetClientState **ncs = NULL;
g_autoptr(VhostIOVATree) iova_tree = NULL;
@@ -765,9 +773,10 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
goto err;
}
+ backend_features = vhost_vdpa_get_backend_features(vdpa_device_fd);
svq_cvq = opts->x_svq;
if (has_cvq && !opts->x_svq) {
- num_as = vhost_vdpa_get_as_num(vdpa_device_fd);
+ num_as = vhost_vdpa_get_as_num(vdpa_device_fd, backend_features);
svq_cvq = num_as > 1;
}
--
2.31.1