Skip to content

Commit b027f55

Browse files
Konstantin Shkolnyyjasowang
authored andcommitted
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 <[email protected]> Acked-by: Eugenio Pérez <[email protected]> Signed-off-by: Konstantin Shkolnyy <[email protected]> Signed-off-by: Jason Wang <[email protected]>
1 parent aa90f11 commit b027f55

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

net/vhost-vdpa.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,18 @@ static bool vhost_vdpa_has_ufo(NetClientState *nc)
262262

263263
}
264264

265+
/*
266+
* FIXME: vhost_vdpa doesn't have an API to "set h/w endianness". But it's
267+
* reasonable to assume that h/w is LE by default, because LE is what
268+
* virtio 1.0 and later ask for. So, this function just says "yes, the h/w is
269+
* LE". Otherwise, on a BE machine, higher-level code would mistakely think
270+
* the h/w is BE and can't support VDPA for a virtio 1.0 client.
271+
*/
272+
static int vhost_vdpa_set_vnet_le(NetClientState *nc, bool enable)
273+
{
274+
return 0;
275+
}
276+
265277
static bool vhost_vdpa_check_peer_type(NetClientState *nc, ObjectClass *oc,
266278
Error **errp)
267279
{
@@ -429,6 +441,7 @@ static NetClientInfo net_vhost_vdpa_info = {
429441
.cleanup = vhost_vdpa_cleanup,
430442
.has_vnet_hdr = vhost_vdpa_has_vnet_hdr,
431443
.has_ufo = vhost_vdpa_has_ufo,
444+
.set_vnet_le = vhost_vdpa_set_vnet_le,
432445
.check_peer_type = vhost_vdpa_check_peer_type,
433446
.set_steering_ebpf = vhost_vdpa_set_steering_ebpf,
434447
};

0 commit comments

Comments
 (0)