From: Konstantin Shkolnyy Date: Fri, 21 Feb 2025 19:07:33 +0000 (-0600) Subject: vdpa: Allow vDPA to work on big-endian machine X-Git-Tag: v7.2.17~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=33c255bb95945045de188a12c39fe485bd673d3e;p=thirdparty%2Fqemu.git 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 Acked-by: Eugenio Pérez Signed-off-by: Konstantin Shkolnyy Signed-off-by: Jason Wang (cherry picked from commit b027f55a994af885a7a498a40373a2dcc2d8b15e) Signed-off-by: Michael Tokarev --- diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 1b1a27de024..fcc9406a208 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -203,6 +203,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) { @@ -230,6 +242,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, };