summaryrefslogtreecommitdiffstats
path: root/examples/vhost/virtio_net.c
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@gmail.com>2017-07-03 15:11:03 +0100
committerLuca Boccassi <luca.boccassi@gmail.com>2017-07-03 15:13:07 +0100
commitbf7567fd2a5b0b28ab724046143c24561d38d015 (patch)
treed3fecf7bb6da55e6ee81f8d42110bd51c6e93631 /examples/vhost/virtio_net.c
parent7595afa4d30097c1177b69257118d8ad89a539be (diff)
New upstream version 17.05.1
Change-Id: I8a23679edd6c9c593ceebecf7d2bf1b489e14ccb Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Diffstat (limited to 'examples/vhost/virtio_net.c')
-rw-r--r--examples/vhost/virtio_net.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/vhost/virtio_net.c b/examples/vhost/virtio_net.c
index cc2c3d88..5e1ed44a 100644
--- a/examples/vhost/virtio_net.c
+++ b/examples/vhost/virtio_net.c
@@ -350,6 +350,9 @@ vs_dequeue_pkts(struct vhost_dev *dev, uint16_t queue_id,
count = RTE_MIN(count, MAX_PKT_BURST);
count = RTE_MIN(count, free_entries);
+ if (unlikely(count == 0))
+ return 0;
+
/*
* Retrieve all of the head indexes first and pre-update used entries
* to avoid caching issues.
@@ -385,8 +388,6 @@ vs_dequeue_pkts(struct vhost_dev *dev, uint16_t queue_id,
}
}
- if (!i)
- return 0;
queue->last_avail_idx += i;
queue->last_used_idx += i;