From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 015BC1B68C for ; Fri, 3 Nov 2017 18:57:53 +0100 (CET) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9A5FC5F7AF; Fri, 3 Nov 2017 17:57:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9A5FC5F7AF Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=maxime.coquelin@redhat.com Received: from localhost.localdomain (ovpn-112-52.ams2.redhat.com [10.36.112.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2601B5D757; Fri, 3 Nov 2017 17:57:47 +0000 (UTC) From: Maxime Coquelin To: dev@dpdk.org, yliu@fridaylinux.org, mark.b.kavanagh@intel.com, thomas@monjalon.net, ktraynor@redhat.com Cc: Maxime Coquelin Date: Fri, 3 Nov 2017 18:57:35 +0100 Message-Id: <20171103175735.24603-1-maxime.coquelin@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 03 Nov 2017 17:57:52 +0000 (UTC) Subject: [dpdk-dev] [PATCH] vhost: disable reply-ack protocol feature if iommu feature disabled X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Nov 2017 17:57:54 -0000 If the application has disabled VIRTIO_F_IOMMU_PLATFORM, disable VHOST_USER_PROTOCOL_F_REPLY_ACK protocol feature that is only mandatory with IOMMU for now. This is done to provide a way for the application to support multiqueue with old Qemu versions (v2.7.0 to v2.9.0) that have reply-ack feature broken. Signed-off-by: Maxime Coquelin --- This is an alternative to my proposition of adding a new flag at vhost register time. Advantage of this solution is that it does not bring API change. lib/librte_vhost/vhost_user.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 1f6cba4b9..e35218688 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -878,6 +878,27 @@ vhost_user_set_vring_enable(struct virtio_net **pdev, } static void +vhost_user_get_protocol_features(struct virtio_net *dev, + struct VhostUserMsg *msg) +{ + uint64_t features, protocol_features = VHOST_USER_PROTOCOL_FEATURES; + + rte_vhost_driver_get_features(dev->ifname, &features); + + /* + * REPLY_ACK protocol feature is only mandatory for now + * for IOMMU feature. If IOMMU is explicitly disabled by the + * application, disable also REPLY_ACK feature for older buggy + * Qemu versions (from v2.7.0 to v2.9.0). + */ + if (!(features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))) + protocol_features &= ~(1ULL << VHOST_USER_PROTOCOL_F_REPLY_ACK); + + msg->payload.u64 = protocol_features; + msg->size = sizeof(msg->payload.u64); +} + +static void vhost_user_set_protocol_features(struct virtio_net *dev, uint64_t protocol_features) { @@ -1248,8 +1269,7 @@ vhost_user_msg_handler(int vid, int fd) break; case VHOST_USER_GET_PROTOCOL_FEATURES: - msg.payload.u64 = VHOST_USER_PROTOCOL_FEATURES; - msg.size = sizeof(msg.payload.u64); + vhost_user_get_protocol_features(dev, &msg); send_vhost_reply(fd, &msg); break; case VHOST_USER_SET_PROTOCOL_FEATURES: -- 2.13.6