From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jens Freimann Subject: [RFC PATCH 07/11] vhost: mark desc being used Date: Fri, 5 May 2017 09:57:18 -0400 Message-ID: <1493992642-52756-8-git-send-email-jfreiman@redhat.com> References: <1493992642-52756-1-git-send-email-jfreiman@redhat.com> Cc: dev@dpdk.org To: yuanhan.liu@linux.intel.com Return-path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 2723F58FE for ; Fri, 5 May 2017 15:57:28 +0200 (CEST) In-Reply-To: <1493992642-52756-1-git-send-email-jfreiman@redhat.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Yuanhan Liu Signed-off-by: Yuanhan Liu --- 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