[dpdk-dev,RFC,07/11] vhost: mark desc being used
Checks
Commit Message
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
lib/librte_vhost/virtio_net.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
@@ -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;