Skip to content

Commit 24d694a

Browse files
Shruti Parabkuba-moo
authored andcommitted
bnxt_en: Allocate backing store memory for FW trace logs
Allocate the new FW trace log backing store context memory types if they are supported by the FW. FW debug logs are DMA'ed to the host backing store memory when the on-chip buffers are full. If host memory cannot be allocated for these memory types, the driver will not abort. 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 46010d4 commit 24d694a

File tree

2 files changed

+57
-13
lines changed

2 files changed

+57
-13
lines changed

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

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,6 +2461,15 @@ static bool bnxt_auto_speed_updated(struct bnxt_link_info *link_info)
24612461
return false;
24622462
}
24632463

2464+
bool bnxt_bs_trace_avail(struct bnxt *bp, u16 type)
2465+
{
2466+
u32 flags = bp->ctx->ctx_arr[type].flags;
2467+
2468+
return (flags & BNXT_CTX_MEM_TYPE_VALID) &&
2469+
((flags & BNXT_CTX_MEM_FW_TRACE) ||
2470+
(flags & BNXT_CTX_MEM_FW_BIN_TRACE));
2471+
}
2472+
24642473
#define BNXT_EVENT_THERMAL_CURRENT_TEMP(data2) \
24652474
((data2) & \
24662475
ASYNC_EVENT_CMPL_ERROR_REPORT_THERMAL_EVENT_DATA2_CURRENT_TEMP_MASK)
@@ -8744,16 +8753,34 @@ static int bnxt_backing_store_cfg_v2(struct bnxt *bp, u32 ena)
87448753
{
87458754
struct bnxt_ctx_mem_info *ctx = bp->ctx;
87468755
struct bnxt_ctx_mem_type *ctxm;
8747-
u16 last_type;
8756+
u16 last_type = BNXT_CTX_INV;
87488757
int rc = 0;
87498758
u16 type;
87508759

8751-
if (!ena)
8752-
return 0;
8753-
else if (ena & FUNC_BACKING_STORE_CFG_REQ_ENABLES_TIM)
8754-
last_type = BNXT_CTX_MAX - 1;
8755-
else
8756-
last_type = BNXT_CTX_L2_MAX - 1;
8760+
for (type = BNXT_CTX_SRT; type <= BNXT_CTX_RIGP1; type++) {
8761+
ctxm = &ctx->ctx_arr[type];
8762+
if (!bnxt_bs_trace_avail(bp, type))
8763+
continue;
8764+
if (!ctxm->mem_valid) {
8765+
rc = bnxt_setup_ctxm_pg_tbls(bp, ctxm,
8766+
ctxm->max_entries, 1);
8767+
if (rc) {
8768+
netdev_warn(bp->dev, "Unable to setup ctx page for type:0x%x.\n",
8769+
type);
8770+
continue;
8771+
}
8772+
last_type = type;
8773+
}
8774+
}
8775+
8776+
if (last_type == BNXT_CTX_INV) {
8777+
if (!ena)
8778+
return 0;
8779+
else if (ena & FUNC_BACKING_STORE_CFG_REQ_ENABLES_TIM)
8780+
last_type = BNXT_CTX_MAX - 1;
8781+
else
8782+
last_type = BNXT_CTX_L2_MAX - 1;
8783+
}
87578784
ctx->ctx_arr[last_type].last = 1;
87588785

87598786
for (type = 0 ; type < BNXT_CTX_V2_MAX; type++) {
@@ -8776,7 +8803,7 @@ static void bnxt_free_one_ctx_mem(struct bnxt *bp,
87768803

87778804
ctxm->last = 0;
87788805

8779-
if (ctxm->mem_valid && !force)
8806+
if (ctxm->mem_valid && !force && (ctxm->flags & BNXT_CTX_MEM_PERSIST))
87808807
return;
87818808

87828809
ctx_pg = ctxm->pg_info;

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

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,6 +1881,13 @@ struct bnxt_ctx_mem_type {
18811881
u16 entry_size;
18821882
u32 flags;
18831883
#define BNXT_CTX_MEM_TYPE_VALID FUNC_BACKING_STORE_QCAPS_V2_RESP_FLAGS_TYPE_VALID
1884+
#define BNXT_CTX_MEM_FW_TRACE \
1885+
FUNC_BACKING_STORE_QCAPS_V2_RESP_FLAGS_FW_DBG_TRACE
1886+
#define BNXT_CTX_MEM_FW_BIN_TRACE \
1887+
FUNC_BACKING_STORE_QCAPS_V2_RESP_FLAGS_FW_BIN_DBG_TRACE
1888+
#define BNXT_CTX_MEM_PERSIST \
1889+
FUNC_BACKING_STORE_QCAPS_V2_RESP_FLAGS_NEXT_BS_OFFSET
1890+
18841891
u32 instance_bmap;
18851892
u8 init_value;
18861893
u8 entry_multiple;
@@ -1921,21 +1928,30 @@ struct bnxt_ctx_mem_type {
19211928
#define BNXT_CTX_FTQM FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_FP_TQM_RING
19221929
#define BNXT_CTX_MRAV FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_MRAV
19231930
#define BNXT_CTX_TIM FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_TIM
1924-
#define BNXT_CTX_TKC FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_TKC
1925-
#define BNXT_CTX_RKC FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_RKC
1931+
#define BNXT_CTX_TCK FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_TX_CK
1932+
#define BNXT_CTX_RCK FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_RX_CK
19261933
#define BNXT_CTX_MTQM FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_MP_TQM_RING
19271934
#define BNXT_CTX_SQDBS FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_SQ_DB_SHADOW
19281935
#define BNXT_CTX_RQDBS FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_RQ_DB_SHADOW
19291936
#define BNXT_CTX_SRQDBS FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_SRQ_DB_SHADOW
19301937
#define BNXT_CTX_CQDBS FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_CQ_DB_SHADOW
1931-
#define BNXT_CTX_QTKC FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_QUIC_TKC
1932-
#define BNXT_CTX_QRKC FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_QUIC_RKC
19331938
#define BNXT_CTX_TBLSC FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_TBL_SCOPE
19341939
#define BNXT_CTX_XPAR FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_XID_PARTITION
1940+
#define BNXT_CTX_SRT FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_SRT_TRACE
1941+
#define BNXT_CTX_SRT2 FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_SRT2_TRACE
1942+
#define BNXT_CTX_CRT FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_CRT_TRACE
1943+
#define BNXT_CTX_CRT2 FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_CRT2_TRACE
1944+
#define BNXT_CTX_RIGP0 FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_RIGP0_TRACE
1945+
#define BNXT_CTX_L2HWRM FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_L2_HWRM_TRACE
1946+
#define BNXT_CTX_REHWRM FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_ROCE_HWRM_TRACE
1947+
#define BNXT_CTX_CA0 FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_CA0_TRACE
1948+
#define BNXT_CTX_CA1 FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_CA1_TRACE
1949+
#define BNXT_CTX_CA2 FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_CA2_TRACE
1950+
#define BNXT_CTX_RIGP1 FUNC_BACKING_STORE_QCAPS_V2_REQ_TYPE_RIGP1_TRACE
19351951

19361952
#define BNXT_CTX_MAX (BNXT_CTX_TIM + 1)
19371953
#define BNXT_CTX_L2_MAX (BNXT_CTX_FTQM + 1)
1938-
#define BNXT_CTX_V2_MAX (BNXT_CTX_XPAR + 1)
1954+
#define BNXT_CTX_V2_MAX (BNXT_CTX_RIGP1 + 1)
19391955
#define BNXT_CTX_INV ((u16)-1)
19401956

19411957
struct bnxt_ctx_mem_info {
@@ -2793,6 +2809,7 @@ int bnxt_alloc_rx_data(struct bnxt *bp, struct bnxt_rx_ring_info *rxr,
27932809
u16 prod, gfp_t gfp);
27942810
void bnxt_reuse_rx_data(struct bnxt_rx_ring_info *rxr, u16 cons, void *data);
27952811
u32 bnxt_fw_health_readl(struct bnxt *bp, int reg_idx);
2812+
bool bnxt_bs_trace_avail(struct bnxt *bp, u16 type);
27962813
void bnxt_set_tpa_flags(struct bnxt *bp);
27972814
void bnxt_set_ring_params(struct bnxt *);
27982815
int bnxt_set_rx_skb_mode(struct bnxt *bp, bool page_mode);

0 commit comments

Comments
 (0)