bnxt_en: Retrieve coredump and crashdump size via FW command
Recent firmware provides coredump and crashdump size info via DBG_QCFG command. Read the dump sizes from firmware, instead of computing in the driver. This patch reduces the time taken to collect the dump via ethtool. Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
80f62ba9d5
commit
80194db9f5
@ -7480,6 +7480,8 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
|
||||
bp->fw_cap |= BNXT_FW_CAP_ERR_RECOVER_RELOAD;
|
||||
if (!(flags & FUNC_QCAPS_RESP_FLAGS_VLAN_ACCELERATION_TX_DISABLED))
|
||||
bp->fw_cap |= BNXT_FW_CAP_VLAN_TX_INSERT;
|
||||
if (flags & FUNC_QCAPS_RESP_FLAGS_DBG_QCAPS_CMD_SUPPORTED)
|
||||
bp->fw_cap |= BNXT_FW_CAP_DBG_QCAPS;
|
||||
|
||||
flags_ext = le32_to_cpu(resp->flags_ext);
|
||||
if (flags_ext & FUNC_QCAPS_RESP_FLAGS_EXT_EXT_HW_STATS_SUPPORTED)
|
||||
@ -7543,6 +7545,32 @@ hwrm_func_qcaps_exit:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void bnxt_hwrm_dbg_qcaps(struct bnxt *bp)
|
||||
{
|
||||
struct hwrm_dbg_qcaps_output *resp;
|
||||
struct hwrm_dbg_qcaps_input *req;
|
||||
int rc;
|
||||
|
||||
bp->fw_dbg_cap = 0;
|
||||
if (!(bp->fw_cap & BNXT_FW_CAP_DBG_QCAPS))
|
||||
return;
|
||||
|
||||
rc = hwrm_req_init(bp, req, HWRM_DBG_QCAPS);
|
||||
if (rc)
|
||||
return;
|
||||
|
||||
req->fid = cpu_to_le16(0xffff);
|
||||
resp = hwrm_req_hold(bp, req);
|
||||
rc = hwrm_req_send(bp, req);
|
||||
if (rc)
|
||||
goto hwrm_dbg_qcaps_exit;
|
||||
|
||||
bp->fw_dbg_cap = le32_to_cpu(resp->flags);
|
||||
|
||||
hwrm_dbg_qcaps_exit:
|
||||
hwrm_req_drop(bp, req);
|
||||
}
|
||||
|
||||
static int bnxt_hwrm_queue_qportcfg(struct bnxt *bp);
|
||||
|
||||
static int bnxt_hwrm_func_qcaps(struct bnxt *bp)
|
||||
@ -7552,6 +7580,9 @@ static int bnxt_hwrm_func_qcaps(struct bnxt *bp)
|
||||
rc = __bnxt_hwrm_func_qcaps(bp);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
bnxt_hwrm_dbg_qcaps(bp);
|
||||
|
||||
rc = bnxt_hwrm_queue_qportcfg(bp);
|
||||
if (rc) {
|
||||
netdev_err(bp->dev, "hwrm query qportcfg failure rc: %d\n", rc);
|
||||
|
@ -1961,6 +1961,9 @@ struct bnxt {
|
||||
#define BNXT_FW_CAP_PTP_PPS 0x10000000
|
||||
#define BNXT_FW_CAP_HOT_RESET_IF 0x20000000
|
||||
#define BNXT_FW_CAP_RING_MONITOR 0x40000000
|
||||
#define BNXT_FW_CAP_DBG_QCAPS 0x80000000
|
||||
|
||||
u32 fw_dbg_cap;
|
||||
|
||||
#define BNXT_NEW_RM(bp) ((bp)->fw_cap & BNXT_FW_CAP_NEW_RM)
|
||||
u32 hwrm_spec_code;
|
||||
|
@ -361,13 +361,60 @@ int bnxt_get_coredump(struct bnxt *bp, u16 dump_type, void *buf, u32 *dump_len)
|
||||
}
|
||||
}
|
||||
|
||||
static int bnxt_hwrm_get_dump_len(struct bnxt *bp, u16 dump_type, u32 *dump_len)
|
||||
{
|
||||
struct hwrm_dbg_qcfg_output *resp;
|
||||
struct hwrm_dbg_qcfg_input *req;
|
||||
int rc, hdr_len = 0;
|
||||
|
||||
if (!(bp->fw_cap & BNXT_FW_CAP_DBG_QCAPS))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (dump_type == BNXT_DUMP_CRASH &&
|
||||
!(bp->fw_dbg_cap & DBG_QCAPS_RESP_FLAGS_CRASHDUMP_SOC_DDR))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
rc = hwrm_req_init(bp, req, HWRM_DBG_QCFG);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
req->fid = cpu_to_le16(0xffff);
|
||||
if (dump_type == BNXT_DUMP_CRASH)
|
||||
req->flags = cpu_to_le16(DBG_QCFG_REQ_FLAGS_CRASHDUMP_SIZE_FOR_DEST_DEST_SOC_DDR);
|
||||
|
||||
resp = hwrm_req_hold(bp, req);
|
||||
rc = hwrm_req_send(bp, req);
|
||||
if (rc)
|
||||
goto get_dump_len_exit;
|
||||
|
||||
if (dump_type == BNXT_DUMP_CRASH) {
|
||||
*dump_len = le32_to_cpu(resp->crashdump_size);
|
||||
} else {
|
||||
/* Driver adds coredump header and "HWRM_VER_GET response"
|
||||
* segment additionally to coredump.
|
||||
*/
|
||||
hdr_len = sizeof(struct bnxt_coredump_segment_hdr) +
|
||||
sizeof(struct hwrm_ver_get_output) +
|
||||
sizeof(struct bnxt_coredump_record);
|
||||
*dump_len = le32_to_cpu(resp->coredump_size) + hdr_len;
|
||||
}
|
||||
if (*dump_len <= hdr_len)
|
||||
rc = -EINVAL;
|
||||
|
||||
get_dump_len_exit:
|
||||
hwrm_req_drop(bp, req);
|
||||
return rc;
|
||||
}
|
||||
|
||||
u32 bnxt_get_coredump_length(struct bnxt *bp, u16 dump_type)
|
||||
{
|
||||
u32 len = 0;
|
||||
|
||||
if (dump_type == BNXT_DUMP_CRASH)
|
||||
len = BNXT_CRASH_DUMP_LEN;
|
||||
else
|
||||
__bnxt_get_coredump(bp, NULL, &len);
|
||||
if (bnxt_hwrm_get_dump_len(bp, dump_type, &len)) {
|
||||
if (dump_type == BNXT_DUMP_CRASH)
|
||||
len = BNXT_CRASH_DUMP_LEN;
|
||||
else
|
||||
__bnxt_get_coredump(bp, NULL, &len);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user