From patchwork Sun Sep 1 22:12:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajit Khaparde X-Patchwork-Id: 58358 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 4F26B1C21B; Mon, 2 Sep 2019 00:17:31 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 365C71C2EB for ; Mon, 2 Sep 2019 00:17:30 +0200 (CEST) Received: from nis-sj1-27.broadcom.com (nis-sj1-27.lvn.broadcom.net [10.75.144.136]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 6744E30D1B5; Sun, 1 Sep 2019 15:17:24 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 6744E30D1B5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1567376244; bh=AnWJtCAfFvj/zEh0lIe3N9FmOzbGDz0AoApFYzlxOBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ge/HBEBgU5gyKU+jr+V1/NkUpHg9nHDvTEjdIh8D4PTIQ/lJhQN/LhYeLwDyCQYuq J1v5cXgbIiPolHEPYuDL1mFKDmEZ+tZ5hHoBF8RC6xPPzDkdeuYc9E/+3b/fNO4P0t qpJJmDi9qWCUJ06oyXyFw2Sd/JZLShI0kdcctmNY= Received: from localhost.localdomain (unknown [10.230.30.225]) by nis-sj1-27.broadcom.com (Postfix) with ESMTP id CC82BAC071D; Sun, 1 Sep 2019 15:17:28 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Kalesh AP , Rahul Gupta Date: Sun, 1 Sep 2019 15:12:20 -0700 Message-Id: <20190901221213.92149-16-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20190901221213.92149-1-ajit.khaparde@broadcom.com> References: <20190901221213.92149-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 15/15] net/bnxt: handle reset notify async event on ns3 devices 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" From: Kalesh AP FW sets HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ERR_RECOVER_RELOAD in HWRM_FUNC_QCAPS command, if device requires to invoke fastboot FW during FW reset. Wait for FW_STATUS to set the SHUTDOWN bit in health register before the master function calls fastboot FW. Signed-off-by: Kalesh AP Reviewed-by: Rahul Gupta Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt.h | 3 +++ drivers/net/bnxt/bnxt_cpr.c | 25 +++++++++++++++++++++++++ drivers/net/bnxt/bnxt_hwrm.c | 5 +++++ drivers/net/bnxt/hsi_struct_def_dpdk.h | 8 ++++++++ 4 files changed, 41 insertions(+) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 7355acd4a..2e662b297 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -409,6 +409,8 @@ struct bnxt_error_recovery_info { #define BNXT_GRCP_WINDOW_2_BASE 0x2000 #define BNXT_GRCP_WINDOW_3_BASE 0x3000 +#define BNXT_FW_STATUS_SHUTDOWN 0x100000 + #define BNXT_HWRM_SHORT_REQ_LEN sizeof(struct hwrm_short_input) struct bnxt { void *bar0; @@ -442,6 +444,7 @@ struct bnxt { #define BNXT_FLAG_EXT_STATS_SUPPORTED BIT(20) #define BNXT_FLAG_NEW_RM BIT(21) #define BNXT_FLAG_INIT_DONE BIT(22) +#define BNXT_FLAG_FW_CAP_ERR_RECOVER_RELOAD BIT(23) #define BNXT_PF(bp) (!((bp)->flags & BNXT_FLAG_VF)) #define BNXT_VF(bp) ((bp)->flags & BNXT_FLAG_VF) #define BNXT_NPAR(bp) ((bp)->port_partition_type) diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c index eb44d872d..de2b13c5d 100644 --- a/drivers/net/bnxt/bnxt_cpr.c +++ b/drivers/net/bnxt/bnxt_cpr.c @@ -5,6 +5,7 @@ #include #include +#include #include "bnxt.h" #include "bnxt_cpr.h" @@ -12,6 +13,29 @@ #include "bnxt_ring.h" #include "hsi_struct_def_dpdk.h" +static void bnxt_handle_fatal_event(struct bnxt *bp) +{ + uint32_t val, timeout; + + /* if HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ERR_RECOVER_RELOAD is set + * in HWRM_FUNC_QCAPS command, wait for FW_STATUS to set + * the SHUTDOWN bit in health register + */ + if (!(bp->recovery_info && + (bp->flags & BNXT_FLAG_FW_CAP_ERR_RECOVER_RELOAD))) + return; + + timeout = bp->fw_reset_min_msecs; + do { + val = bnxt_read_fw_status_reg(bp, BNXT_FW_STATUS_REG); + if (val & BNXT_FW_STATUS_SHUTDOWN) + return; + + rte_delay_ms(100); + timeout -= 100; + } while (timeout); +} + /* * Async event handling */ @@ -57,6 +81,7 @@ void bnxt_handle_async_event(struct bnxt *bp, PMD_DRV_LOG(INFO, "Firmware fatal reset event received\n"); bp->flags |= BNXT_FLAG_FATAL_ERROR; + bnxt_handle_fatal_event(bp); } else { PMD_DRV_LOG(INFO, "Firmware non-fatal reset event received\n"); diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 1541dc3b6..bdc84c831 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -634,6 +634,11 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) bp->flags &= ~BNXT_FLAG_FW_CAP_ERROR_RECOVERY; } + if (flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ERR_RECOVER_RELOAD) + bp->flags |= BNXT_FLAG_FW_CAP_ERR_RECOVER_RELOAD; + else + bp->flags &= ~BNXT_FLAG_FW_CAP_ERR_RECOVER_RELOAD; + HWRM_UNLOCK(); return rc; diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h b/drivers/net/bnxt/hsi_struct_def_dpdk.h index 009571725..54f0c04c0 100644 --- a/drivers/net/bnxt/hsi_struct_def_dpdk.h +++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h @@ -7327,6 +7327,14 @@ struct hwrm_func_qcaps_output { */ #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT_STATS_SUPPORTED \ UINT32_C(0x1000000) + /* + * If the query is for a VF, then this flag shall be ignored. + * If this query is for a PF and this flag is set to 1, then host + * must initiate reset or reload (or fastboot) the firmware image + * upon detection of device shutdown state. + */ + #define HWRM_FUNC_QCAPS_OUTPUT_FLAGS_ERR_RECOVER_RELOAD \ + UINT32_C(0x2000000) /* * This value is current MAC address configured for this * function. A value of 00-00-00-00-00-00 indicates no