From patchwork Mon Sep 16 11:27:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Hu X-Patchwork-Id: 59277 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D41951C0AF; Mon, 16 Sep 2019 13:27:36 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 7DE001C0AD for ; Mon, 16 Sep 2019 13:27:32 +0200 (CEST) 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 8C6391570; Mon, 16 Sep 2019 04:27:31 -0700 (PDT) Received: from net-arm-thunderx2-01.test.ast.arm.com (net-arm-thunderx2-01.shanghai.arm.com [10.169.40.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6304A3F59C; Mon, 16 Sep 2019 04:27:29 -0700 (PDT) From: Gavin Hu To: dev@dpdk.org Cc: nd@arm.com, thomas@monjalon.net, bruce.richardson@intel.com, yong.liu@intel.com, yinan.wang@intel.com, ajit.khaparde@broadcom.com, somnath.kotur@broadcom.com, Honnappa.Nagarahalli@arm.com, ruifeng.wang@arm.com, steve.capper@arm.com Date: Mon, 16 Sep 2019 19:27:14 +0800 Message-Id: <1568633238-47888-2-git-send-email-gavin.hu@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568633238-47888-1-git-send-email-gavin.hu@arm.com> References: <1568633238-47888-1-git-send-email-gavin.hu@arm.com> In-Reply-To: <1567751873-15964-1-git-send-email-gavin.hu@arm.com> References: <1567751873-15964-1-git-send-email-gavin.hu@arm.com> Subject: [dpdk-dev] [PATCH v2 1/5] net/i40e: use relaxed and remove duplicate barrier 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" To guarantee the orderings of successive stores to CIO and MMIO memory, a lighter weight rte_io_wmb [1] can be used instead of rte_wmb, and since the I40E_PCI_REG_WRITE API already has an inclusive rte_io_wmb, this explicit call can be even saved. [1] http://git.dpdk.org/dpdk/tree/lib/librte_eal/common/include/generic/ rte_atomic.h#n98 Signed-off-by: Gavin Hu Acked-by: Qi Zhang --- drivers/net/i40e/i40e_rxtx.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 692c3ba..bfe161f 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -564,8 +564,7 @@ i40e_rx_alloc_bufs(struct i40e_rx_queue *rxq) } /* Update rx tail regsiter */ - rte_wmb(); - I40E_PCI_REG_WRITE_RELAXED(rxq->qrx_tail, rxq->rx_free_trigger); + I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->rx_free_trigger); rxq->rx_free_trigger = (uint16_t)(rxq->rx_free_trigger + rxq->rx_free_thresh); @@ -1208,13 +1207,11 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) } end_of_tx: - rte_wmb(); - PMD_TX_LOG(DEBUG, "port_id=%u queue_id=%u tx_tail=%u nb_tx=%u", (unsigned) txq->port_id, (unsigned) txq->queue_id, (unsigned) tx_id, (unsigned) nb_tx); - I40E_PCI_REG_WRITE_RELAXED(txq->qtx_tail, tx_id); + I40E_PCI_REG_WRITE(txq->qtx_tail, tx_id); txq->tx_tail = tx_id; return nb_tx; @@ -1365,8 +1362,7 @@ tx_xmit_pkts(struct i40e_tx_queue *txq, txq->tx_tail = 0; /* Update the tx tail register */ - rte_wmb(); - I40E_PCI_REG_WRITE_RELAXED(txq->qtx_tail, txq->tx_tail); + I40E_PCI_REG_WRITE(txq->qtx_tail, txq->tx_tail); return nb_pkts; } @@ -1544,8 +1540,6 @@ i40e_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) return err; } - rte_wmb(); - /* Init the RX tail regieter. */ I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1); From patchwork Mon Sep 16 11:27:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Hu X-Patchwork-Id: 59278 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2FB7C1C0B7; Mon, 16 Sep 2019 13:27:39 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 0D60E1C0AF for ; Mon, 16 Sep 2019 13:27:35 +0200 (CEST) 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 12A591000; Mon, 16 Sep 2019 04:27:34 -0700 (PDT) Received: from net-arm-thunderx2-01.test.ast.arm.com (net-arm-thunderx2-01.shanghai.arm.com [10.169.40.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DC8D03F59C; Mon, 16 Sep 2019 04:27:31 -0700 (PDT) From: Gavin Hu To: dev@dpdk.org Cc: nd@arm.com, thomas@monjalon.net, bruce.richardson@intel.com, yong.liu@intel.com, yinan.wang@intel.com, ajit.khaparde@broadcom.com, somnath.kotur@broadcom.com, Honnappa.Nagarahalli@arm.com, ruifeng.wang@arm.com, steve.capper@arm.com Date: Mon, 16 Sep 2019 19:27:15 +0800 Message-Id: <1568633238-47888-3-git-send-email-gavin.hu@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568633238-47888-1-git-send-email-gavin.hu@arm.com> References: <1568633238-47888-1-git-send-email-gavin.hu@arm.com> In-Reply-To: <1567751873-15964-1-git-send-email-gavin.hu@arm.com> References: <1567751873-15964-1-git-send-email-gavin.hu@arm.com> Subject: [dpdk-dev] [PATCH v2 2/5] net/ice: use relaxed and remove duplicate barrier 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" To guarantee the orderings of successive stores to CIO and MMIO memory, a lighter weight rte_io_wmb [1] can be used instead of rte_wmb, and since the ICE_PCI_REG_WRITE API already has an inclusive rte_io_wmb, this explicit call can even be saved. [1] http://git.dpdk.org/dpdk/tree/lib/librte_eal/common/include/generic/ rte_atomic.h#n98 Signed-off-by: Gavin Hu Acked-by: Qi Zhang --- drivers/net/ice/ice_rxtx.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 81af814..2366119 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -363,8 +363,6 @@ ice_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) return -ENOMEM; } - rte_wmb(); - /* Init the RX tail register. */ ICE_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1); @@ -1212,7 +1210,6 @@ ice_rx_alloc_bufs(struct ice_rx_queue *rxq) } /* Update rx tail regsiter */ - rte_wmb(); ICE_PCI_REG_WRITE(rxq->qrx_tail, rxq->rx_free_trigger); rxq->rx_free_trigger = @@ -2132,8 +2129,6 @@ ice_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) ICE_TXD_QW1_CMD_S); } end_of_tx: - rte_wmb(); - /* update Tail register */ ICE_PCI_REG_WRITE(txq->qtx_tail, tx_id); txq->tx_tail = tx_id; @@ -2289,7 +2284,6 @@ tx_xmit_pkts(struct ice_tx_queue *txq, txq->tx_tail = 0; /* Update the tx tail register */ - rte_wmb(); ICE_PCI_REG_WRITE(txq->qtx_tail, txq->tx_tail); return nb_pkts; From patchwork Mon Sep 16 11:27:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Hu X-Patchwork-Id: 59279 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5143C1C0C1; Mon, 16 Sep 2019 13:27:43 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id 4D03F1C0B4; Mon, 16 Sep 2019 13:27:38 +0200 (CEST) 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 BE8D61000; Mon, 16 Sep 2019 04:27:36 -0700 (PDT) Received: from net-arm-thunderx2-01.test.ast.arm.com (net-arm-thunderx2-01.shanghai.arm.com [10.169.40.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 638D33F59C; Mon, 16 Sep 2019 04:27:34 -0700 (PDT) From: Gavin Hu To: dev@dpdk.org Cc: nd@arm.com, thomas@monjalon.net, bruce.richardson@intel.com, yong.liu@intel.com, yinan.wang@intel.com, ajit.khaparde@broadcom.com, somnath.kotur@broadcom.com, Honnappa.Nagarahalli@arm.com, ruifeng.wang@arm.com, steve.capper@arm.com, stable@dpdk.org Date: Mon, 16 Sep 2019 19:27:16 +0800 Message-Id: <1568633238-47888-4-git-send-email-gavin.hu@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568633238-47888-1-git-send-email-gavin.hu@arm.com> References: <1568633238-47888-1-git-send-email-gavin.hu@arm.com> In-Reply-To: <1567751873-15964-1-git-send-email-gavin.hu@arm.com> References: <1567751873-15964-1-git-send-email-gavin.hu@arm.com> Subject: [dpdk-dev] [PATCH v2 3/5] net/bnxt: remove duplicate barrier 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" As there is an inclusive rte_io_wmb within the following rte_write32() API who rings the doorbell, this makes the above rte_wmb unnecessary and remove it. Fixes: 1cd45aeb3270 ("net/bnxt: support Stratus VF device") Cc: stable@dpdk.org Signed-off-by: Gavin Hu Reviewed-by: Steve Capper Reviewed-by: Ruifeng Wang Reviewed-by: Phil Yang Acked-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_hwrm.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 9883fb5..1d9fb17 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -115,9 +115,6 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg, data = (uint32_t *)&short_input; msg_len = sizeof(short_input); - /* Sync memory write before updating doorbell */ - rte_wmb(); - max_req_len = BNXT_HWRM_SHORT_REQ_LEN; } From patchwork Mon Sep 16 11:27:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Hu X-Patchwork-Id: 59280 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2050E1C0CE; Mon, 16 Sep 2019 13:27:46 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id EE42A1C08E; Mon, 16 Sep 2019 13:27:39 +0200 (CEST) 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 743E01000; Mon, 16 Sep 2019 04:27:39 -0700 (PDT) Received: from net-arm-thunderx2-01.test.ast.arm.com (net-arm-thunderx2-01.shanghai.arm.com [10.169.40.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1ABB73F59C; Mon, 16 Sep 2019 04:27:36 -0700 (PDT) From: Gavin Hu To: dev@dpdk.org Cc: nd@arm.com, thomas@monjalon.net, bruce.richardson@intel.com, yong.liu@intel.com, yinan.wang@intel.com, ajit.khaparde@broadcom.com, somnath.kotur@broadcom.com, Honnappa.Nagarahalli@arm.com, ruifeng.wang@arm.com, steve.capper@arm.com, stable@dpdk.org Date: Mon, 16 Sep 2019 19:27:17 +0800 Message-Id: <1568633238-47888-5-git-send-email-gavin.hu@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568633238-47888-1-git-send-email-gavin.hu@arm.com> References: <1568633238-47888-1-git-send-email-gavin.hu@arm.com> In-Reply-To: <1567751873-15964-1-git-send-email-gavin.hu@arm.com> References: <1567751873-15964-1-git-send-email-gavin.hu@arm.com> Subject: [dpdk-dev] [PATCH v2 4/5] net/bnxt: replace with cio barrier for doorbell resp 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" To read the doorbell response, which is held in the host CIO memory, rte_cio_rmb is sufficient. Fixes: 804e746c7b73 ("net/bnxt: add hardware resource manager init code") Cc: stable@dpdk.org Signed-off-by: Gavin Hu Acked-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_hwrm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 1d9fb17..2d5dc00 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -138,7 +138,7 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg, /* Poll for the valid bit */ for (i = 0; i < HWRM_CMD_TIMEOUT; i++) { /* Sanity check on the resp->resp_len */ - rte_rmb(); + rte_cio_rmb(); if (resp->resp_len && resp->resp_len <= bp->max_resp_len) { /* Last byte of resp contains the valid key */ valid = (uint8_t *)resp + resp->resp_len - 1; From patchwork Mon Sep 16 11:27:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Hu X-Patchwork-Id: 59281 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 696AB1C0D4; Mon, 16 Sep 2019 13:27:48 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by dpdk.org (Postfix) with ESMTP id B2EF71C0BF; Mon, 16 Sep 2019 13:27:42 +0200 (CEST) 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 4E3C31000; Mon, 16 Sep 2019 04:27:42 -0700 (PDT) Received: from net-arm-thunderx2-01.test.ast.arm.com (net-arm-thunderx2-01.shanghai.arm.com [10.169.40.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C49B73F59C; Mon, 16 Sep 2019 04:27:39 -0700 (PDT) From: Gavin Hu To: dev@dpdk.org Cc: nd@arm.com, thomas@monjalon.net, bruce.richardson@intel.com, yong.liu@intel.com, yinan.wang@intel.com, ajit.khaparde@broadcom.com, somnath.kotur@broadcom.com, Honnappa.Nagarahalli@arm.com, ruifeng.wang@arm.com, steve.capper@arm.com, stable@dpdk.org Date: Mon, 16 Sep 2019 19:27:18 +0800 Message-Id: <1568633238-47888-6-git-send-email-gavin.hu@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1568633238-47888-1-git-send-email-gavin.hu@arm.com> References: <1568633238-47888-1-git-send-email-gavin.hu@arm.com> In-Reply-To: <1567751873-15964-1-git-send-email-gavin.hu@arm.com> References: <1567751873-15964-1-git-send-email-gavin.hu@arm.com> Subject: [dpdk-dev] [PATCH v2 5/5] net/bnxt: enforce io barrier for doorbell command 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" The doorbell ringing operation requires a rte_io_mb immediately to make the command complete and visible to the device before reading the response, otherwise it may read stale or invalid responses. Fixes: ca241d9a0952 ("net/bnxt: use I/O device memory read/write API") Cc: stable@dpdk.org Signed-off-by: Gavin Hu Acked-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_hwrm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 2d5dc00..7d192e3 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -134,6 +134,12 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg, /* Ring channel doorbell */ bar = (uint8_t *)bp->bar0 + mb_trigger_offset; rte_write32(1, bar); + /* + * Make sure the channel doorbell ring command complete before + * reading the response to avoid getting stale or invalid + * responses. + */ + rte_io_mb(); /* Poll for the valid bit */ for (i = 0; i < HWRM_CMD_TIMEOUT; i++) {