From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, andrew+netdev@lunn.ch,
andrew.gospodarek@broadcom.com, hongguang.gao@broadcom.com,
shruti.parab@broadcom.com
Subject: [PATCH net-next 09/11] bnxt_en: Add 2 parameters to bnxt_fill_coredump_seg_hdr()
Date: Tue, 12 Nov 2024 21:36:47 -0800 [thread overview]
Message-ID: <20241113053649.405407-10-michael.chan@broadcom.com> (raw)
In-Reply-To: <20241113053649.405407-1-michael.chan@broadcom.com>
From: Shruti Parab <shruti.parab@broadcom.com>
Pass the component ID and segment ID to this function to create
the coredump segment header. This will be needed in the next
patches to create more segments for the coredump.
Reviewed-by: Hongguang Gao <hongguang.gao@broadcom.com>
Signed-off-by: Shruti Parab <shruti.parab@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
.../ethernet/broadcom/bnxt/bnxt_coredump.c | 20 +++++++++----------
.../ethernet/broadcom/bnxt/bnxt_coredump.h | 7 +++++++
2 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_coredump.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_coredump.c
index 4e2b938ed1f7..4dfc26cfc979 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_coredump.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_coredump.c
@@ -165,11 +165,12 @@ static int bnxt_hwrm_dbg_coredump_retrieve(struct bnxt *bp, u16 component_id,
return rc;
}
-static void
+void
bnxt_fill_coredump_seg_hdr(struct bnxt *bp,
struct bnxt_coredump_segment_hdr *seg_hdr,
struct coredump_segment_record *seg_rec, u32 seg_len,
- int status, u32 duration, u32 instance)
+ int status, u32 duration, u32 instance, u32 comp_id,
+ u32 seg_id)
{
memset(seg_hdr, 0, sizeof(*seg_hdr));
memcpy(seg_hdr->signature, "sEgM", 4);
@@ -180,11 +181,8 @@ bnxt_fill_coredump_seg_hdr(struct bnxt *bp,
seg_hdr->high_version = seg_rec->version_hi;
seg_hdr->flags = cpu_to_le32(seg_rec->compress_flags);
} else {
- /* For hwrm_ver_get response Component id = 2
- * and Segment id = 0
- */
- seg_hdr->component_id = cpu_to_le32(2);
- seg_hdr->segment_id = 0;
+ seg_hdr->component_id = cpu_to_le32(comp_id);
+ seg_hdr->segment_id = cpu_to_le32(seg_id);
}
seg_hdr->function_id = cpu_to_le16(bp->pdev->devfn);
seg_hdr->length = cpu_to_le32(seg_len);
@@ -287,11 +285,13 @@ static int __bnxt_get_coredump(struct bnxt *bp, void *buf, u32 *dump_len)
start_utc = sys_tz.tz_minuteswest * 60;
seg_hdr_len = sizeof(seg_hdr);
- /* First segment should be hwrm_ver_get response */
+ /* First segment should be hwrm_ver_get response.
+ * For hwrm_ver_get response Component id = 2 and Segment id = 0.
+ */
*dump_len = seg_hdr_len + ver_get_resp_len;
if (buf) {
bnxt_fill_coredump_seg_hdr(bp, &seg_hdr, NULL, ver_get_resp_len,
- 0, 0, 0);
+ 0, 0, 0, BNXT_VER_GET_COMP_ID, 0);
memcpy(buf + offset, &seg_hdr, seg_hdr_len);
offset += seg_hdr_len;
memcpy(buf + offset, &bp->ver_resp, ver_get_resp_len);
@@ -346,7 +346,7 @@ static int __bnxt_get_coredump(struct bnxt *bp, void *buf, u32 *dump_len)
end = jiffies;
duration = jiffies_to_msecs(end - start);
bnxt_fill_coredump_seg_hdr(bp, &seg_hdr, seg_record, seg_len,
- rc, duration, 0);
+ rc, duration, 0, 0, 0);
if (buf) {
/* Write segment header into the buffer */
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_coredump.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_coredump.h
index a76d5c281413..f573e55f7e62 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_coredump.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_coredump.h
@@ -68,6 +68,8 @@ struct bnxt_coredump_record {
__le16 rsvd3[313];
};
+#define BNXT_VER_GET_COMP_ID 2
+
#define BNXT_CRASH_DUMP_LEN (8 << 20)
#define COREDUMP_LIST_BUF_LEN 2048
@@ -118,6 +120,11 @@ struct hwrm_dbg_cmn_output {
#define BNXT_DBG_CR_DUMP_MDM_CFG_DDR \
DBG_CRASHDUMP_MEDIUM_CFG_REQ_TYPE_DDR
+void bnxt_fill_coredump_seg_hdr(struct bnxt *bp,
+ struct bnxt_coredump_segment_hdr *seg_hdr,
+ struct coredump_segment_record *seg_rec,
+ u32 seg_len, int status, u32 duration,
+ u32 instance, u32 comp_id, u32 seg_id);
int bnxt_get_coredump(struct bnxt *bp, u16 dump_type, void *buf, u32 *dump_len);
int bnxt_hwrm_get_dump_len(struct bnxt *bp, u16 dump_type, u32 *dump_len);
u32 bnxt_get_coredump_length(struct bnxt *bp, u16 dump_type);
--
2.30.1
next prev parent reply other threads:[~2024-11-13 5:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-13 5:36 [PATCH net-next 00/11] bnxt_en: Add context memory dump to coredump Michael Chan
2024-11-13 5:36 ` [PATCH net-next 01/11] bnxt_en: Update firmware interface spec to 1.10.3.85 Michael Chan
2024-11-13 5:36 ` [PATCH net-next 02/11] bnxt_en: Add mem_valid bit to struct bnxt_ctx_mem_type Michael Chan
2024-11-13 5:36 ` [PATCH net-next 03/11] bnxt_en: Refactor bnxt_free_ctx_mem() Michael Chan
2024-11-13 5:36 ` [PATCH net-next 04/11] bnxt_en: Add a 'force' parameter to bnxt_free_ctx_mem() Michael Chan
2024-11-13 5:36 ` [PATCH net-next 05/11] bnxt_en: Allocate backing store memory for FW trace logs Michael Chan
2024-11-13 5:36 ` [PATCH net-next 06/11] bnxt_en: Manage the FW trace context memory Michael Chan
2024-11-15 4:00 ` Jakub Kicinski
2024-11-13 5:36 ` [PATCH net-next 07/11] bnxt_en: Do not free FW log " Michael Chan
2024-11-13 5:36 ` [PATCH net-next 08/11] bnxt_en: Add functions to copy host " Michael Chan
2024-11-15 3:57 ` Jakub Kicinski
2024-11-13 5:36 ` Michael Chan [this message]
2024-11-13 5:36 ` [PATCH net-next 10/11] bnxt_en: Add a new ethtool -W dump flag Michael Chan
2024-11-13 5:36 ` [PATCH net-next 11/11] bnxt_en: Add FW trace coredump segments to the coredump Michael Chan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241113053649.405407-10-michael.chan@broadcom.com \
--to=michael.chan@broadcom.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew.gospodarek@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hongguang.gao@broadcom.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shruti.parab@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).