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>
This commit is contained in:
Laurent Vivier 2025-07-09 10:24:19 +02:00 committed by Jason Wang
parent 8f6e5c620a
commit effdacbf28
7 changed files with 69 additions and 90 deletions

View file

@ -14,6 +14,4 @@
#define TYPE_VHOST_VDPA "vhost-vdpa"
extern const int vdpa_feature_bits[];
#endif /* VHOST_VDPA_H */

View file

@ -12,6 +12,7 @@ typedef struct VhostNetOptions {
NetClientState *net_backend;
uint32_t busyloop_timeout;
unsigned int nvqs;
const int *feature_bits;
void *opaque;
} VhostNetOptions;