From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com,
Kalesh AP <kalesh-anakkur.purayil@broadcom.com>,
Rahul Gupta <rahul.gupta@broadcom.com>
Subject: [dpdk-dev] [PATCH 15/15] net/bnxt: handle reset notify async event on ns3 devices
Date: Sun, 1 Sep 2019 15:12:20 -0700 [thread overview]
Message-ID: <20190901221213.92149-16-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20190901221213.92149-1-ajit.khaparde@broadcom.com>
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
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 <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
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 <rte_malloc.h>
#include <rte_alarm.h>
+#include <rte_cycles.h>
#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
--
2.20.1 (Apple Git-117)
prev parent reply other threads:[~2019-09-01 22:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-01 22:12 [dpdk-dev] [PATCH 00/15] bnxt patchset Ajit Khaparde
2019-09-01 22:12 ` [dpdk-dev] [PATCH 01/15] net/bnxt: fix incorrect flow steering Ajit Khaparde
2019-09-01 22:12 ` [dpdk-dev] [PATCH 02/15] net/bnxt: fix traffic failure with higher mbuf size Ajit Khaparde
2019-09-01 22:12 ` [dpdk-dev] [PATCH 03/15] net/bnxt: fix rxq stop/start handling Ajit Khaparde
2019-09-01 22:12 ` [dpdk-dev] [PATCH 04/15] net/bnxt: subscribe to link speed change notification Ajit Khaparde
2019-09-01 22:12 ` [dpdk-dev] [PATCH 05/15] net/bnxt: fix async link handling and update Ajit Khaparde
2019-09-01 22:12 ` [dpdk-dev] [PATCH 06/15] net/bnxt: fix 40G link failure for Thor Ajit Khaparde
2019-09-01 22:12 ` [dpdk-dev] [PATCH 07/15] net/bnxt: fix L2 context calculation " Ajit Khaparde
2019-09-01 22:12 ` [dpdk-dev] [PATCH 08/15] net/bnxt: fix use of deferred start of transmit queues Ajit Khaparde
2019-09-01 22:12 ` [dpdk-dev] [PATCH 09/15] net/bnxt: remove unnecessary return check Ajit Khaparde
2019-09-01 22:12 ` [dpdk-dev] [PATCH 10/15] net/bnxt: remove unused macro Ajit Khaparde
2019-09-01 22:12 ` [dpdk-dev] [PATCH 11/15] net/bnxt: remove unnecessary interrupt disable Ajit Khaparde
2019-09-01 22:12 ` [dpdk-dev] [PATCH 12/15] net/bnxt: fix accessing variable before null check Ajit Khaparde
2019-09-01 22:12 ` [dpdk-dev] [PATCH 13/15] net/bnxt: fix Rx queue count devop Ajit Khaparde
2019-09-01 22:12 ` [dpdk-dev] [PATCH 14/15] net/bnxt: fix mbuf flags for PTP packets in vector mode Rx Ajit Khaparde
2019-09-01 22:12 ` Ajit Khaparde [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190901221213.92149-16-ajit.khaparde@broadcom.com \
--to=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=kalesh-anakkur.purayil@broadcom.com \
--cc=rahul.gupta@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).