From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 2E30A1B265 for ; Wed, 27 Dec 2017 15:29:24 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 7D6AF20BC6; Wed, 27 Dec 2017 09:29:24 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Wed, 27 Dec 2017 09:29:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=wOp0V0m3d8LlY46kVK++JDT1ME/NLwr8LMBN/LAYcvY=; b=eDaY/i6w UbB+uqeMclqE9McpAuAjQt2VLgIh1IWROEO+sFOOgeh9ykoKILsW/xMlOr7F7sKX GbtZixvdiw34ql9BB45AjsVmrzFoLq9nY4VFTcI+8S1lnRBL0kDM+bPgornnmjG/ d6PQhfBZS/JH45ZS4mnOXiX1GXasKy3Q9cBpgdWWpL60fMRPWmBGwQwjdk/WneuZ bEeq4BKSSUOmZN6HUyj3ksWCKUpTHDr7253ukbMbpQyzJGB5sYZRZJSLP+jPEdO+ 7R/zgWq6xvcktrsTVDvlkltHODxrwThd2+5fb5NLrpMjFt83IWX05ku4vBCx8Clj oBjyj1OTjZLp4g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=wOp0V0m3d8LlY46kVK++JDT1ME/NL wr8LMBN/LAYcvY=; b=esm3qi1xYTXCxHge8aIzeX+ydlQSZGV3tJnYO0z9IlS+4 fVnV1wXs+E7EJkW3L33iam5wPVeYp6bH4MrCuMnRm5eMeG33RS0pk03zHGM1PH+D w/iY4FtYe+gtv9NhQQZ4Xtmmc0Kt8sn6MfIgagJM6M7672/NVWnkLHrdYlREMLuM iYWTtmefEw2kQlGh2NRKUzdnezy2ZLgUBGZWz65ZcQvJR2S6qqIsGTiF++EDgyAW nTlUr27+r/RPYiNmANAzHZh04764d56EE9MlOGj5Lbq9YmqSHvlo3hxjZR4ugft8 Fgzg7bfoAEPynKK7rJgqOL3j2PQopr/qMQIliRFqg== X-ME-Sender: Received: from yliu-mob (unknown [115.150.27.225]) by mail.messagingengine.com (Postfix) with ESMTPA id 66C227E13A; Wed, 27 Dec 2017 09:29:22 -0500 (EST) Date: Wed, 27 Dec 2017 22:29:19 +0800 From: Yuanhan Liu To: Zhiyong Yang Cc: dev@dpdk.org, maxime.coquelin@redhat.com Message-ID: <20171227142919.GG8818@yliu-mob> References: <20171225091617.60387-1-zhiyong.yang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171225091617.60387-1-zhiyong.yang@intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [dpdk-dev] [PATCH] lib/librte_vhost: remove redundant logic judgement 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: Wed, 27 Dec 2017 14:29:25 -0000 On Mon, Dec 25, 2017 at 05:16:17PM +0800, Zhiyong Yang wrote: > At the beginning of vring_translate, the code > if(!(dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))) already judges > if IOMMU_PLATFORM is supported. The function vhost_iova_to_vva always > repeats the logic, __vhost_iova_to_vva can be used directly to avoid it > here. > > Signed-off-by: Zhiyong Yang > --- > lib/librte_vhost/vhost.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c > index 4f8b73a09..bb615fd2a 100644 > --- a/lib/librte_vhost/vhost.c > +++ b/lib/librte_vhost/vhost.c > @@ -157,7 +157,7 @@ vring_translate(struct virtio_net *dev, struct vhost_virtqueue *vq) > goto out; > > size = sizeof(struct vring_desc) * vq->size; > - vq->desc = (struct vring_desc *)(uintptr_t)vhost_iova_to_vva(dev, vq, > + vq->desc = (struct vring_desc *)(uintptr_t)__vhost_iova_to_vva(dev, vq, > vq->ring_addrs.desc_user_addr, > size, VHOST_ACCESS_RW); I don't see strong reason to bother doing the change. It's not in the datapath after all. I'd like to keep the code as it is, to keep it simpler: user just has to call vhost_iova_to_vva() and let it to handle the details. --yliu > if (!vq->desc) > @@ -165,7 +165,8 @@ vring_translate(struct virtio_net *dev, struct vhost_virtqueue *vq) > > size = sizeof(struct vring_avail); > size += sizeof(uint16_t) * vq->size; > - vq->avail = (struct vring_avail *)(uintptr_t)vhost_iova_to_vva(dev, vq, > + vq->avail = (struct vring_avail *)(uintptr_t)__vhost_iova_to_vva(dev, > + vq, > vq->ring_addrs.avail_user_addr, > size, VHOST_ACCESS_RW); > if (!vq->avail) > @@ -173,7 +174,7 @@ vring_translate(struct virtio_net *dev, struct vhost_virtqueue *vq) > > size = sizeof(struct vring_used); > size += sizeof(struct vring_used_elem) * vq->size; > - vq->used = (struct vring_used *)(uintptr_t)vhost_iova_to_vva(dev, vq, > + vq->used = (struct vring_used *)(uintptr_t)__vhost_iova_to_vva(dev, vq, > vq->ring_addrs.used_user_addr, > size, VHOST_ACCESS_RW); > if (!vq->used) > -- > 2.13.3