Skip to content

Commit 881d835

Browse files
Vasundhara Volamkuba-moo
authored andcommitted
bnxt_en: Add an upper bound for all firmware command timeouts.
The timeout period for firmware messages is passed to the driver from the firmware in the response of the first command. This timeout period is multiplied by a factor for certain long running commands such as NVRAM commands. In some cases, the timeout period can become really long and it can cause hung task warnings if firmware has crashed or is not responding. To avoid such long delays, cap all firmware commands to a max timeout value of 40 seconds. Reviewed-by: Edwin Peer <[email protected]> Signed-off-by: Vasundhara Volam <[email protected]> Signed-off-by: Michael Chan <[email protected]> Acked-by: Willem de Bruijn <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 3e3c09b commit 881d835

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4425,6 +4425,8 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
44254425

44264426
if (!timeout)
44274427
timeout = DFLT_HWRM_CMD_TIMEOUT;
4428+
/* Limit timeout to an upper limit */
4429+
timeout = min(timeout, HWRM_CMD_MAX_TIMEOUT);
44284430
/* convert timeout to usec */
44294431
timeout *= 1000;
44304432

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ struct nqe_cn {
656656
#define BNXT_HWRM_MAX_REQ_LEN (bp->hwrm_max_req_len)
657657
#define BNXT_HWRM_SHORT_REQ_LEN sizeof(struct hwrm_short_input)
658658
#define DFLT_HWRM_CMD_TIMEOUT 500
659+
#define HWRM_CMD_MAX_TIMEOUT 40000
659660
#define SHORT_HWRM_CMD_TIMEOUT 20
660661
#define HWRM_CMD_TIMEOUT (bp->hwrm_cmd_timeout)
661662
#define HWRM_RESET_TIMEOUT ((HWRM_CMD_TIMEOUT) * 4)

0 commit comments

Comments
 (0)