summaryrefslogtreecommitdiff
path: root/lib/librte_vhost
diff options
context:
space:
mode:
authorJiayu Hu <jiayu.hu@intel.com>2018-07-25 16:21:42 +0800
committerTiwei Bie <tiwei.bie@intel.com>2018-07-26 10:02:43 +0200
commit6e2fad861a6dd80d8dafe71ae14f87a30add7366 (patch)
tree222be1b7ef8abc90c849cf065fbe9904713da003 /lib/librte_vhost
parent2854ba22c583cd4b40c2d52e3279dece175ce1ca (diff)
downloaddpdk-6e2fad861a6dd80d8dafe71ae14f87a30add7366.zip
dpdk-6e2fad861a6dd80d8dafe71ae14f87a30add7366.tar.gz
dpdk-6e2fad861a6dd80d8dafe71ae14f87a30add7366.tar.xz
vhost: fix return value on dequeue path
This patch fixes the incorrect return value for rte_vhost_dequeue_burst() when virtqueue is not enabled or virtqueue address translation fails. Fixes: 62250c1d0978 ("vhost: extract split ring handling from Rx and Tx functions") Signed-off-by: Jiayu Hu <jiayu.hu@intel.com> Reviewed-by: Jens Freimann <jfreimann@redhat.com> Acked-by: Tiwei Bie <tiwei.bie@intel.com>
Diffstat (limited to 'lib/librte_vhost')
-rw-r--r--lib/librte_vhost/virtio_net.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 07cc0c8..a8b4c96 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -1594,15 +1594,19 @@ rte_vhost_dequeue_burst(int vid, uint16_t queue_id,
if (unlikely(rte_spinlock_trylock(&vq->access_lock) == 0))
return 0;
- if (unlikely(vq->enabled == 0))
+ if (unlikely(vq->enabled == 0)) {
+ count = 0;
goto out_access_unlock;
+ }
if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))
vhost_user_iotlb_rd_lock(vq);
if (unlikely(vq->access_ok == 0))
- if (unlikely(vring_translate(dev, vq) < 0))
+ if (unlikely(vring_translate(dev, vq) < 0)) {
+ count = 0;
goto out;
+ }
/*
* Construct a RARP broadcast packet, and inject it to the "pkts"