diff options
author | Konstantin Shkolnyy <kshk@linux.ibm.com> | 2025-02-21 13:07:33 -0600 |
---|---|---|
committer | Jason Wang <jasowang@redhat.com> | 2025-03-17 13:46:28 +0800 |
commit | b027f55a994af885a7a498a40373a2dcc2d8b15e (patch) | |
tree | d094b382414ea6714fbd7221fd75e5b466c389fc | |
parent | aa90f1161bb17a4863e16ec2f75104cff0752d4e (diff) | |
download | qemu-b027f55a994af885a7a498a40373a2dcc2d8b15e.zip qemu-b027f55a994af885a7a498a40373a2dcc2d8b15e.tar.gz qemu-b027f55a994af885a7a498a40373a2dcc2d8b15e.tar.bz2 |
vdpa: Allow vDPA to work on big-endian machine
Add .set_vnet_le() function that always returns success, assuming that
vDPA h/w always implements LE data format. Otherwise, QEMU disables vDPA and
outputs the message:
"backend does not support LE vnet headers; falling back on userspace virtio"
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Eugenio PĂ©rez <eperezma@redhat.com>
Signed-off-by: Konstantin Shkolnyy <kshk@linux.ibm.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
-rw-r--r-- | net/vhost-vdpa.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index f7a54f4..7ca8b46 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -262,6 +262,18 @@ static bool vhost_vdpa_has_ufo(NetClientState *nc) } +/* + * FIXME: vhost_vdpa doesn't have an API to "set h/w endianness". But it's + * reasonable to assume that h/w is LE by default, because LE is what + * virtio 1.0 and later ask for. So, this function just says "yes, the h/w is + * LE". Otherwise, on a BE machine, higher-level code would mistakely think + * the h/w is BE and can't support VDPA for a virtio 1.0 client. + */ +static int vhost_vdpa_set_vnet_le(NetClientState *nc, bool enable) +{ + return 0; +} + static bool vhost_vdpa_check_peer_type(NetClientState *nc, ObjectClass *oc, Error **errp) { @@ -429,6 +441,7 @@ static NetClientInfo net_vhost_vdpa_info = { .cleanup = vhost_vdpa_cleanup, .has_vnet_hdr = vhost_vdpa_has_vnet_hdr, .has_ufo = vhost_vdpa_has_ufo, + .set_vnet_le = vhost_vdpa_set_vnet_le, .check_peer_type = vhost_vdpa_check_peer_type, .set_steering_ebpf = vhost_vdpa_set_steering_ebpf, }; |