DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com, ajit.khaparde@broadcom.com
Subject: [dpdk-dev] [PATCH 2/7] net/bnxt: fix default timeout for ver_get command
Date: Thu,  6 Feb 2020 22:03:09 +0530	[thread overview]
Message-ID: <20200206163314.12755-3-kalesh-anakkur.purayil@broadcom.com> (raw)
In-Reply-To: <20200206163314.12755-1-kalesh-anakkur.purayil@broadcom.com>

From: Rahul Gupta <rahul.gupta@broadcom.com>

Initially when driver is loading, there is no HWRM timeout configured
by FW, the VER_GET command needs use default timeout as 500ms and
while recovering from fatal/non-fatal FW error, it should use timeout
as 50ms.

Fixes: 458f0360e8dc ("net/bnxt: get default HWRM command timeout from FW")
Cc: stable@dpdk.org

Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |  6 ++++--
 drivers/net/bnxt/bnxt_ethdev.c |  4 ++--
 drivers/net/bnxt/bnxt_hwrm.c   | 11 ++++-------
 drivers/net/bnxt/bnxt_hwrm.h   |  2 +-
 4 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 68786a8..e8a30fa 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -606,8 +606,10 @@ struct bnxt {
 	uint16_t			max_resp_len;
 	uint16_t                        hwrm_max_ext_req_len;
 
-	 /* default command timeout value of 50ms */
-#define HWRM_CMD_TIMEOUT		50000
+	 /* default command timeout value of 500ms */
+#define DFLT_HWRM_CMD_TIMEOUT		500000
+	 /* short command timeout value of 50ms */
+#define SHORT_HWRM_CMD_TIMEOUT		50000
 	/* default HWRM request timeout value */
 	uint32_t			hwrm_cmd_timeout;
 
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 5378209..7147cc8 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3998,7 +3998,7 @@ static void bnxt_dev_recover(void *arg)
 	bp->flags &= ~BNXT_FLAG_FATAL_ERROR;
 
 	do {
-		rc = bnxt_hwrm_ver_get(bp);
+		rc = bnxt_hwrm_ver_get(bp, SHORT_HWRM_CMD_TIMEOUT);
 		if (rc == 0)
 			break;
 		rte_delay_ms(BNXT_FW_READY_WAIT_INTERVAL);
@@ -4688,7 +4688,7 @@ static int bnxt_init_fw(struct bnxt *bp)
 
 	bp->fw_cap = 0;
 
-	rc = bnxt_hwrm_ver_get(bp);
+	rc = bnxt_hwrm_ver_get(bp, DFLT_HWRM_CMD_TIMEOUT);
 	if (rc)
 		return rc;
 
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index f325aff..96b3431 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -100,11 +100,7 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 	if (bp->flags & BNXT_FLAG_FATAL_ERROR)
 		return 0;
 
-	/* For VER_GET command, set timeout as 50ms */
-	if (rte_cpu_to_le_16(req->req_type) == HWRM_VER_GET)
-		timeout = HWRM_CMD_TIMEOUT;
-	else
-		timeout = bp->hwrm_cmd_timeout;
+	timeout = bp->hwrm_cmd_timeout;
 
 	if (bp->flags & BNXT_FLAG_SHORT_CMD ||
 	    msg_len > bp->max_req_len) {
@@ -949,7 +945,7 @@ int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp)
 	return rc;
 }
 
-int bnxt_hwrm_ver_get(struct bnxt *bp)
+int bnxt_hwrm_ver_get(struct bnxt *bp, uint32_t timeout)
 {
 	int rc = 0;
 	struct hwrm_ver_get_input req = {.req_type = 0 };
@@ -960,6 +956,7 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
 	uint32_t dev_caps_cfg;
 
 	bp->max_req_len = HWRM_MAX_REQ_LEN;
+	bp->hwrm_cmd_timeout = timeout;
 	HWRM_PREP(req, VER_GET, BNXT_USE_CHIMP_MB);
 
 	req.hwrm_intf_maj = HWRM_VERSION_MAJOR;
@@ -994,7 +991,7 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
 	/* convert timeout to usec */
 	bp->hwrm_cmd_timeout *= 1000;
 	if (!bp->hwrm_cmd_timeout)
-		bp->hwrm_cmd_timeout = HWRM_CMD_TIMEOUT;
+		bp->hwrm_cmd_timeout = DFLT_HWRM_CMD_TIMEOUT;
 
 	if (resp->hwrm_intf_maj_8b != HWRM_VERSION_MAJOR) {
 		PMD_DRV_LOG(ERR, "Unsupported firmware API version\n");
diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h
index d8d1360..2753720 100644
--- a/drivers/net/bnxt/bnxt_hwrm.h
+++ b/drivers/net/bnxt/bnxt_hwrm.h
@@ -120,7 +120,7 @@ int bnxt_hwrm_stat_ctx_free(struct bnxt *bp,
 int bnxt_hwrm_ctx_qstats(struct bnxt *bp, uint32_t cid, int idx,
 			 struct rte_eth_stats *stats, uint8_t rx);
 
-int bnxt_hwrm_ver_get(struct bnxt *bp);
+int bnxt_hwrm_ver_get(struct bnxt *bp, uint32_t timeout);
 
 int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic);
 int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic);
-- 
2.10.1


  parent reply	other threads:[~2020-02-06 16:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06 16:33 [dpdk-dev] [PATCH 0/7] bnxt patchset with bug fixes Kalesh A P
2020-02-06 16:33 ` [dpdk-dev] [PATCH 1/7] net/bnxt: avoid an unnecessary delay in port stop Kalesh A P
2020-02-06 16:33 ` Kalesh A P [this message]
2020-02-06 16:33 ` [dpdk-dev] [PATCH 3/7] net/bnxt: log firmware debug notifications Kalesh A P
2020-02-06 16:33 ` [dpdk-dev] [PATCH 4/7] net/bnxt: register for debug notification async event from fw Kalesh A P
2020-02-06 16:33 ` [dpdk-dev] [PATCH 5/7] net/bnxt: fix to call port stop when error recovery fails Kalesh A P
2020-02-06 16:33 ` [dpdk-dev] [PATCH 6/7] net/bnxt: move locally used functions to static Kalesh A P
2020-02-06 16:33 ` [dpdk-dev] [PATCH 7/7] net/bnxt: fix buffer allocation reattempt logic Kalesh A P
2020-02-06 18:44 ` [dpdk-dev] [PATCH v2 0/7] bnxt patchset with bug fixes Ajit Khaparde
2020-02-06 18:44   ` [dpdk-dev] [PATCH v2 1/7] net/bnxt: fix unnecessary delay in port stop Ajit Khaparde
2020-02-06 18:44   ` [dpdk-dev] [PATCH v2 2/7] net/bnxt: fix default timeout for command to get FW version Ajit Khaparde
2020-02-06 18:44   ` [dpdk-dev] [PATCH v2 3/7] net/bnxt: log firmware debug notifications Ajit Khaparde
2020-02-06 18:44   ` [dpdk-dev] [PATCH v2 4/7] net/bnxt: register for debug notification event from FW Ajit Khaparde
2020-02-06 18:44   ` [dpdk-dev] [PATCH v2 5/7] net/bnxt: fix to call port stop when error recovery fails Ajit Khaparde
2020-02-06 18:44   ` [dpdk-dev] [PATCH v2 6/7] net/bnxt: move locally used functions to static Ajit Khaparde
2020-02-06 18:44   ` [dpdk-dev] [PATCH v2 7/7] net/bnxt: fix buffer allocation reattempt logic Ajit Khaparde
2020-02-06 18:50   ` [dpdk-dev] [PATCH v2 0/7] bnxt patchset with bug fixes Ajit Khaparde

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=20200206163314.12755-3-kalesh-anakkur.purayil@broadcom.com \
    --to=kalesh-anakkur.purayil@broadcom.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.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).