DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] lib/librte_vhost: remove redundant logic judgement
@ 2017-12-25  9:16 Zhiyong Yang
  2017-12-27 14:29 ` Yuanhan Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Zhiyong Yang @ 2017-12-25  9:16 UTC (permalink / raw)
  To: dev; +Cc: maxime.coquelin, yliu, Zhiyong Yang

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 <zhiyong.yang@intel.com>
---
 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-03 10:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-25  9:16 [dpdk-dev] [PATCH] lib/librte_vhost: remove redundant logic judgement Zhiyong Yang
2017-12-27 14:29 ` Yuanhan Liu
2018-01-03 10:21   ` Yang, Zhiyong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).