diff options
| author | Laurent Vivier <lvivier@redhat.com> | 2025-07-09 10:24:23 +0200 |
|---|---|---|
| committer | Jason Wang <jasowang@redhat.com> | 2025-07-14 13:27:09 +0800 |
| commit | ba5acc5d6e0bc9ab86619c92cb76493aa197d7a2 (patch) | |
| tree | 76b6de340e1e03227643eee9ecd3a436883b6d05 /net/vhost-user.c | |
| parent | 33b78a30a3e8e1cf16ef423bf2e78caf3d560985 (diff) | |
| download | focaccia-qemu-ba5acc5d6e0bc9ab86619c92cb76493aa197d7a2.tar.gz focaccia-qemu-ba5acc5d6e0bc9ab86619c92cb76493aa197d7a2.zip | |
net: Add is_vhost_user flag to vhost_net struct
Introduce a boolean is_vhost_user field to the vhost_net structure. This flag is initialized during vhost_net_init based on whether the backend is vhost-user. This refactoring simplifies checks for vhost-user specific behavior, replacing direct comparisons of 'net->nc->info->type' with the new flag. It improves readability and encapsulates the backend type information directly within the vhost_net instance. Signed-off-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'net/vhost-user.c')
| -rw-r--r-- | net/vhost-user.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/vhost-user.c b/net/vhost-user.c index bf892915de..1c3b8b36f3 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -141,6 +141,7 @@ static int vhost_user_start(int queues, NetClientState *ncs[], options.max_tx_queue_size = VIRTQUEUE_MAX_SIZE; options.get_acked_features = vhost_user_get_acked_features; options.save_acked_features = vhost_user_save_acked_features; + options.is_vhost_user = true; net = vhost_net_init(&options); if (!net) { |