From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 47F8F1B67A for ; Mon, 25 Dec 2017 10:16:21 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Dec 2017 01:16:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,454,1508828400"; d="scan'208";a="161590252" Received: from unknown (HELO dpdk5.bj.intel.com) ([172.16.182.198]) by orsmga004.jf.intel.com with ESMTP; 25 Dec 2017 01:16:19 -0800 From: Zhiyong Yang To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, yliu@fridaylinux.org, Zhiyong Yang Date: Mon, 25 Dec 2017 17:16:17 +0800 Message-Id: <20171225091617.60387-1-zhiyong.yang@intel.com> X-Mailer: git-send-email 2.13.3 Subject: [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: Mon, 25 Dec 2017 09:16:22 -0000 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); 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