Signed-off-by: Tiwei Bie <tiwei....@intel.com>
---
 lib/librte_vhost/virtio_net.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 2d111a3..8344bcb 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -1264,10 +1264,10 @@ vhost_dequeue_burst_1_1(struct virtio_net *dev, struct 
vhost_virtqueue *vq,
 
        vq->last_used_idx = desc_idx;
        if (likely(i)) {
-               for (desc_idx = 1;
-                    desc_idx < (uint16_t)(vq->last_used_idx - head_idx);
+               for (desc_idx = head_idx + 1;
+                    desc_idx != vq->last_used_idx;
                     desc_idx++) {
-                       desc[(desc_idx + head_idx) & (vq->size - 1)].flags = 0;
+                       desc[desc_idx & (vq->size - 1)].flags = 0;
                }
                rte_smp_wmb();
                desc[head_idx & (vq->size - 1)].flags = 0;
-- 
2.7.4

Reply via email to