bnxt_en: Retry open if firmware is in reset.

Firmware may be in the middle of reset when the driver tries to do ifup.
In that case, firmware will return a special error code and the driver
will retry 10 times with 50 msecs delay after each retry.

Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Vasundhara Volam 2021-01-25 02:08:15 -05:00 committed by Jakub Kicinski
parent 6882c36cf8
commit 5d06eb5cb1
2 changed files with 14 additions and 2 deletions

View File

@ -9411,8 +9411,8 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up)
struct hwrm_func_drv_if_change_output *resp = bp->hwrm_cmd_resp_addr;
struct hwrm_func_drv_if_change_input req = {0};
bool resc_reinit = false, fw_reset = false;
int rc, retry = 0;
u32 flags = 0;
int rc;
if (!(bp->fw_cap & BNXT_FW_CAP_IF_CHANGE))
return 0;
@ -9421,10 +9421,21 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up)
if (up)
req.flags = cpu_to_le32(FUNC_DRV_IF_CHANGE_REQ_FLAGS_UP);
mutex_lock(&bp->hwrm_cmd_lock);
rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
while (retry < BNXT_FW_IF_RETRY) {
rc = _hwrm_send_message(bp, &req, sizeof(req),
HWRM_CMD_TIMEOUT);
if (rc != -EAGAIN)
break;
msleep(50);
retry++;
}
if (!rc)
flags = le32_to_cpu(resp->flags);
mutex_unlock(&bp->hwrm_cmd_lock);
if (rc == -EAGAIN)
return rc;
if (rc && up) {
rc = bnxt_try_recover_fw(bp);
fw_reset = true;

View File

@ -1554,6 +1554,7 @@ struct bnxt_fw_reporter_ctx {
BNXT_FW_STATUS_HEALTHY)
#define BNXT_FW_RETRY 5
#define BNXT_FW_IF_RETRY 10
struct bnxt {
void __iomem *bar0;