From patchwork Fri Mar 13 09:18:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Hu X-Patchwork-Id: 66635 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8C475A0567; Fri, 13 Mar 2020 10:20:03 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 051B81C037; Fri, 13 Mar 2020 10:19:56 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 610FE3B5; Fri, 13 Mar 2020 10:19:54 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DBD0D31B; Fri, 13 Mar 2020 02:19:53 -0700 (PDT) Received: from net-arm-thunderx2-04.shanghai.arm.com (net-arm-thunderx2-04.shanghai.arm.com [10.169.40.184]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C78EB3F67D; Fri, 13 Mar 2020 02:19:49 -0700 (PDT) From: Gavin Hu To: dev@dpdk.org Cc: nd@arm.com, david.marchand@redhat.com, thomas@monjalon.net, mk@semihalf.com, gtzalik@amazon.com, evgenys@amazon.com, igorch@amazon.com, mw@semihalf.com, Honnappa.Nagarahalli@arm.com, ruifeng.wang@arm.com, phil.yang@arm.com, joyce.kong@arm.com, stable@dpdk.org Date: Fri, 13 Mar 2020 17:18:30 +0800 Message-Id: <20200313091835.58039-3-gavin.hu@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200313091835.58039-1-gavin.hu@arm.com> References: <20200313091835.58039-1-gavin.hu@arm.com> Subject: [dpdk-dev] [PATCH RFC v1 2/7] net/ena: relax the barrier for doorbell ring 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" rte_cio_wmb is a light weight version of IO memory barrier that guarantees that the stores to the coherent memory prior to the the rte_cio_rmb() call are visible to the NIC HW before the doorbell ring(or any other stores to the MMIO registers) that follows it.[1] Fixes: 5e02e19eb14e ("net/ena: fix unneeded doorbell submission") Cc: stable@dpdk.org [1] http://code.dpdk.org/dpdk/v20.02/source/lib/librte_eal/common/ include/generic/rte_atomic.h#L137 Signed-off-by: Gavin Hu Reviewed-by: Honnappa Nagarahalli --- drivers/net/ena/ena_ethdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 665afee4f..c268788fd 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1425,7 +1425,7 @@ static int ena_populate_rx_queue(struct ena_ring *rxq, unsigned int count) * Add memory barrier to make sure the desc were written before * issue a doorbell */ - rte_wmb(); + rte_cio_wmb(); ena_com_write_sq_doorbell(rxq->ena_com_io_sq); rxq->next_to_use = next_to_use; @@ -2344,7 +2344,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, PMD_DRV_LOG(DEBUG, "llq tx max burst size of queue %d" " achieved, writing doorbell to send burst\n", tx_ring->id); - rte_wmb(); + rte_cio_wmb(); ena_com_write_sq_doorbell(tx_ring->ena_com_io_sq); } @@ -2367,7 +2367,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, /* If there are ready packets to be xmitted... */ if (sent_idx > 0) { /* ...let HW do its best :-) */ - rte_wmb(); + rte_cio_wmb(); ena_com_write_sq_doorbell(tx_ring->ena_com_io_sq); tx_ring->tx_stats.doorbells++; tx_ring->next_to_use = next_to_use;