From bd38794a1119ec8e3f0a7473458ce4cdd229bc42 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Wed, 9 Jul 2025 10:24:20 +0200 Subject: 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 Signed-off-by: Jason Wang --- net/vhost-user.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'net/vhost-user.c') diff --git a/net/vhost-user.c b/net/vhost-user.c index bc8e82a092..93b413b49f 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -81,7 +81,7 @@ static struct vhost_net *vhost_user_get_vhost_net(NetClientState *nc) return s->vhost_net; } -uint64_t vhost_user_get_acked_features(NetClientState *nc) +static uint64_t vhost_user_get_acked_features(NetClientState *nc) { NetVhostUserState *s = DO_UPCAST(NetVhostUserState, nc, nc); assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_USER); @@ -139,6 +139,8 @@ static int vhost_user_start(int queues, NetClientState *ncs[], options.busyloop_timeout = 0; options.nvqs = 2; options.feature_bits = user_feature_bits; + options.get_acked_features = vhost_user_get_acked_features; + net = vhost_net_init(&options); if (!net) { error_report("failed to init vhost_net for queue %d", i); -- cgit 1.4.1