patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Somnath Kotur <somnath.kotur@broadcom.com>
To: stable@dpdk.org
Cc: ktraynor@redhat.com
Subject: [dpdk-stable] [PATCH 18.11 13/19] net/bnxt: get default HWRM command timeout from FW
Date: Wed, 18 Dec 2019 11:54:05 +0530
Message-ID: <20191218062411.13079-14-somnath.kotur@broadcom.com> (raw)
In-Reply-To: <20191218062411.13079-1-somnath.kotur@broadcom.com>

From: Ajit Khaparde <ajit.khaparde@broadcom.com>

The HWRM command timeout is set to a very high value.
VER_GET command response returns the default request timeout value.
Use this value for waiting for HWRM commands to complete.

Fixes: cbcd375d37d2 ("net/bnxt: fix HWRM macros and locking")

Signed-off-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
---
 drivers/net/bnxt/bnxt.h      |  5 +++++
 drivers/net/bnxt/bnxt_hwrm.c | 19 ++++++++++++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 77d5614..20eacc7 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -369,6 +369,11 @@ struct bnxt {
 	uint16_t			max_req_len;
 	uint16_t			max_resp_len;
 
+	/* default command timeout value of 50ms */
+#define HWRM_CMD_TIMEOUT	50000
+	/* default HWRM request timeout value */
+	uint32_t		hwrm_cmd_timeout;
+
 	struct bnxt_link_info	link_info;
 	struct bnxt_cos_queue_info	cos_queue[BNXT_COS_QUEUE_COUNT];
 	uint8_t			tx_cosq_id;
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 6ddd226..68c70b7 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -25,7 +25,6 @@
 #include "bnxt_vnic.h"
 #include "hsi_struct_def_dpdk.h"
 
-#define HWRM_CMD_TIMEOUT		6000000
 #define HWRM_SPEC_CODE_1_8_3		0x10803
 #define HWRM_VERSION_1_9_1		0x10901
 
@@ -83,6 +82,13 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 		GRCPF_REG_KONG_CHANNEL_OFFSET : GRCPF_REG_CHIMP_CHANNEL_OFFSET;
 	uint16_t mb_trigger_offset = use_kong_mb ?
 		GRCPF_REG_KONG_COMM_TRIGGER : GRCPF_REG_CHIMP_COMM_TRIGGER;
+	uint32_t timeout;
+
+	/* 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;
 
 	if (bp->flags & BNXT_FLAG_SHORT_CMD) {
 		void *short_cmd_req = bp->hwrm_short_cmd_req_addr;
@@ -127,7 +133,7 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 	rte_io_mb();
 
 	/* Poll for the valid bit */
-	for (i = 0; i < HWRM_CMD_TIMEOUT; i++) {
+	for (i = 0; i < timeout; i++) {
 		/* Sanity check on the resp->resp_len */
 		rte_cio_rmb();
 		if (resp->resp_len && resp->resp_len <=
@@ -140,7 +146,7 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 		rte_delay_us(1);
 	}
 
-	if (i >= HWRM_CMD_TIMEOUT) {
+	if (i >= timeout) {
 		PMD_DRV_LOG(ERR, "Error(timeout) sending msg 0x%04x\n",
 			    req->req_type);
 		return -ETIMEDOUT;
@@ -832,6 +838,13 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
 	fw_version |= resp->hwrm_intf_upd_8b;
 	bp->hwrm_spec_code = fw_version;
 
+	/* def_req_timeout value is in milliseconds */
+	bp->hwrm_cmd_timeout = rte_le_to_cpu_16(resp->def_req_timeout);
+	/* convert timeout to usec */
+	bp->hwrm_cmd_timeout *= 1000;
+	if (!bp->hwrm_cmd_timeout)
+		bp->hwrm_cmd_timeout = HWRM_CMD_TIMEOUT;
+
 	if (resp->hwrm_intf_maj_8b != HWRM_VERSION_MAJOR) {
 		PMD_DRV_LOG(ERR, "Unsupported firmware API version\n");
 		rc = -EINVAL;
-- 
2.10.1


  parent reply	other threads:[~2019-12-18  6:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-18  6:23 [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Somnath Kotur
2019-12-18  6:23 ` [dpdk-stable] [PATCH 18.11 01/19] net/bnxt: fix setting default MAC address Somnath Kotur
2019-12-18  6:23 ` [dpdk-stable] [PATCH 18.11 02/19] net/bnxt: fix error checking of FW commands Somnath Kotur
2019-12-18  6:23 ` [dpdk-stable] [PATCH 18.11 03/19] net/bnxt: fix check of address mapping Somnath Kotur
2019-12-18  6:23 ` [dpdk-stable] [PATCH 18.11 04/19] net/bnxt: fix stats errors handling Somnath Kotur
2019-12-18  6:23 ` [dpdk-stable] [PATCH 18.11 05/19] net/bnxt: move macro definitions to header file Somnath Kotur
2019-12-18  6:23 ` [dpdk-stable] [PATCH 18.11 06/19] net/bnxt: fix extended port counter statistics Somnath Kotur
2019-12-18  6:23 ` [dpdk-stable] [PATCH 18.11 07/19] net/bnxt: fix VF probe when MAC address is zero Somnath Kotur
2019-12-18  6:24 ` [dpdk-stable] [PATCH 18.11 08/19] net/bnxt: fix coding style Somnath Kotur
2019-12-18  6:24 ` [dpdk-stable] [PATCH 18.11 09/19] net/bnxt: fix async link handling and update Somnath Kotur
2019-12-18  6:24 ` [dpdk-stable] [PATCH 18.11 10/19] net/bnxt: fix flow flush handling Somnath Kotur
2019-12-18  6:24 ` [dpdk-stable] [PATCH 18.11 11/19] net/bnxt: update trusted VF status only when it changes Somnath Kotur
2019-12-18  6:24 ` [dpdk-stable] [PATCH 18.11 12/19] net/bnxt: fix doorbell register offset for Tx ring Somnath Kotur
2019-12-18  6:24 ` Somnath Kotur [this message]
2019-12-18  6:24 ` [dpdk-stable] [PATCH 18.11 14/19] net/bnxt: fix MAC/VLAN filter allocation Somnath Kotur
2019-12-18  6:24 ` [dpdk-stable] [PATCH 18.11 15/19] net/bnxt: fix forwarding with higher mbuf size Somnath Kotur
2019-12-18  6:24 ` [dpdk-stable] [PATCH 18.11 16/19] net/bnxt: fix crash after removing and adding slaves Somnath Kotur
2019-12-18  6:24 ` [dpdk-stable] [PATCH 18.11 17/19] net/bnxt: fix Rx queue count Somnath Kotur
2019-12-18  6:24 ` [dpdk-stable] [PATCH 18.11 18/19] net/bnxt: fix deferred start of Tx queues Somnath Kotur
2019-12-18 10:21   ` Kevin Traynor
2019-12-18  6:24 ` [dpdk-stable] [PATCH 18.11 19/19] net/bnxt: fix rx queue start/stop Somnath Kotur
2019-12-18 11:22 ` [dpdk-stable] [PATCH 18.11 00/19] bnxt patchset for 18.11 Kevin Traynor

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=20191218062411.13079-14-somnath.kotur@broadcom.com \
    --to=somnath.kotur@broadcom.com \
    --cc=ktraynor@redhat.com \
    --cc=stable@dpdk.org \
    /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

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git