[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 16/41] vdpa: add vhost_vdpa_net_valid_svq_features
From: |
Michael S. Tsirkin |
Subject: |
[PULL 16/41] vdpa: add vhost_vdpa_net_valid_svq_features |
Date: |
Wed, 21 Dec 2022 08:05:17 -0500 |
From: Eugenio Pérez <eperezma@redhat.com>
It will be reused at vdpa device start so let's extract in its own
function.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20221215113144.322011-6-eperezma@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
net/vhost-vdpa.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 260e474863..2c0ff6d7b0 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -107,6 +107,22 @@ VHostNetState *vhost_vdpa_get_vhost_net(NetClientState *nc)
return s->vhost_net;
}
+static bool vhost_vdpa_net_valid_svq_features(uint64_t features, Error **errp)
+{
+ uint64_t invalid_dev_features =
+ features & ~vdpa_svq_device_features &
+ /* Transport are all accepted at this point */
+ ~MAKE_64BIT_MASK(VIRTIO_TRANSPORT_F_START,
+ VIRTIO_TRANSPORT_F_END - VIRTIO_TRANSPORT_F_START);
+
+ if (invalid_dev_features) {
+ error_setg(errp, "vdpa svq does not work with features 0x%" PRIx64,
+ invalid_dev_features);
+ }
+
+ return !invalid_dev_features;
+}
+
static int vhost_vdpa_net_check_device_id(struct vhost_net *net)
{
uint32_t device_id;
@@ -676,15 +692,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char
*name,
if (opts->x_svq) {
struct vhost_vdpa_iova_range iova_range;
- uint64_t invalid_dev_features =
- features & ~vdpa_svq_device_features &
- /* Transport are all accepted at this point */
- ~MAKE_64BIT_MASK(VIRTIO_TRANSPORT_F_START,
- VIRTIO_TRANSPORT_F_END -
VIRTIO_TRANSPORT_F_START);
-
- if (invalid_dev_features) {
- error_setg(errp, "vdpa svq does not work with features 0x%" PRIx64,
- invalid_dev_features);
+ if (!vhost_vdpa_net_valid_svq_features(features, errp)) {
goto err_svq;
}
--
MST
- [PULL 06/41] hw/isa: enable TCO watchdog reboot pin strap by default, (continued)
- [PULL 06/41] hw/isa: enable TCO watchdog reboot pin strap by default, Michael S. Tsirkin, 2022/12/21
- [PULL 07/41] ich9: honour 'enable_tco' property, Michael S. Tsirkin, 2022/12/21
- [PULL 08/41] virtio: get class_id and pci device id by the virtio id, Michael S. Tsirkin, 2022/12/21
- [PULL 09/41] vdpa: add vdpa-dev support, Michael S. Tsirkin, 2022/12/21
- [PULL 12/41] vdpa: use v->shadow_vqs_enabled in vhost_vdpa_svqs_start & stop, Michael S. Tsirkin, 2022/12/21
- [PULL 11/41] vdpa-dev: mark the device as unmigratable, Michael S. Tsirkin, 2022/12/21
- [PULL 13/41] vhost: set SVQ device call handler at SVQ start, Michael S. Tsirkin, 2022/12/21
- [PULL 14/41] vhost: allocate SVQ device file descriptors at device start, Michael S. Tsirkin, 2022/12/21
- [PULL 10/41] vdpa: add vdpa-dev-pci support, Michael S. Tsirkin, 2022/12/21
- [PULL 15/41] vhost: move iova_tree set to vhost_svq_start, Michael S. Tsirkin, 2022/12/21
- [PULL 16/41] vdpa: add vhost_vdpa_net_valid_svq_features,
Michael S. Tsirkin <=
- [PULL 17/41] vdpa: request iova_range only once, Michael S. Tsirkin, 2022/12/21
- [PULL 18/41] vdpa: move SVQ vring features check to net/, Michael S. Tsirkin, 2022/12/21
- [PULL 20/41] vdpa: add asid parameter to vhost_vdpa_dma_map/unmap, Michael S. Tsirkin, 2022/12/21
- [PULL 24/41] vhost-user: send set log base message only once, Michael S. Tsirkin, 2022/12/21
- [PULL 26/41] acpi/tests/avocado/bits: add SPDX license identifiers for bios bits tests, Michael S. Tsirkin, 2022/12/21
- [PULL 21/41] vdpa: store x-svq parameter in VhostVDPAState, Michael S. Tsirkin, 2022/12/21
- [PULL 22/41] vdpa: add shadow_data to vhost_vdpa, Michael S. Tsirkin, 2022/12/21
- [PULL 25/41] include/hw: attempt to document VirtIO feature variables, Michael S. Tsirkin, 2022/12/21
- [PULL 23/41] vdpa: always start CVQ in SVQ mode if possible, Michael S. Tsirkin, 2022/12/21
- [PULL 19/41] vdpa: allocate SVQ array unconditionally, Michael S. Tsirkin, 2022/12/21