From patchwork Fri Jul 31 16:38:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Apfelbaum X-Patchwork-Id: 502701 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 96C301402F4 for ; Sat, 1 Aug 2015 02:40:02 +1000 (AEST) Received: from localhost ([::1]:45257 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLDLk-00005o-R4 for incoming@patchwork.ozlabs.org; Fri, 31 Jul 2015 12:40:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLDKO-0005sG-2x for qemu-devel@nongnu.org; Fri, 31 Jul 2015 12:38:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZLDKG-0003Bk-TK for qemu-devel@nongnu.org; Fri, 31 Jul 2015 12:38:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34399) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZLDKG-0003Bg-NP for qemu-devel@nongnu.org; Fri, 31 Jul 2015 12:38:28 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 5C5F12B5FB5; Fri, 31 Jul 2015 16:38:28 +0000 (UTC) Received: from work.redhat.com (vpn1-4-25.ams2.redhat.com [10.36.4.25]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6VGcKgC025918; Fri, 31 Jul 2015 12:38:26 -0400 From: Marcel Apfelbaum To: qemu-devel@nongnu.org Date: Fri, 31 Jul 2015 19:38:19 +0300 Message-Id: <1438360700-18289-3-git-send-email-marcel@redhat.com> In-Reply-To: <1438360700-18289-1-git-send-email-marcel@redhat.com> References: <1438360700-18289-1-git-send-email-marcel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: marcel@redhat.com, jasowang@redhat.com, famz@redhat.com, n.nikolaev@virtualopensystems.com, mst@redhat.com Subject: [Qemu-devel] [PATCH V3 2/3] hw/vhost-user: sync backend features 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 Complete vhost-user negotiation by synching the features supported by the backend. Signed-off-by: Marcel Apfelbaum --- hw/virtio/vhost-user.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index c4428a1..b522437 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -22,6 +22,7 @@ #include #include #include +#include #define VHOST_MEMORY_MAX_NREGIONS 8 @@ -358,6 +359,22 @@ static int vhost_user_init(struct vhost_dev *dev, void *opaque) return err; } + if (__virtio_has_feature(msg.u64, VIRTIO_F_ANY_LAYOUT)) { + dev->backend_features |= 1ULL << VIRTIO_F_ANY_LAYOUT; + } + + if (__virtio_has_feature(msg.u64, VIRTIO_F_VERSION_1)) { + dev->backend_features |= 1ULL << VIRTIO_F_VERSION_1; + } + + if (__virtio_has_feature(msg.u64, VIRTIO_NET_F_MRG_RXBUF)) { + dev->backend_features |= 1ULL << VIRTIO_NET_F_MRG_RXBUF; + } + + if (__virtio_has_feature(msg.u64, VIRTIO_NET_F_MQ)) { + dev->backend_features |= 1ULL << VIRTIO_NET_F_MQ; + } + if (__virtio_has_feature(msg.u64, VHOST_USER_F_PROTOCOL_FEATURES)) { dev->backend_features |= 1ULL << VHOST_USER_F_PROTOCOL_FEATURES;