aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2025-07-09 10:24:21 +0200
committerJason Wang <jasowang@redhat.com>2025-07-14 13:27:09 +0800
commit1652f1b335fb5bec921c64ff7f378e6732510ca4 (patch)
treee12898426fc54280467eac9723d8de8e87492bbb /hw
parentbd38794a1119ec8e3f0a7473458ce4cdd229bc42 (diff)
downloadqemu-1652f1b335fb5bec921c64ff7f378e6732510ca4.zip
qemu-1652f1b335fb5bec921c64ff7f378e6732510ca4.tar.gz
qemu-1652f1b335fb5bec921c64ff7f378e6732510ca4.tar.bz2
net: Add save_acked_features callback to vhost_net
This commit introduces a save_acked_features function pointer to vhost_net and converts the vhost_net function into a generic dispatcher. The vhost-user backend provides the callback, making its function static. With this change, no other module has a direct dependency on the vhost-user implementation. This cleanup allows for the complete removal of the net/vhost-user.h header file. 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-stub.c1
-rw-r--r--hw/net/vhost_net.c10
2 files changed, 5 insertions, 6 deletions
diff --git a/hw/net/vhost_net-stub.c b/hw/net/vhost_net-stub.c
index 7bed0bf..7d49f82 100644
--- a/hw/net/vhost_net-stub.c
+++ b/hw/net/vhost_net-stub.c
@@ -13,7 +13,6 @@
#include "qemu/osdep.h"
#include "net/net.h"
#include "net/tap.h"
-#include "net/vhost-user.h"
#include "hw/virtio/virtio-net.h"
#include "net/vhost_net.h"
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index fb169af..976d2b3 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -16,7 +16,6 @@
#include "qemu/osdep.h"
#include "net/net.h"
#include "net/tap.h"
-#include "net/vhost-user.h"
#include "net/vhost-vdpa.h"
#include "standard-headers/linux/vhost_types.h"
@@ -70,11 +69,11 @@ uint64_t vhost_net_get_acked_features(VHostNetState *net)
void vhost_net_save_acked_features(NetClientState *nc)
{
-#ifdef CONFIG_VHOST_NET_USER
- if (nc->info->type == NET_CLIENT_DRIVER_VHOST_USER) {
- vhost_user_save_acked_features(nc);
+ struct vhost_net *net = get_vhost_net(nc);
+
+ if (net && net->save_acked_features) {
+ net->save_acked_features(nc);
}
-#endif
}
static void vhost_net_disable_notifiers_nvhosts(VirtIODevice *dev,
@@ -245,6 +244,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options)
net->nc = options->net_backend;
net->dev.nvqs = options->nvqs;
net->feature_bits = options->feature_bits;
+ net->save_acked_features = options->save_acked_features;
net->dev.max_queues = 1;
net->dev.vqs = net->vqs;