From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, kuba@kernel.org, edwin.peer@broadcom.com,
gospo@broadcom.com
Subject: [PATCH net-next 02/11] bnxt_en: Refactor the HWRM_VER_GET firmware calls
Date: Sat, 28 Aug 2021 17:58:21 -0400 [thread overview]
Message-ID: <1630187910-22252-3-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1630187910-22252-1-git-send-email-michael.chan@broadcom.com>
[-- Attachment #1: Type: text/plain, Size: 2778 bytes --]
From: Edwin Peer <edwin.peer@broadcom.com>
Refactor the code so that __bnxt_hwrm_ver_get() does not call
bnxt_hwrm_do_send_msg() directly. The new APIs will not expose this
internal call. Add a new bnxt_hwrm_poll() to poll the HWRM_VER_GET
firmware call silently. The other bnxt_hwrm_ver_get() function will
send the HWRM_VER_GET message directly with error logs enabled.
Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index fb75fa9614c5..dd2f80c394f5 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -8036,7 +8036,7 @@ static int bnxt_hwrm_queue_qportcfg(struct bnxt *bp)
return rc;
}
-static int __bnxt_hwrm_ver_get(struct bnxt *bp, bool silent)
+static int bnxt_hwrm_poll(struct bnxt *bp)
{
struct hwrm_ver_get_input req = {0};
int rc;
@@ -8046,21 +8046,26 @@ static int __bnxt_hwrm_ver_get(struct bnxt *bp, bool silent)
req.hwrm_intf_min = HWRM_VERSION_MINOR;
req.hwrm_intf_upd = HWRM_VERSION_UPDATE;
- rc = bnxt_hwrm_do_send_msg(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT,
- silent);
+ rc = _hwrm_send_message_silent(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
return rc;
}
static int bnxt_hwrm_ver_get(struct bnxt *bp)
{
struct hwrm_ver_get_output *resp = bp->hwrm_cmd_resp_addr;
+ struct hwrm_ver_get_input req = {0};
u16 fw_maj, fw_min, fw_bld, fw_rsv;
u32 dev_caps_cfg, hwrm_ver;
int rc, len;
+ bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_VER_GET, -1, -1);
bp->hwrm_max_req_len = HWRM_MAX_REQ_LEN;
+ req.hwrm_intf_maj = HWRM_VERSION_MAJOR;
+ req.hwrm_intf_min = HWRM_VERSION_MINOR;
+ req.hwrm_intf_upd = HWRM_VERSION_UPDATE;
+
mutex_lock(&bp->hwrm_cmd_lock);
- rc = __bnxt_hwrm_ver_get(bp, false);
+ rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
if (rc)
goto hwrm_ver_get_exit;
@@ -9791,7 +9796,7 @@ static int bnxt_try_recover_fw(struct bnxt *bp)
mutex_lock(&bp->hwrm_cmd_lock);
do {
sts = bnxt_fw_health_readl(bp, BNXT_FW_HEALTH_REG);
- rc = __bnxt_hwrm_ver_get(bp, true);
+ rc = bnxt_hwrm_poll(bp);
if (!BNXT_FW_IS_BOOTING(sts) &&
!BNXT_FW_IS_RECOVERING(sts))
break;
@@ -12234,7 +12239,7 @@ static void bnxt_fw_reset_task(struct work_struct *work)
fallthrough;
case BNXT_FW_RESET_STATE_POLL_FW:
bp->hwrm_cmd_timeout = SHORT_HWRM_CMD_TIMEOUT;
- rc = __bnxt_hwrm_ver_get(bp, true);
+ rc = bnxt_hwrm_poll(bp);
if (rc) {
if (bnxt_fw_reset_timeout(bp)) {
netdev_err(bp->dev, "Firmware reset aborted\n");
--
2.18.1
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]
next prev parent reply other threads:[~2021-08-28 21:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-28 21:58 [PATCH net-next 00/11] bnxt_en: Implement new driver APIs to send FW messages Michael Chan
2021-08-28 21:58 ` [PATCH net-next 01/11] bnxt_en: remove DMA mapping for KONG response Michael Chan
2021-08-28 21:58 ` Michael Chan [this message]
2021-08-28 21:58 ` [PATCH net-next 03/11] bnxt_en: move HWRM API implementation into separate file Michael Chan
2021-08-28 21:58 ` [PATCH net-next 04/11] bnxt_en: introduce new firmware message API based on DMA pools Michael Chan
2021-08-29 0:13 ` kernel test robot
2021-08-28 21:58 ` [PATCH net-next 05/11] bnxt_en: discard out of sequence HWRM responses Michael Chan
2021-08-28 21:58 ` [PATCH net-next 06/11] bnxt_en: add HWRM request assignment API Michael Chan
2021-08-28 21:58 ` [PATCH net-next 07/11] bnxt_en: add support for HWRM request slices Michael Chan
2021-08-28 21:58 ` [PATCH net-next 08/11] bnxt_en: use link_lock instead of hwrm_cmd_lock to protect link_info Michael Chan
2021-08-28 21:58 ` [PATCH net-next 09/11] bnxt_en: update all firmware calls to use the new APIs Michael Chan
2021-08-29 3:49 ` kernel test robot
2021-08-28 21:58 ` [PATCH net-next 10/11] bnxt_en: remove legacy HWRM interface Michael Chan
2021-08-28 21:58 ` [PATCH net-next 11/11] bnxt_en: support multiple HWRM commands in flight Michael Chan
2021-08-28 22:07 ` [PATCH net-next 00/11] bnxt_en: Implement new driver APIs to send FW messages Andrew Lunn
2021-08-28 22:58 ` 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=1630187910-22252-3-git-send-email-michael.chan@broadcom.com \
--to=michael.chan@broadcom.com \
--cc=davem@davemloft.net \
--cc=edwin.peer@broadcom.com \
--cc=gospo@broadcom.com \
--cc=kuba@kernel.org \
--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).