summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@samsung.com>2016-07-15 14:15:04 +0300
committerThomas Monjalon <thomas.monjalon@6wind.com>2016-07-15 22:12:37 +0200
commit8729de6092cac2f4945c6bd81c997e8e1d41ed2b (patch)
treeff9ba4c93fa33585295d6e323a97ea76fd720a5d /lib
parenteb68811af7185a2e5b582dfed8afd9840cf92854 (diff)
downloaddpdk-8729de6092cac2f4945c6bd81c997e8e1d41ed2b.zip
dpdk-8729de6092cac2f4945c6bd81c997e8e1d41ed2b.tar.gz
dpdk-8729de6092cac2f4945c6bd81c997e8e1d41ed2b.tar.xz
vhost: fix used descriptors number of mergeable enqueue
Return value on error changed from '-1' to '0' because it returns unsigned value and it means number of used descriptors. Also fixed updating of 'last_used_idx' by using actual number of used descriptors. Fixes: 623bc47054d0 ("vhost: do sanity check for ring descriptor length") Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/librte_vhost/vhost_rxtx.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c
index 15ca956..a9b04df 100644
--- a/lib/librte_vhost/vhost_rxtx.c
+++ b/lib/librte_vhost/vhost_rxtx.c
@@ -388,7 +388,7 @@ copy_mbuf_to_desc_mergeable(struct virtio_net *dev, struct vhost_virtqueue *vq,
dev->vid, cur_idx, end_idx);
if (buf_vec[vec_idx].buf_len < dev->vhost_hlen)
- return -1;
+ return 0;
desc_addr = gpa_to_vva(dev, buf_vec[vec_idx].buf_addr);
rte_prefetch0((void *)(uintptr_t)desc_addr);
@@ -507,7 +507,7 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t queue_id,
*(volatile uint16_t *)&vq->used->idx += nr_used;
vhost_log_used_vring(dev, vq, offsetof(struct vring_used, idx),
sizeof(vq->used->idx));
- vq->last_used_idx = end;
+ vq->last_used_idx += nr_used;
}
if (likely(pkt_idx)) {