[dpdk-dev] [RFC PATCH 07/11] vhost: mark desc being used
Jens Freimann
jfreiman at redhat.com
Fri May 5 15:57:18 CEST 2017
From: Yuanhan Liu <yuanhan.liu at linux.intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu at linux.intel.com>
---
lib/librte_vhost/virtio_net.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index fd6f200..df88e31 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -1009,6 +1009,7 @@ static inline bool __attribute__((always_inline))
*/
if (likely((desc->len == dev->vhost_hlen) &&
(desc->flags & VRING_DESC_F_NEXT) != 0)) {
+ rte_smp_wmb();
desc->flags = 0;
desc = &descs[(head_idx++) & (vq->size - 1)];
@@ -1068,11 +1069,11 @@ static inline bool __attribute__((always_inline))
/* This desc reaches to its end, get the next one */
if (desc_avail == 0) {
- desc->flags = 0;
-
if ((desc->flags & VRING_DESC_F_NEXT) == 0)
break;
+ rte_smp_wmb();
+ desc->flags = 0;
desc = &descs[(head_idx++) & (vq->size - 1)];
if (unlikely(desc->flags & VRING_DESC_F_INDIRECT))
return -1;
@@ -1111,6 +1112,7 @@ static inline bool __attribute__((always_inline))
mbuf_avail = cur->buf_len - RTE_PKTMBUF_HEADROOM;
}
}
+ rte_smp_wmb();
desc->flags = 0;
prev->data_len = mbuf_offset;
--
1.8.3.1
More information about the dev
mailing list