Skip to content

Commit

Permalink
net/bnxt: fix FW readiness check during recovery
Browse files Browse the repository at this point in the history
[ upstream commit 6a4f713 ]

Moved fw readiness check to a new routine bnxt_check_fw_ready().

During error recovery, driver needs to wait for fw readiness.
For that, it uses bnxt_hwrm_ver_get() function now and that
function does parsing of the VER_GET response as well.

Added a new lightweight function bnxt_hwrm_poll_ver_get() for polling
the firmware readiness which issues VER_GET and checks for success
without processing the command response.

Fixes: df6cd7c ("net/bnxt: handle reset notify async event from FW")

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
  • Loading branch information
Kalesh AP authored and cpaelzer committed May 11, 2021
1 parent 7accc1f commit e17e114
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 9 deletions.
27 changes: 18 additions & 9 deletions drivers/net/bnxt/bnxt_ethdev.c
Expand Up @@ -4052,27 +4052,36 @@ static int bnxt_restore_filters(struct bnxt *bp)
return ret;
}

static void bnxt_dev_recover(void *arg)
static int bnxt_check_fw_ready(struct bnxt *bp)
{
struct bnxt *bp = arg;
int timeout = bp->fw_reset_max_msecs;
int rc = 0;

/* Clear Error flag so that device re-init should happen */
bp->flags &= ~BNXT_FLAG_FATAL_ERROR;

do {
rc = bnxt_hwrm_ver_get(bp, SHORT_HWRM_CMD_TIMEOUT);
rc = bnxt_hwrm_poll_ver_get(bp);
if (rc == 0)
break;
rte_delay_ms(BNXT_FW_READY_WAIT_INTERVAL);
timeout -= BNXT_FW_READY_WAIT_INTERVAL;
} while (rc && timeout);
} while (rc && timeout > 0);

if (rc) {
if (rc)
PMD_DRV_LOG(ERR, "FW is not Ready after reset\n");

return rc;
}

static void bnxt_dev_recover(void *arg)
{
struct bnxt *bp = arg;
int rc = 0;

/* Clear Error flag so that device re-init should happen */
bp->flags &= ~BNXT_FLAG_FATAL_ERROR;

rc = bnxt_check_fw_ready(bp);
if (rc)
goto err;
}

rc = bnxt_init_resources(bp, true);
if (rc) {
Expand Down
21 changes: 21 additions & 0 deletions drivers/net/bnxt/bnxt_hwrm.c
Expand Up @@ -5095,3 +5095,24 @@ int bnxt_hwrm_port_ts_query(struct bnxt *bp, uint8_t path, uint64_t *timestamp)

return rc;
}
int bnxt_hwrm_poll_ver_get(struct bnxt *bp)
{
struct hwrm_ver_get_input req = {.req_type = 0 };
struct hwrm_ver_get_output *resp = bp->hwrm_cmd_resp_addr;
int rc = 0;

bp->max_req_len = HWRM_MAX_REQ_LEN;
bp->hwrm_cmd_timeout = SHORT_HWRM_CMD_TIMEOUT;

HWRM_PREP(&req, HWRM_VER_GET, BNXT_USE_CHIMP_MB);
req.hwrm_intf_maj = HWRM_VERSION_MAJOR;
req.hwrm_intf_min = HWRM_VERSION_MINOR;
req.hwrm_intf_upd = HWRM_VERSION_UPDATE;

rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);

HWRM_CHECK_RESULT_SILENT();
HWRM_UNLOCK();

return rc;
}
1 change: 1 addition & 0 deletions drivers/net/bnxt/bnxt_hwrm.h
Expand Up @@ -231,4 +231,5 @@ int bnxt_hwrm_port_ts_query(struct bnxt *bp, uint8_t path,
uint64_t *timestamp);
int bnxt_clear_one_vnic_filter(struct bnxt *bp,
struct bnxt_filter_info *filter);
int bnxt_hwrm_poll_ver_get(struct bnxt *bp);
#endif

0 comments on commit e17e114

Please sign in to comment.