From patchwork Thu Apr 25 07:24:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 239409 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 754A52C01B2 for ; Thu, 25 Apr 2013 17:34:41 +1000 (EST) Received: from localhost ([::1]:47130 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVGhT-0007Ck-5E for incoming@patchwork.ozlabs.org; Thu, 25 Apr 2013 03:34:39 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36946) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVGh8-0007CQ-P8 for qemu-devel@nongnu.org; Thu, 25 Apr 2013 03:34:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVGh3-0008IF-Ug for qemu-devel@nongnu.org; Thu, 25 Apr 2013 03:34:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVGh3-0008I7-La for qemu-devel@nongnu.org; Thu, 25 Apr 2013 03:34:13 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3P7Y6Bk006765 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 25 Apr 2013 03:34:06 -0400 Received: from amd-6168-8-1.englab.nay.redhat.com (amd-6168-8-1.englab.nay.redhat.com [10.66.104.52]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3P7Y0oX003911; Thu, 25 Apr 2013 03:34:02 -0400 From: Jason Wang To: aliguori@us.ibm.com, qemu-devel@nongnu.org Date: Thu, 25 Apr 2013 15:24:23 +0800 Message-Id: <1366874663-2566-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Jason Wang , Aurelien Jarno , mst@redhat.com Subject: [Qemu-devel] [PATCH v2] virtio-net: unbreak the minix guest 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Multiqueue patchset conditionally add control vq only when guest negotiate the feature. Though the spec is not clear on this but it breaks the minix guest since it will identify the ctrl vq even if it does not support it. Though this behavior seems a violation on the spec "If the VIRTIO_NET_F_CTRL_VQ feature bit is negotiated, identify the control virtqueue.", to keep the backward compatibility, always add the ctrl vq at end of the queues. Reported-by: Aurelien Jarno Cc: Aurelien Jarno Signed-off-by: Jason Wang Acked-by: Michael S. Tsirkin Tested-by: Aurelien Jarno --- Changes from V1: - Drop the unrelated cleanups - Drop the meaningless ctrl parameter of virtio_net_set_multiqueue() --- hw/net/virtio-net.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 4d2cdd2..1662f46 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -309,7 +309,7 @@ static void virtio_net_set_queues(VirtIONet *n) } } -static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue, int ctrl); +static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue); static uint32_t virtio_net_get_features(VirtIODevice *vdev, uint32_t features) { @@ -364,8 +364,7 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint32_t features) VirtIONet *n = VIRTIO_NET(vdev); int i; - virtio_net_set_multiqueue(n, !!(features & (1 << VIRTIO_NET_F_MQ)), - !!(features & (1 << VIRTIO_NET_F_CTRL_VQ))); + virtio_net_set_multiqueue(n, !!(features & (1 << VIRTIO_NET_F_MQ))); virtio_net_set_mrg_rx_bufs(n, !!(features & (1 << VIRTIO_NET_F_MRG_RXBUF))); @@ -1038,7 +1037,7 @@ static void virtio_net_tx_bh(void *opaque) } } -static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue, int ctrl) +static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue) { VirtIODevice *vdev = VIRTIO_DEVICE(n); int i, max = multiqueue ? n->max_queues : 1; @@ -1067,9 +1066,11 @@ static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue, int ctrl) n->vqs[i].n = n; } - if (ctrl) { - n->ctrl_vq = virtio_add_queue(vdev, 64, virtio_net_handle_ctrl); - } + /* Note: Minux Guests (version 3.2.1) use ctrl vq but don't ack + * VIRTIO_NET_F_CTRL_VQ. Create ctrl vq unconditionally to avoid + * breaking them. + */ + n->ctrl_vq = virtio_add_queue(vdev, 64, virtio_net_handle_ctrl); virtio_net_set_queues(n); }