From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmIKw-0000DW-1b for qemu-devel@nongnu.org; Wed, 14 Oct 2015 05:27:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmIKs-0003X4-Sp for qemu-devel@nongnu.org; Wed, 14 Oct 2015 05:27:05 -0400 Date: Wed, 14 Oct 2015 12:26:58 +0300 From: "Michael S. Tsirkin" Message-ID: <1444814805-15071-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] net: don't set native endianness List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Marcel Apfelbaum , Jason Wang , qemu-stable@nongnu.org, Greg Kurz commit 5be7d9f1b1452613b95c6ba70b8d7ad3d0797991 vhost-net: tell tap backend about the vnet endianness makes vhost net always try to set LE - even if that matches the native endian-ness. This makes it fail on older kernels on x86 without TUNSETVNETLE support. To fix, make qemu_set_vnet_le/qemu_set_vnet_be skip the ioctl if it matches the host endian-ness. Reported-by: Marcel Apfelbaum Cc: Greg Kurz Cc: qemu-stable@nongnu.org Signed-off-by: Michael S. Tsirkin --- net/net.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/net.c b/net/net.c index 28a5597..8e96011 100644 --- a/net/net.c +++ b/net/net.c @@ -517,20 +517,28 @@ void qemu_set_vnet_hdr_len(NetClientState *nc, int len) int qemu_set_vnet_le(NetClientState *nc, bool is_le) { +#ifdef HOST_WORDS_BIGENDIAN if (!nc || !nc->info->set_vnet_le) { return -ENOSYS; } return nc->info->set_vnet_le(nc, is_le); +#else + return 0; +#endif } int qemu_set_vnet_be(NetClientState *nc, bool is_be) { +#ifdef HOST_WORDS_BIGENDIAN + return 0; +#else if (!nc || !nc->info->set_vnet_be) { return -ENOSYS; } return nc->info->set_vnet_be(nc, is_be); +#endif } int qemu_can_send_packet(NetClientState *sender) -- MST