From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next 06/10] bnxt_en: Use firmware provided message timeout value.
Date: Thu, 25 Feb 2016 03:19:30 -0500 [thread overview]
Message-ID: <1456388374-1440-7-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1456388374-1440-1-git-send-email-michael.chan@broadcom.com>
Before this patch, we used a hardcoded value of 500 msec as the default
value for firmware message response timeout. For better portability with
future hardware or debug platforms, use the value provided by firmware in
the first response and store it for all susequent messages. Redefine the
macro HWRM_CMD_TIMEOUT to the stored value. Since we don't have the
value yet in the first message, use the 500 ms default if the stored value
is zero.
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 7 +++++++
drivers/net/ethernet/broadcom/bnxt/bnxt.h | 4 +++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index f38a2d2..18aec8e 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -2638,6 +2638,9 @@ int _hwrm_send_message(struct bnxt *bp, void *msg, u32 msg_len, int timeout)
/* Ring channel doorbell */
writel(1, bp->bar0 + 0x100);
+ if (!timeout)
+ timeout = DFLT_HWRM_CMD_TIMEOUT;
+
i = 0;
if (intr_process) {
/* Wait until hwrm response cmpl interrupt is processed */
@@ -3809,6 +3812,10 @@ static int bnxt_hwrm_ver_get(struct bnxt *bp)
resp->hwrm_fw_maj, resp->hwrm_fw_min, resp->hwrm_fw_bld,
resp->hwrm_intf_maj, resp->hwrm_intf_min, resp->hwrm_intf_upd);
+ bp->hwrm_cmd_timeout = le16_to_cpu(resp->def_req_timeout);
+ if (!bp->hwrm_cmd_timeout)
+ bp->hwrm_cmd_timeout = DFLT_HWRM_CMD_TIMEOUT;
+
hwrm_ver_get_exit:
mutex_unlock(&bp->hwrm_cmd_lock);
return rc;
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index ba67c4a..a3d4940 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -477,7 +477,8 @@ struct rx_tpa_end_cmp_ext {
#define RING_CMP(idx) ((idx) & bp->cp_ring_mask)
#define NEXT_CMP(idx) RING_CMP(ADV_RAW_CMP(idx, 1))
-#define HWRM_CMD_TIMEOUT 500
+#define DFLT_HWRM_CMD_TIMEOUT 500
+#define HWRM_CMD_TIMEOUT (bp->hwrm_cmd_timeout)
#define HWRM_RESET_TIMEOUT ((HWRM_CMD_TIMEOUT) * 4)
#define HWRM_RESP_ERR_CODE_MASK 0xffff
#define HWRM_RESP_LEN_MASK 0xffff0000
@@ -957,6 +958,7 @@ struct bnxt {
void *hwrm_dbg_resp_addr;
dma_addr_t hwrm_dbg_resp_dma_addr;
#define HWRM_DBG_REG_BUF_SIZE 128
+ int hwrm_cmd_timeout;
struct mutex hwrm_cmd_lock; /* serialize hwrm messages */
struct hwrm_ver_get_output ver_resp;
#define FW_VER_STR_LEN 32
--
1.8.3.1
next prev parent reply other threads:[~2016-02-25 8:19 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-25 8:19 [PATCH net-next 00/10] bnxt_en: updates for net-next Michael Chan
2016-02-25 8:19 ` [PATCH net-next 01/10] bnxt_en: Improve bnxt_vf_update_mac() Michael Chan
2016-02-25 16:31 ` David Miller
2016-02-25 16:57 ` Michael Chan
2016-02-25 17:09 ` David Miller
2016-02-25 17:15 ` Michael Chan
2016-02-25 19:02 ` David Miller
2016-02-25 8:19 ` [PATCH net-next 02/10] bnxt_en: Send PF driver unload notification to all VFs Michael Chan
2016-02-25 8:19 ` [PATCH net-next 03/10] bnxt_en: Store irq coalescing timer values in micro seconds Michael Chan
2016-02-25 8:19 ` [PATCH net-next 04/10] bnxt_en: Refactor bnxt_hwrm_set_coal() Michael Chan
2016-02-25 16:32 ` David Miller
2016-02-25 8:19 ` [PATCH net-next 05/10] bnxt_en: Add coalescing support for tx rings Michael Chan
2016-02-25 8:19 ` Michael Chan [this message]
2016-02-25 8:19 ` [PATCH net-next 07/10] bnxt_en: Fix dmesg log firmware error messages Michael Chan
2016-02-25 8:19 ` [PATCH net-next 08/10] bnxt_en: Add installed-package firmware version reporting via Ethtool GDRVINFO Michael Chan
2016-02-25 8:19 ` [PATCH net-next 09/10] bnxt_en: Refactor _hwrm_send_message() Michael Chan
2016-02-25 8:19 ` [PATCH net-next 10/10] bnxt_en: Add hwrm_send_message_silent() Michael Chan
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=1456388374-1440-7-git-send-email-michael.chan@broadcom.com \
--to=michael.chan@broadcom.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.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
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).