Skip to content

Commit 8c6f36d

Browse files
Edwin Peerkuba-moo
authored andcommitted
bnxt_en: improve firmware timeout messaging
While it has always been possible to infer that an HWRM command was abandoned due to an unhealthy firmware status by the shortened timeout reported, this change improves the log messaging to account for this case explicitly. In the interests of further clarity, the firmware status is now also reported in these new messages. v2: Remove inline keyword for hwrm_wait_must_abort() in .c file. Reviewed-by: Andy Gospodarek <[email protected]> Signed-off-by: Edwin Peer <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent bce9a0b commit 8c6f36d

File tree

4 files changed

+25
-24
lines changed

4 files changed

+25
-24
lines changed

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7694,19 +7694,6 @@ static void __bnxt_map_fw_health_reg(struct bnxt *bp, u32 reg)
76947694
BNXT_FW_HEALTH_WIN_MAP_OFF);
76957695
}
76967696

7697-
bool bnxt_is_fw_healthy(struct bnxt *bp)
7698-
{
7699-
if (bp->fw_health && bp->fw_health->status_reliable) {
7700-
u32 fw_status;
7701-
7702-
fw_status = bnxt_fw_health_readl(bp, BNXT_FW_HEALTH_REG);
7703-
if (fw_status && !BNXT_FW_IS_HEALTHY(fw_status))
7704-
return false;
7705-
}
7706-
7707-
return true;
7708-
}
7709-
77107697
static void bnxt_inv_fw_health_reg(struct bnxt *bp)
77117698
{
77127699
struct bnxt_fw_health *fw_health = bp->fw_health;

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2305,7 +2305,6 @@ int bnxt_cancel_reservations(struct bnxt *bp, bool fw_reset);
23052305
int bnxt_hwrm_alloc_wol_fltr(struct bnxt *bp);
23062306
int bnxt_hwrm_free_wol_fltr(struct bnxt *bp);
23072307
int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp, bool all);
2308-
bool bnxt_is_fw_healthy(struct bnxt *bp);
23092308
int bnxt_hwrm_fw_set_time(struct bnxt *);
23102309
int bnxt_open_nic(struct bnxt *, bool, bool);
23112310
int bnxt_half_open_nic(struct bnxt *bp);

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

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,18 @@ static void hwrm_req_dbg(struct bnxt *bp, struct input *req)
444444
netdev_err((bp)->dev, fmt, __VA_ARGS__); \
445445
} while (0)
446446

447+
static bool hwrm_wait_must_abort(struct bnxt *bp, u32 req_type, u32 *fw_status)
448+
{
449+
if (req_type == HWRM_VER_GET)
450+
return false;
451+
452+
if (!bp->fw_health || !bp->fw_health->status_reliable)
453+
return false;
454+
455+
*fw_status = bnxt_fw_health_readl(bp, BNXT_FW_HEALTH_REG);
456+
return *fw_status && !BNXT_FW_IS_HEALTHY(*fw_status);
457+
}
458+
447459
static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx)
448460
{
449461
u32 doorbell_offset = BNXT_GRCPF_REG_CHIMP_COMM_TRIGGER;
@@ -455,8 +467,8 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx)
455467
unsigned int i, timeout, tmo_count;
456468
u32 *data = (u32 *)ctx->req;
457469
u32 msg_len = ctx->req_len;
470+
u32 req_type, sts;
458471
int rc = -EBUSY;
459-
u32 req_type;
460472
u16 len = 0;
461473
u8 *valid;
462474

@@ -556,8 +568,11 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx)
556568
usleep_range(HWRM_SHORT_MIN_TIMEOUT,
557569
HWRM_SHORT_MAX_TIMEOUT);
558570
} else {
559-
if (HWRM_WAIT_MUST_ABORT(bp, ctx))
560-
break;
571+
if (hwrm_wait_must_abort(bp, req_type, &sts)) {
572+
hwrm_err(bp, ctx, "Resp cmpl intr abandoning msg: 0x%x due to firmware status: 0x%x\n",
573+
req_type, sts);
574+
goto exit;
575+
}
561576
usleep_range(HWRM_MIN_TIMEOUT,
562577
HWRM_MAX_TIMEOUT);
563578
}
@@ -608,15 +623,19 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx)
608623
usleep_range(HWRM_SHORT_MIN_TIMEOUT,
609624
HWRM_SHORT_MAX_TIMEOUT);
610625
} else {
611-
if (HWRM_WAIT_MUST_ABORT(bp, ctx))
612-
goto timeout_abort;
626+
if (hwrm_wait_must_abort(bp, req_type, &sts)) {
627+
hwrm_err(bp, ctx, "Abandoning msg {0x%x 0x%x} len: %d due to firmware status: 0x%x\n",
628+
req_type,
629+
le16_to_cpu(ctx->req->seq_id),
630+
len, sts);
631+
goto exit;
632+
}
613633
usleep_range(HWRM_MIN_TIMEOUT,
614634
HWRM_MAX_TIMEOUT);
615635
}
616636
}
617637

618638
if (i >= tmo_count) {
619-
timeout_abort:
620639
hwrm_err(bp, ctx, "Error (timeout: %u) msg {0x%x 0x%x} len:%d\n",
621640
hwrm_total_timeout(i), req_type,
622641
le16_to_cpu(ctx->req->seq_id), len);

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,6 @@ void hwrm_update_token(struct bnxt *bp, u16 seq, enum bnxt_hwrm_wait_state s);
8282
#define HWRM_MIN_TIMEOUT 25
8383
#define HWRM_MAX_TIMEOUT 40
8484

85-
#define HWRM_WAIT_MUST_ABORT(bp, ctx) \
86-
(le16_to_cpu((ctx)->req->req_type) != HWRM_VER_GET && \
87-
!bnxt_is_fw_healthy(bp))
88-
8985
static inline unsigned int hwrm_total_timeout(unsigned int n)
9086
{
9187
return n <= HWRM_SHORT_TIMEOUT_COUNTER ? n * HWRM_SHORT_MIN_TIMEOUT :

0 commit comments

Comments
 (0)