Skip to content

Commit a854a17

Browse files
Shruti Parabkuba-moo
authored andcommitted
bnxt_en: Add 2 parameters to bnxt_fill_coredump_seg_hdr()
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 <[email protected]> Signed-off-by: Shruti Parab <[email protected]> Signed-off-by: Michael Chan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 23a18b9 commit a854a17

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,12 @@ static int bnxt_hwrm_dbg_coredump_retrieve(struct bnxt *bp, u16 component_id,
165165
return rc;
166166
}
167167

168-
static void
168+
void
169169
bnxt_fill_coredump_seg_hdr(struct bnxt *bp,
170170
struct bnxt_coredump_segment_hdr *seg_hdr,
171171
struct coredump_segment_record *seg_rec, u32 seg_len,
172-
int status, u32 duration, u32 instance)
172+
int status, u32 duration, u32 instance, u32 comp_id,
173+
u32 seg_id)
173174
{
174175
memset(seg_hdr, 0, sizeof(*seg_hdr));
175176
memcpy(seg_hdr->signature, "sEgM", 4);
@@ -180,11 +181,8 @@ bnxt_fill_coredump_seg_hdr(struct bnxt *bp,
180181
seg_hdr->high_version = seg_rec->version_hi;
181182
seg_hdr->flags = cpu_to_le32(seg_rec->compress_flags);
182183
} else {
183-
/* For hwrm_ver_get response Component id = 2
184-
* and Segment id = 0
185-
*/
186-
seg_hdr->component_id = cpu_to_le32(2);
187-
seg_hdr->segment_id = 0;
184+
seg_hdr->component_id = cpu_to_le32(comp_id);
185+
seg_hdr->segment_id = cpu_to_le32(seg_id);
188186
}
189187
seg_hdr->function_id = cpu_to_le16(bp->pdev->devfn);
190188
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)
287285
start_utc = sys_tz.tz_minuteswest * 60;
288286
seg_hdr_len = sizeof(seg_hdr);
289287

290-
/* First segment should be hwrm_ver_get response */
288+
/* First segment should be hwrm_ver_get response.
289+
* For hwrm_ver_get response Component id = 2 and Segment id = 0.
290+
*/
291291
*dump_len = seg_hdr_len + ver_get_resp_len;
292292
if (buf) {
293293
bnxt_fill_coredump_seg_hdr(bp, &seg_hdr, NULL, ver_get_resp_len,
294-
0, 0, 0);
294+
0, 0, 0, BNXT_VER_GET_COMP_ID, 0);
295295
memcpy(buf + offset, &seg_hdr, seg_hdr_len);
296296
offset += seg_hdr_len;
297297
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)
346346
end = jiffies;
347347
duration = jiffies_to_msecs(end - start);
348348
bnxt_fill_coredump_seg_hdr(bp, &seg_hdr, seg_record, seg_len,
349-
rc, duration, 0);
349+
rc, duration, 0, 0, 0);
350350

351351
if (buf) {
352352
/* Write segment header into the buffer */

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ struct bnxt_coredump_record {
6868
__le16 rsvd3[313];
6969
};
7070

71+
#define BNXT_VER_GET_COMP_ID 2
72+
7173
#define BNXT_CRASH_DUMP_LEN (8 << 20)
7274

7375
#define COREDUMP_LIST_BUF_LEN 2048
@@ -118,6 +120,11 @@ struct hwrm_dbg_cmn_output {
118120
#define BNXT_DBG_CR_DUMP_MDM_CFG_DDR \
119121
DBG_CRASHDUMP_MEDIUM_CFG_REQ_TYPE_DDR
120122

123+
void bnxt_fill_coredump_seg_hdr(struct bnxt *bp,
124+
struct bnxt_coredump_segment_hdr *seg_hdr,
125+
struct coredump_segment_record *seg_rec,
126+
u32 seg_len, int status, u32 duration,
127+
u32 instance, u32 comp_id, u32 seg_id);
121128
int bnxt_get_coredump(struct bnxt *bp, u16 dump_type, void *buf, u32 *dump_len);
122129
int bnxt_hwrm_get_dump_len(struct bnxt *bp, u16 dump_type, u32 *dump_len);
123130
u32 bnxt_get_coredump_length(struct bnxt *bp, u16 dump_type);

0 commit comments

Comments
 (0)