From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by dpdk.org (Postfix) with ESMTP id D322E5586 for ; Fri, 15 Jul 2016 13:15:22 +0200 (CEST) Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OAC00FAKSLKXA60@mailout1.w1.samsung.com> for dev@dpdk.org; Fri, 15 Jul 2016 12:15:20 +0100 (BST) X-AuditID: cbfec7f5-f792a6d000001302-4a-5788c5c8fb9b Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id A4.9C.04866.8C5C8875; Fri, 15 Jul 2016 12:15:20 +0100 (BST) Received: from imaximets.rnd.samsung.ru ([106.109.129.180]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OAC005XOSL8G570@eusync4.samsung.com>; Fri, 15 Jul 2016 12:15:20 +0100 (BST) From: Ilya Maximets To: dev@dpdk.org, Huawei Xie , Yuanhan Liu , Rich Lane Cc: Dyasly Sergey , Heetae Ahn , Jianfeng Tan , Stephen Hemminger , Thomas Monjalon , Ilya Maximets Date: Fri, 15 Jul 2016 14:15:04 +0300 Message-id: <1468581305-11756-2-git-send-email-i.maximets@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1468581305-11756-1-git-send-email-i.maximets@samsung.com> References: <1463748604-27251-1-git-send-email-i.maximets@samsung.com> <1468581305-11756-1-git-send-email-i.maximets@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrDLMWRmVeSWpSXmKPExsVy+t/xa7onjnaEG+yaLm/x7tN2Jotpn2+z W7TPPMtkcaX9J7tF9+wvbBab3k1itZg8W8pi8R05iy+bprNZXJ9wgdWBy+Ni/x1GjweXbzJ5 /FqwlNVj8Z6XTB7zTgZ69Jycx+TRt2UVYwB7FJdNSmpOZllqkb5dAlfGpE/LmAomcFWsarjI 1MC4h6OLkZNDQsBE4svZw8wQtpjEhXvr2UBsIYGljBJ/J8d1MXIB2a1MEvf2PGEHSbAJ6Eic Wn2EESQhItDKKPH4/zQ2EIdZoJlJYtsHkCoODmGBYImJrzVBGlgEVCXWf3wPNpVXwE1i5Ysr TBDb5CRunusE28wp4C5xdvdLNohtzYwSLxtOsU5g5F3AyLCKUTS1NLmgOCk910ivODG3uDQv XS85P3cTIyQMv+5gXHrM6hCjAAejEg/vjkPt4UKsiWXFlbmHGCU4mJVEeEuPdIQL8aYkVlal FuXHF5XmpBYfYpTmYFES5525632IkEB6YklqdmpqQWoRTJaJg1OqgVFjs1Dg9sS/63X15vfe TbPKTtjyViKD6SOvtti19Y6bk44JPZX03s4jt+DMt5AVyRyP78d2yTCLiP1dprzhbr7rn2bN +9IWd2fVe8y72+u6pU1Aa/+6mPybz07umamwLeu5r56zZ8VOq2OuCb9mSl81rC1QauwumhO1 zaBn7UHBp5nr/nXNu6jEUpyRaKjFXFScCAAcbXmPPwIAAA== Subject: [dpdk-dev] [PATCH v3 1/2] vhost: fix using of bad return value on mergeable enqueue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jul 2016 11:15:22 -0000 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 --- lib/librte_vhost/vhost_rxtx.c | 4 ++-- 1 file 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)) { -- 2.7.4