Commit 0155a27c authored by Yuval Mintz's avatar Yuval Mintz Committed by David S. Miller

bnx2x: Fix bnx2x_panic_dump for VFs

bnx2x_panic_dump() prints all kind of driver information, including slowpath
information. Since VFs don't initialize slowpath information, a VF reaching
this flow will likely cause a panic in the system as it will access NULL
pointers.
Signed-off-by: default avatarYuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: default avatarAriel Elior <ariele@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3a3534ec
...@@ -918,7 +918,7 @@ void bnx2x_panic_dump(struct bnx2x *bp, bool disable_int) ...@@ -918,7 +918,7 @@ void bnx2x_panic_dump(struct bnx2x *bp, bool disable_int)
u16 start = 0, end = 0; u16 start = 0, end = 0;
u8 cos; u8 cos;
#endif #endif
if (disable_int) if (IS_PF(bp) && disable_int)
bnx2x_int_disable(bp); bnx2x_int_disable(bp);
bp->stats_state = STATS_STATE_DISABLED; bp->stats_state = STATS_STATE_DISABLED;
...@@ -929,33 +929,41 @@ void bnx2x_panic_dump(struct bnx2x *bp, bool disable_int) ...@@ -929,33 +929,41 @@ void bnx2x_panic_dump(struct bnx2x *bp, bool disable_int)
/* Indices */ /* Indices */
/* Common */ /* Common */
BNX2X_ERR("def_idx(0x%x) def_att_idx(0x%x) attn_state(0x%x) spq_prod_idx(0x%x) next_stats_cnt(0x%x)\n", if (IS_PF(bp)) {
bp->def_idx, bp->def_att_idx, bp->attn_state, struct host_sp_status_block *def_sb = bp->def_status_blk;
bp->spq_prod_idx, bp->stats_counter); int data_size, cstorm_offset;
BNX2X_ERR("DSB: attn bits(0x%x) ack(0x%x) id(0x%x) idx(0x%x)\n",
bp->def_status_blk->atten_status_block.attn_bits, BNX2X_ERR("def_idx(0x%x) def_att_idx(0x%x) attn_state(0x%x) spq_prod_idx(0x%x) next_stats_cnt(0x%x)\n",
bp->def_status_blk->atten_status_block.attn_bits_ack, bp->def_idx, bp->def_att_idx, bp->attn_state,
bp->def_status_blk->atten_status_block.status_block_id, bp->spq_prod_idx, bp->stats_counter);
bp->def_status_blk->atten_status_block.attn_bits_index); BNX2X_ERR("DSB: attn bits(0x%x) ack(0x%x) id(0x%x) idx(0x%x)\n",
BNX2X_ERR(" def ("); def_sb->atten_status_block.attn_bits,
for (i = 0; i < HC_SP_SB_MAX_INDICES; i++) def_sb->atten_status_block.attn_bits_ack,
pr_cont("0x%x%s", def_sb->atten_status_block.status_block_id,
bp->def_status_blk->sp_sb.index_values[i], def_sb->atten_status_block.attn_bits_index);
(i == HC_SP_SB_MAX_INDICES - 1) ? ") " : " "); BNX2X_ERR(" def (");
for (i = 0; i < HC_SP_SB_MAX_INDICES; i++)
for (i = 0; i < sizeof(struct hc_sp_status_block_data)/sizeof(u32); i++) pr_cont("0x%x%s",
*((u32 *)&sp_sb_data + i) = REG_RD(bp, BAR_CSTRORM_INTMEM + def_sb->sp_sb.index_values[i],
CSTORM_SP_STATUS_BLOCK_DATA_OFFSET(func) + (i == HC_SP_SB_MAX_INDICES - 1) ? ") " : " ");
i*sizeof(u32));
data_size = sizeof(struct hc_sp_status_block_data) /
pr_cont("igu_sb_id(0x%x) igu_seg_id(0x%x) pf_id(0x%x) vnic_id(0x%x) vf_id(0x%x) vf_valid (0x%x) state(0x%x)\n", sizeof(u32);
sp_sb_data.igu_sb_id, cstorm_offset = CSTORM_SP_STATUS_BLOCK_DATA_OFFSET(func);
sp_sb_data.igu_seg_id, for (i = 0; i < data_size; i++)
sp_sb_data.p_func.pf_id, *((u32 *)&sp_sb_data + i) =
sp_sb_data.p_func.vnic_id, REG_RD(bp, BAR_CSTRORM_INTMEM + cstorm_offset +
sp_sb_data.p_func.vf_id, i * sizeof(u32));
sp_sb_data.p_func.vf_valid,
sp_sb_data.state); pr_cont("igu_sb_id(0x%x) igu_seg_id(0x%x) pf_id(0x%x) vnic_id(0x%x) vf_id(0x%x) vf_valid (0x%x) state(0x%x)\n",
sp_sb_data.igu_sb_id,
sp_sb_data.igu_seg_id,
sp_sb_data.p_func.pf_id,
sp_sb_data.p_func.vnic_id,
sp_sb_data.p_func.vf_id,
sp_sb_data.p_func.vf_valid,
sp_sb_data.state);
}
for_each_eth_queue(bp, i) { for_each_eth_queue(bp, i) {
struct bnx2x_fastpath *fp = &bp->fp[i]; struct bnx2x_fastpath *fp = &bp->fp[i];
...@@ -1013,6 +1021,11 @@ void bnx2x_panic_dump(struct bnx2x *bp, bool disable_int) ...@@ -1013,6 +1021,11 @@ void bnx2x_panic_dump(struct bnx2x *bp, bool disable_int)
pr_cont("0x%x%s", pr_cont("0x%x%s",
fp->sb_index_values[j], fp->sb_index_values[j],
(j == loop - 1) ? ")" : " "); (j == loop - 1) ? ")" : " ");
/* VF cannot access FW refelection for status block */
if (IS_VF(bp))
continue;
/* fw sb data */ /* fw sb data */
data_size = CHIP_IS_E1x(bp) ? data_size = CHIP_IS_E1x(bp) ?
sizeof(struct hc_status_block_data_e1x) : sizeof(struct hc_status_block_data_e1x) :
...@@ -1064,16 +1077,18 @@ void bnx2x_panic_dump(struct bnx2x *bp, bool disable_int) ...@@ -1064,16 +1077,18 @@ void bnx2x_panic_dump(struct bnx2x *bp, bool disable_int)
} }
#ifdef BNX2X_STOP_ON_ERROR #ifdef BNX2X_STOP_ON_ERROR
if (IS_PF(bp)) {
/* event queue */ /* event queue */
BNX2X_ERR("eq cons %x prod %x\n", bp->eq_cons, bp->eq_prod); BNX2X_ERR("eq cons %x prod %x\n", bp->eq_cons, bp->eq_prod);
for (i = 0; i < NUM_EQ_DESC; i++) { for (i = 0; i < NUM_EQ_DESC; i++) {
u32 *data = (u32 *)&bp->eq_ring[i].message.data; u32 *data = (u32 *)&bp->eq_ring[i].message.data;
BNX2X_ERR("event queue [%d]: header: opcode %d, error %d\n", BNX2X_ERR("event queue [%d]: header: opcode %d, error %d\n",
i, bp->eq_ring[i].message.opcode, i, bp->eq_ring[i].message.opcode,
bp->eq_ring[i].message.error); bp->eq_ring[i].message.error);
BNX2X_ERR("data: %x %x %x\n", data[0], data[1], data[2]); BNX2X_ERR("data: %x %x %x\n",
data[0], data[1], data[2]);
}
} }
/* Rings */ /* Rings */
...@@ -1140,8 +1155,10 @@ void bnx2x_panic_dump(struct bnx2x *bp, bool disable_int) ...@@ -1140,8 +1155,10 @@ void bnx2x_panic_dump(struct bnx2x *bp, bool disable_int)
} }
} }
#endif #endif
bnx2x_fw_dump(bp); if (IS_PF(bp)) {
bnx2x_mc_assert(bp); bnx2x_fw_dump(bp);
bnx2x_mc_assert(bp);
}
BNX2X_ERR("end crash dump -----------------\n"); BNX2X_ERR("end crash dump -----------------\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment