diff options
| author | Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> | 2026-04-20 23:03:16 +0300 |
|---|---|---|
| committer | Michael S. Tsirkin <mst@redhat.com> | 2026-06-03 08:36:11 -0400 |
| commit | 44c8f42d5824ab652ddeedb79851fa72d2af7be1 (patch) | |
| tree | 6f789882e5dcce517cd2bdbeed70d413a0596eda /backends | |
| parent | c549dca2f27e163b7bf7284e34d5b945a8ed47a6 (diff) | |
| download | qemu-44c8f42d5824ab652ddeedb79851fa72d2af7be1.tar.gz qemu-44c8f42d5824ab652ddeedb79851fa72d2af7be1.zip | |
vhost-user: rework enabling vrings
We call the handler almost the same way in three places:
- cryptodev-vhost.c
- vhost_net.c
- vhost.c
The only difference, is that in vhost.c we don't try to call the handler
for old vhost-user (when VHOST_USER_F_PROTOCOL_FEATURES is not supported).
cryptodev-vhost and vhost_net code will just fail in this case. Probably
they were developed only for newer vhost-user. Anyway, it doesn't seem
correct to rely on this error path, if these devices want to check,
that they don't communicate to old vhost-user protocol, they should
do that earlier.
Let's create the common helper, to call .vhost_set_vring_enable and
use in all three places. For vhost-user let's just always skip
enable/disable if it's unsupported.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
Reviewed-by: Raphael Norwitz <raphael.s.norwitz@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20260420200339.708640-2-vsementsov@yandex-team.ru>
Diffstat (limited to 'backends')
| -rw-r--r-- | backends/cryptodev-vhost.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/backends/cryptodev-vhost.c b/backends/cryptodev-vhost.c index 943680a23a..abdfce33af 100644 --- a/backends/cryptodev-vhost.c +++ b/backends/cryptodev-vhost.c @@ -152,7 +152,6 @@ vhost_set_vring_enable(CryptoDevBackendClient *cc, { CryptoDevBackendVhost *crypto = cryptodev_get_vhost(cc, b, queue); - const VhostOps *vhost_ops; cc->vring_enable = enable; @@ -160,12 +159,7 @@ vhost_set_vring_enable(CryptoDevBackendClient *cc, return 0; } - vhost_ops = crypto->dev.vhost_ops; - if (vhost_ops->vhost_set_vring_enable) { - return vhost_ops->vhost_set_vring_enable(&crypto->dev, enable); - } - - return 0; + return vhost_dev_set_vring_enable(&crypto->dev, enable); } int cryptodev_vhost_start(VirtIODevice *dev, int total_queues) |
