aboutsummaryrefslogtreecommitdiff
path: root/hw/net
diff options
context:
space:
mode:
Diffstat (limited to 'hw/net')
-rw-r--r--hw/net/vhost_net.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index 7ac7c21bdb..f87c79824b 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -275,6 +275,19 @@ static void vhost_net_stop_one(struct vhost_net *net,
vhost_dev_disable_notifiers(&net->dev, dev);
}
+static bool vhost_net_device_endian_ok(VirtIODevice *vdev)
+{
+#ifdef TARGET_IS_BIENDIAN
+#ifdef HOST_WORDS_BIGENDIAN
+ return virtio_is_big_endian(vdev);
+#else
+ return !virtio_is_big_endian(vdev);
+#endif
+#else
+ return true;
+#endif
+}
+
int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
int total_queues)
{
@@ -283,6 +296,12 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);
int r, i = 0;
+ if (!vhost_net_device_endian_ok(dev)) {
+ error_report("vhost-net does not support cross-endian");
+ r = -ENOSYS;
+ goto err;
+ }
+
if (!k->set_guest_notifiers) {
error_report("binding does not support guest notifiers");
r = -ENOSYS;