diff options
author | Laurent Vivier <lvivier@redhat.com> | 2025-07-09 10:24:20 +0200 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2025-07-14 13:27:09 +0800 |
commit | bd38794a1119ec8e3f0a7473458ce4cdd229bc42 (patch) | |
tree | 6e264376152bf678bd825bbaf463154d5d237317 /hw | |
parent | effdacbf28d76ca0eec9086539649e547e510bbc (diff) | |
download | qemu-bd38794a1119ec8e3f0a7473458ce4cdd229bc42.zip qemu-bd38794a1119ec8e3f0a7473458ce4cdd229bc42.tar.gz qemu-bd38794a1119ec8e3f0a7473458ce4cdd229bc42.tar.bz2 |
net: Add get_acked_features callback to VhostNetOptions
This patch continues the effort to decouple the generic vhost layer
from specific network backend implementations.
Previously, the vhost_net initialization code contained a hardcoded
check for the vhost-user client type to retrieve its acked features
by calling vhost_user_get_acked_features(). This exposed an
internal vhost-user function in a public header and coupled the two
modules.
The vhost-user backend is updated to provide a callback, and its
getter function is now static. The call site in vhost_net.c is
simplified to use the new generic helper, removing the type check and
the direct dependency.
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/net/vhost_net.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 787c769..fb169af 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -288,9 +288,8 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options) } /* Set sane init value. Override when guest acks. */ -#ifdef CONFIG_VHOST_NET_USER - if (net->nc->info->type == NET_CLIENT_DRIVER_VHOST_USER) { - features = vhost_user_get_acked_features(net->nc); + if (options->get_acked_features) { + features = options->get_acked_features(net->nc); if (~net->dev.features & features) { fprintf(stderr, "vhost lacks feature mask 0x%" PRIx64 " for backend\n", @@ -298,7 +297,6 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options) goto fail; } } -#endif vhost_net_ack_features(net, features); |