From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 72C218004A; Fri, 5 May 2017 13:57:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 72C218004A Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jfreiman@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 72C218004A Received: from virtlab417.ml3.eng.bos.redhat.com (virtlab417.ml3.eng.bos.redhat.com [10.19.176.175]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A02981B6A; Fri, 5 May 2017 13:57:27 +0000 (UTC) From: Jens Freimann To: yuanhan.liu@linux.intel.com Cc: dev@dpdk.org Date: Fri, 5 May 2017 09:57:18 -0400 Message-Id: <1493992642-52756-8-git-send-email-jfreiman@redhat.com> In-Reply-To: <1493992642-52756-1-git-send-email-jfreiman@redhat.com> References: <1493992642-52756-1-git-send-email-jfreiman@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 05 May 2017 13:57:27 +0000 (UTC) Subject: [dpdk-dev] [RFC PATCH 07/11] vhost: mark desc being used X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 May 2017 13:57:28 -0000 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