From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp2203-239.mail.aliyun.com (smtp2203-239.mail.aliyun.com [121.197.203.239]) by dpdk.org (Postfix) with ESMTP id 47EA22E8A for ; Mon, 1 Jun 2015 08:11:48 +0200 (CEST) X-Alimail-AntiSpam: AC=CONTINUE; BC=0.5710375|-1; FP=0|0|0|0|0|-1|-1|-1; HT=r41g03043; MF=liw@dtdream.com; PH=DS; RN=3; RT=3; SR=0; Received: from liw0310-PC.local(mailfrom:liw@dtdream.com ip:111.198.29.132) by smtp.aliyun-inc.com(10.147.38.253); Mon, 01 Jun 2015 14:11:41 +0800 Date: Mon, 1 Jun 2015 14:11:40 +0800 From: Wei li Sender: Wei li To: dev@dpdk.org; Message-ID: <72a55103-9c65-4f2e-9448-919622dbac81@liw0310-PC.local> X-Mailer: TortoiseGit MIME-Version: 1.0 Content-Type: text/plain; Cc: Subject: [dpdk-dev] [PATCH v2] lib_vhost:reset secure_len when rte_atomic16_cmpset failed 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: Mon, 01 Jun 2015 06:11:50 -0000 when rte_atomic16_cmpset return 0 in first loop, secure_len should be reset to 0 in second loop, otherwise (pkt_len > secure_len) always be false, the num of desc maybe not enough Signed-off-by: Wei li --- lib/librte_vhost/vhost_rxtx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) v1->v2 add more descriotion delete unnecessary variable assignment diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c index 4809d32..b7e356c 100644 --- a/lib/librte_vhost/vhost_rxtx.c +++ b/lib/librte_vhost/vhost_rxtx.c @@ -418,7 +418,7 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t queue_id, return 0; for (pkt_idx = 0; pkt_idx < count; pkt_idx++) { - uint32_t secure_len = 0; + uint32_t secure_len; uint16_t need_cnt; uint32_t vec_idx = 0; uint32_t pkt_len = pkts[pkt_idx]->pkt_len + vq->vhost_hlen; @@ -431,6 +431,7 @@ virtio_dev_merge_rx(struct virtio_net *dev, uint16_t queue_id, */ res_base_idx = vq->last_used_idx_res; res_cur_idx = res_base_idx; + secure_len = 0; do { avail_idx = *((volatile uint16_t *)&vq->avail->idx); -- 1.9.5.msysgit.1