From: Ilya Maximets Date: Fri, 15 Jul 2016 11:15:04 +0000 (+0300) Subject: vhost: fix used descriptors number of mergeable enqueue X-Git-Tag: spdx-start~6165 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=8729de6092cac2f4945c6bd81c997e8e1d41ed2b;p=dpdk.git 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 Acked-by: Yuanhan Liu --- diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c index 15ca956233..a9b04df370 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)) {