[dpdk-dev] [PATCH v2] lib_vhost:reset secure_len when rte_atomic16_cmpset failed

Wei li liw at dtdream.com
Mon Jun 1 08:11:40 CEST 2015


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 <liw at dtdream.com>
---
 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




More information about the dev mailing list