]> git.baikalelectronics.ru Git - kernel.git/commitdiff
bnxt_en: improve firmware timeout messaging
authorEdwin Peer <edwin.peer@broadcom.com>
Sun, 9 Jan 2022 23:54:45 +0000 (18:54 -0500)
committerJakub Kicinski <kuba@kernel.org>
Mon, 10 Jan 2022 00:27:24 +0000 (16:27 -0800)
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 <gospo@broadcom.com>
Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c
drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h

index 2a000d5ae3bf13eb734206dd281eca01dc66b881..4f94136a011a19d073fcfa33f0659514ed237bd5 100644 (file)
@@ -7694,19 +7694,6 @@ static void __bnxt_map_fw_health_reg(struct bnxt *bp, u32 reg)
                                         BNXT_FW_HEALTH_WIN_MAP_OFF);
 }
 
-bool bnxt_is_fw_healthy(struct bnxt *bp)
-{
-       if (bp->fw_health && bp->fw_health->status_reliable) {
-               u32 fw_status;
-
-               fw_status = bnxt_fw_health_readl(bp, BNXT_FW_HEALTH_REG);
-               if (fw_status && !BNXT_FW_IS_HEALTHY(fw_status))
-                       return false;
-       }
-
-       return true;
-}
-
 static void bnxt_inv_fw_health_reg(struct bnxt *bp)
 {
        struct bnxt_fw_health *fw_health = bp->fw_health;
index 0da68dc35c695672f017c6745f7c195f71ec4b61..440dfeb4948bc67fe3f3d7036471b21b3075b4f7 100644 (file)
@@ -2305,7 +2305,6 @@ int bnxt_cancel_reservations(struct bnxt *bp, bool fw_reset);
 int bnxt_hwrm_alloc_wol_fltr(struct bnxt *bp);
 int bnxt_hwrm_free_wol_fltr(struct bnxt *bp);
 int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp, bool all);
-bool bnxt_is_fw_healthy(struct bnxt *bp);
 int bnxt_hwrm_fw_set_time(struct bnxt *);
 int bnxt_open_nic(struct bnxt *, bool, bool);
 int bnxt_half_open_nic(struct bnxt *bp);
index 4c4027cfb3227c998876698680c6297cec09d7a7..566c9487ef556d457471310d6ea809057b90e104 100644 (file)
@@ -444,6 +444,18 @@ static void hwrm_req_dbg(struct bnxt *bp, struct input *req)
                        netdev_err((bp)->dev, fmt, __VA_ARGS__);       \
        } while (0)
 
+static bool hwrm_wait_must_abort(struct bnxt *bp, u32 req_type, u32 *fw_status)
+{
+       if (req_type == HWRM_VER_GET)
+               return false;
+
+       if (!bp->fw_health || !bp->fw_health->status_reliable)
+               return false;
+
+       *fw_status = bnxt_fw_health_readl(bp, BNXT_FW_HEALTH_REG);
+       return *fw_status && !BNXT_FW_IS_HEALTHY(*fw_status);
+}
+
 static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx)
 {
        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)
        unsigned int i, timeout, tmo_count;
        u32 *data = (u32 *)ctx->req;
        u32 msg_len = ctx->req_len;
+       u32 req_type, sts;
        int rc = -EBUSY;
-       u32 req_type;
        u16 len = 0;
        u8 *valid;
 
@@ -556,8 +568,11 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx)
                                usleep_range(HWRM_SHORT_MIN_TIMEOUT,
                                             HWRM_SHORT_MAX_TIMEOUT);
                        } else {
-                               if (HWRM_WAIT_MUST_ABORT(bp, ctx))
-                                       break;
+                               if (hwrm_wait_must_abort(bp, req_type, &sts)) {
+                                       hwrm_err(bp, ctx, "Resp cmpl intr abandoning msg: 0x%x due to firmware status: 0x%x\n",
+                                                req_type, sts);
+                                       goto exit;
+                               }
                                usleep_range(HWRM_MIN_TIMEOUT,
                                             HWRM_MAX_TIMEOUT);
                        }
@@ -608,15 +623,19 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx)
                                usleep_range(HWRM_SHORT_MIN_TIMEOUT,
                                             HWRM_SHORT_MAX_TIMEOUT);
                        } else {
-                               if (HWRM_WAIT_MUST_ABORT(bp, ctx))
-                                       goto timeout_abort;
+                               if (hwrm_wait_must_abort(bp, req_type, &sts)) {
+                                       hwrm_err(bp, ctx, "Abandoning msg {0x%x 0x%x} len: %d due to firmware status: 0x%x\n",
+                                                req_type,
+                                                le16_to_cpu(ctx->req->seq_id),
+                                                len, sts);
+                                       goto exit;
+                               }
                                usleep_range(HWRM_MIN_TIMEOUT,
                                             HWRM_MAX_TIMEOUT);
                        }
                }
 
                if (i >= tmo_count) {
-timeout_abort:
                        hwrm_err(bp, ctx, "Error (timeout: %u) msg {0x%x 0x%x} len:%d\n",
                                 hwrm_total_timeout(i), req_type,
                                 le16_to_cpu(ctx->req->seq_id), len);
index 9a9fc4e8041b6bd65a7e98e5d3722a90815e31a8..d52bd2d63aec060ed218c0510959afd3ba58a9ee 100644 (file)
@@ -82,10 +82,6 @@ void hwrm_update_token(struct bnxt *bp, u16 seq, enum bnxt_hwrm_wait_state s);
 #define HWRM_MIN_TIMEOUT               25
 #define HWRM_MAX_TIMEOUT               40
 
-#define HWRM_WAIT_MUST_ABORT(bp, ctx)                                  \
-       (le16_to_cpu((ctx)->req->req_type) != HWRM_VER_GET &&           \
-        !bnxt_is_fw_healthy(bp))
-
 static inline unsigned int hwrm_total_timeout(unsigned int n)
 {
        return n <= HWRM_SHORT_TIMEOUT_COUNTER ? n * HWRM_SHORT_MIN_TIMEOUT :