From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 84864A04EF for ; Wed, 4 Dec 2019 16:22:25 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5AF571BF7C; Wed, 4 Dec 2019 16:22:25 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 313591BECF; Wed, 4 Dec 2019 16:22:22 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Dec 2019 07:22:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,277,1571727600"; d="scan'208";a="208870111" Received: from dpdk-xiaoyun3.sh.intel.com ([10.67.118.162]) by fmsmga007.fm.intel.com with ESMTP; 04 Dec 2019 07:22:19 -0800 From: Xiaoyun Li To: jingjing.wu@intel.com Cc: dev@dpdk.org, Xiaoyun Li , stable@dpdk.org Date: Wed, 4 Dec 2019 23:19:16 +0800 Message-Id: <20191204151916.12607-1-xiaoyun.li@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-stable] [PATCH] raw/ntb: fix write memory barrier issue X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" All buffers and ring info should be written before tail register update. This patch relocates the write memory barrier before updating tail register to avoid potential issues. Fixes: 11b5c7daf019 ("raw/ntb: add enqueue and dequeue functions") Cc: stable@dpdk.org Signed-off-by: Xiaoyun Li --- drivers/raw/ntb/ntb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c index ad7f6abfd..dd0b72f8c 100644 --- a/drivers/raw/ntb/ntb.c +++ b/drivers/raw/ntb/ntb.c @@ -683,8 +683,8 @@ ntb_enqueue_bufs(struct rte_rawdev *dev, sizeof(struct ntb_used) * nb1); rte_memcpy(txq->tx_used_ring, tx_used + nb1, sizeof(struct ntb_used) * nb2); - *txq->used_cnt = txq->last_used; rte_wmb(); + *txq->used_cnt = txq->last_used; /* update queue stats */ hw->ntb_xstats[NTB_TX_BYTES_ID + off] += bytes; @@ -789,8 +789,8 @@ ntb_dequeue_bufs(struct rte_rawdev *dev, sizeof(struct ntb_desc) * nb1); rte_memcpy(rxq->rx_desc_ring, rx_desc + nb1, sizeof(struct ntb_desc) * nb2); - *rxq->avail_cnt = rxq->last_avail; rte_wmb(); + *rxq->avail_cnt = rxq->last_avail; /* update queue stats */ off = NTB_XSTATS_NUM * ((size_t)context + 1); -- 2.17.1