diff options
author | Laurent Vivier <lvivier@redhat.com> | 2025-07-09 10:24:19 +0200 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2025-07-14 13:27:09 +0800 |
commit | effdacbf28d76ca0eec9086539649e547e510bbc (patch) | |
tree | 6a631996bcf35b5d59237e904d7829a15a05198a /include | |
parent | 8f6e5c620a5b21c070eed93721236cad48b6f9d7 (diff) | |
download | qemu-effdacbf28d76ca0eec9086539649e547e510bbc.zip qemu-effdacbf28d76ca0eec9086539649e547e510bbc.tar.gz qemu-effdacbf28d76ca0eec9086539649e547e510bbc.tar.bz2 |
net: Consolidate vhost feature bits into vhost_net structure
Previously, the vhost_net_get_feature_bits() function in
hw/net/vhost_net.c used a large switch statement to determine
the appropriate feature bits based on the NetClientDriver type.
This created unnecessary coupling between the generic vhost layer
and specific network backends (like TAP, vhost-user, and
vhost-vdpa).
This patch moves the definition of vhost feature bits directly into the
vhost_net structure for each relevant network client.
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/hw/virtio/vhost.h | 1 | ||||
-rw-r--r-- | include/net/vhost-vdpa.h | 2 | ||||
-rw-r--r-- | include/net/vhost_net.h | 1 |
3 files changed, 2 insertions, 2 deletions
diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index 38800a7..6a75fdc 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -143,6 +143,7 @@ struct vhost_net { struct vhost_dev dev; struct vhost_virtqueue vqs[2]; int backend; + const int *feature_bits; NetClientState *nc; }; diff --git a/include/net/vhost-vdpa.h b/include/net/vhost-vdpa.h index 916ead3..f8d7d6c 100644 --- a/include/net/vhost-vdpa.h +++ b/include/net/vhost-vdpa.h @@ -14,6 +14,4 @@ #define TYPE_VHOST_VDPA "vhost-vdpa" -extern const int vdpa_feature_bits[]; - #endif /* VHOST_VDPA_H */ diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h index 0f40049..fbed373 100644 --- a/include/net/vhost_net.h +++ b/include/net/vhost_net.h @@ -12,6 +12,7 @@ typedef struct VhostNetOptions { NetClientState *net_backend; uint32_t busyloop_timeout; unsigned int nvqs; + const int *feature_bits; void *opaque; } VhostNetOptions; |