From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50243) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRc9w-0007F6-Dk for qemu-devel@nongnu.org; Fri, 05 Feb 2016 03:54:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRc9s-0001Gp-Ce for qemu-devel@nongnu.org; Fri, 05 Feb 2016 03:54:32 -0500 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:52025) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRc9s-0001GU-3W for qemu-devel@nongnu.org; Fri, 05 Feb 2016 03:54:28 -0500 Received: from localhost by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 5 Feb 2016 08:54:26 -0000 Date: Fri, 5 Feb 2016 09:54:18 +0100 From: Greg Kurz Message-ID: <20160205095418.06d690bc@bahia.huguette.org> In-Reply-To: <1454612376-7072-46-git-send-email-mst@redhat.com> References: <1454612376-7072-1-git-send-email-mst@redhat.com> <1454612376-7072-46-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PULL 45/49] net: set endianness on all backend devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Laurent Vivier , Peter Maydell , Eduardo Habkost , Jason Wang , qemu-devel@nongnu.org, qemu-stable@nongnu.org, Cornelia Huck On Thu, 4 Feb 2016 23:54:01 +0200 "Michael S. Tsirkin" wrote: > 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 > --- Cool ! Cc'ing stable since 2.4 and 2.5 need this fix as well. Thanks. -- Greg > 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; > } >