From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 7A823A04B3;
	Sat,  8 Feb 2020 14:52:36 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id B13DE1BFDD;
	Sat,  8 Feb 2020 14:52:35 +0100 (CET)
Received: from foss.arm.com (foss.arm.com [217.140.110.172])
 by dpdk.org (Postfix) with ESMTP id 216141BFB1
 for <dev@dpdk.org>; Sat,  8 Feb 2020 14:52:33 +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 3EFD31FB;
 Sat,  8 Feb 2020 05:52:33 -0800 (PST)
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 43AB93F6CF;
 Sat,  8 Feb 2020 05:52:28 -0800 (PST)
From: Gavin Hu <gavin.hu@arm.com>
To: dev@dpdk.org
Cc: nd@arm.com, david.marchand@redhat.com, thomas@monjalon.net,
 rasland@mellanox.com, maxime.coquelin@redhat.com, tiwei.bie@intel.com,
 matan@mellanox.com, shahafs@mellanox.com, viacheslavo@mellanox.com,
 arybchenko@solarflare.com, stephen@networkplumber.org,
 hemant.agrawal@nxp.com, jerinj@marvell.com, pbhagavatula@marvell.com,
 Honnappa.Nagarahalli@arm.com, ruifeng.wang@arm.com, phil.yang@arm.com,
 joyce.kong@arm.com, steve.capper@arm.com
Date: Sat,  8 Feb 2020 21:48:08 +0800
Message-Id: <20200208134808.212027-1-gavin.hu@arm.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <1571758074-16445-1-git-send-email-gavin.hu@arm.com>
References: <1571758074-16445-1-git-send-email-gavin.hu@arm.com>
Subject: [dpdk-dev] [PATCH v3] net/i40e: relaxed barrier in the tx fastpath
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

To keep ordering of mixed accesses, rte_cio is sufficient.
The rte_io barrier is overkill.[1]

[1] http://inbox.dpdk.org/dev/CALBAE1M-ezVWCjqCZDBw+MMDEC4O9
qf0Kpn89EMdGDajepKoZQ@mail.gmail.com

Signed-off-by: Gavin Hu <gavin.hu@arm.com>
---
V3:
- optimize the barriers in the fast path only, leave as it is for the
  barriers in the slow path and control path <jerin>
- drop the virtio patches from the list as they are in the control path
- it makes more sense to relax the barrier in the fast path, at the PMD level.
  relaxing the fundamental rte_io_x barriers APIs requires scrutinizations for
  each PMDs which use the barriers directly or indirectly.
V2:
- remove virtio_pci_read/write64 APIs definitions, they are not needed and generate compiling errors like " error: unused function 'virtio_pci_write64' [-Werror,-Wunused-function]"
- update the reference link to kernel source code
---
 drivers/net/i40e/i40e_rxtx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index fd1ae80da..8c0f7cc67 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -1248,7 +1248,8 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
 		   (unsigned) txq->port_id, (unsigned) txq->queue_id,
 		   (unsigned) tx_id, (unsigned) nb_tx);
 
-	I40E_PCI_REG_WRITE(txq->qtx_tail, tx_id);
+	rte_cio_wmb();
+	I40E_PCI_REG_WRITE_RELAXED(txq->qtx_tail, tx_id);
 	txq->tx_tail = tx_id;
 
 	return nb_tx;
-- 
2.17.1