From patchwork Sat Feb 6 19:15:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 8243471 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 897FABEEE5 for ; Sat, 6 Feb 2016 19:33:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 74F80201CD for ; Sat, 6 Feb 2016 19:33:13 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B873B20138 for ; Sat, 6 Feb 2016 19:33:12 +0000 (UTC) Received: from localhost ([::1]:56258 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aS8bY-0004UH-4V for patchwork-qemu-devel@patchwork.kernel.org; Sat, 06 Feb 2016 14:33:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53913) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aS8KM-0005lg-D6 for qemu-devel@nongnu.org; Sat, 06 Feb 2016 14:15:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aS8KH-00037i-E0 for qemu-devel@nongnu.org; Sat, 06 Feb 2016 14:15:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56780) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aS8KH-00037c-96 for qemu-devel@nongnu.org; Sat, 06 Feb 2016 14:15:21 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id F419E5A41; Sat, 6 Feb 2016 19:15:20 +0000 (UTC) Received: from redhat.com (vpn1-5-159.ams2.redhat.com [10.36.5.159]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u16JFHxE012800; Sat, 6 Feb 2016 14:15:18 -0500 Date: Sat, 6 Feb 2016 21:15:17 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1454784308-21177-46-git-send-email-mst@redhat.com> References: <1454784308-21177-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1454784308-21177-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Laurent Vivier , Peter Maydell , Eduardo Habkost , Jason Wang , Cornelia Huck , Greg Kurz Subject: [Qemu-devel] [PULL v2 45/45] net: set endianness on all backend devices X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Laurent Vivier commit 5be7d9f1b1452613b95c6ba70b8d7ad3d0797991 vhost-net: tell tap backend about the vnet endianness makes vhost net to set the endianness of the device, but only for the first device. In case of multiqueue, we have multiple devices... This patch sets the endianness for all the devices of the interface. Signed-off-by: Laurent Vivier Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Greg Kurz Reviewed-by: Cornelia Huck Reviewed-by: Jason Wang --- hw/net/vhost_net.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 0bd5131..3940a04 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -298,21 +298,19 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(dev))); VirtioBusState *vbus = VIRTIO_BUS(qbus); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus); - int r, e, i; + int r, e, i, j; if (!k->set_guest_notifiers) { error_report("binding does not support guest notifiers"); - r = -ENOSYS; - goto err; + return -ENOSYS; } - r = vhost_net_set_vnet_endian(dev, ncs[0].peer, true); - if (r < 0) { - goto err; - } - - for (i = 0; i < total_queues; i++) { - vhost_net_set_vq_index(get_vhost_net(ncs[i].peer), i * 2); + for (j = 0; j < total_queues; j++) { + r = vhost_net_set_vnet_endian(dev, ncs[j].peer, true); + if (r < 0) { + goto err_endian; + } + vhost_net_set_vq_index(get_vhost_net(ncs[j].peer), j * 2); } r = k->set_guest_notifiers(qbus->parent, total_queues * 2, true); @@ -341,8 +339,9 @@ err_start: fflush(stderr); } err_endian: - vhost_net_set_vnet_endian(dev, ncs[0].peer, false); -err: + while (--j >= 0) { + vhost_net_set_vnet_endian(dev, ncs[j].peer, false); + } return r; }