[dpdk-dev,RFC,29/29] vhost: update and return descs in batch

Message ID 1498013885-102779-30-git-send-email-tiwei.bie@intel.com (mailing list archive)
State Not Applicable, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Tiwei Bie June 21, 2017, 2:58 a.m. UTC
  Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 lib/librte_vhost/virtio_net.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
  

Patch

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 8344bcb..7f76b1a 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -604,8 +604,6 @@  enqueue_pkt(struct virtio_net *dev, struct vring_desc_1_1 *descs,
 	if (unlikely(desc->len < dev->vhost_hlen) || !desc_addr)
 		return -1;
 
-	desc->len = m->pkt_len + dev->vhost_hlen;
-
 	rte_prefetch0((void *)(uintptr_t)desc_addr);
 
 	hdr = (struct virtio_net_hdr_mrg_rxbuf *)(uintptr_t)desc_addr;
@@ -699,11 +697,15 @@  vhost_enqueue_burst_1_1(struct virtio_net *dev, uint16_t queue_id,
 	count = i;
 
 	if (count) {
-		rte_smp_wmb();
-		for (i = 0; i < count; i++) {
+		for (i = 1; i < count; i++) {
 			idx = (head_idx + i) & (vq->size - 1);
+			desc[idx].len = pkts[i]->pkt_len + dev->vhost_hlen;
 			desc[idx].flags &= ~DESC_HW;
 		}
+		desc[head_idx & (vq->size - 1)].len =
+			pkts[0]->pkt_len + dev->vhost_hlen;
+		rte_smp_wmb();
+		desc[head_idx & (vq->size - 1)].flags &= ~DESC_HW;
 	}
 
 	return count;