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 C2E4DA2EFC for ; Mon, 16 Sep 2019 13:27:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 787281C0D7; Mon, 16 Sep 2019 13:27:51 +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-stable] [PATCH v2 5/5] net/bnxt: enforce io barrier for doorbell command 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" 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 --- 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++) { -- 2.7.4