Skip to content

Commit c7dd7ab

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Improve TQM ring context memory sizing formulas.
The current formulas to calculate the TQM slow path and fast path ring context memory sizes are not quite correct. TQM slow path entry is array index 0 of ctx->tqm_mem[]. The other array entries are for fast path. Fix these sizes according to latest firmware spec. for 57500 and newer chips. Fixes: 3be8136 ("bnxt_en: Initialize context memory to the value specified by firmware.") Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ac3158c commit c7dd7ab

File tree

1 file changed

+9
-5
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+9
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6760,6 +6760,7 @@ static int bnxt_alloc_ctx_mem(struct bnxt *bp)
67606760
struct bnxt_ctx_pg_info *ctx_pg;
67616761
struct bnxt_ctx_mem_info *ctx;
67626762
u32 mem_size, ena, entries;
6763+
u32 entries_sp, min;
67636764
u32 num_mr, num_ah;
67646765
u32 extra_srqs = 0;
67656766
u32 extra_qps = 0;
@@ -6849,14 +6850,17 @@ static int bnxt_alloc_ctx_mem(struct bnxt *bp)
68496850
ena |= FUNC_BACKING_STORE_CFG_REQ_ENABLES_TIM;
68506851

68516852
skip_rdma:
6852-
entries = ctx->qp_max_l2_entries + extra_qps;
6853+
min = ctx->tqm_min_entries_per_ring;
6854+
entries_sp = ctx->vnic_max_vnic_entries + ctx->qp_max_l2_entries +
6855+
2 * (extra_qps + ctx->qp_min_qp1_entries) + min;
6856+
entries_sp = roundup(entries_sp, ctx->tqm_entries_multiple);
6857+
entries = ctx->qp_max_l2_entries + extra_qps + ctx->qp_min_qp1_entries;
68536858
entries = roundup(entries, ctx->tqm_entries_multiple);
6854-
entries = clamp_t(u32, entries, ctx->tqm_min_entries_per_ring,
6855-
ctx->tqm_max_entries_per_ring);
6859+
entries = clamp_t(u32, entries, min, ctx->tqm_max_entries_per_ring);
68566860
for (i = 0; i < ctx->tqm_fp_rings_count + 1; i++) {
68576861
ctx_pg = ctx->tqm_mem[i];
6858-
ctx_pg->entries = entries;
6859-
mem_size = ctx->tqm_entry_size * entries;
6862+
ctx_pg->entries = i ? entries : entries_sp;
6863+
mem_size = ctx->tqm_entry_size * ctx_pg->entries;
68606864
rc = bnxt_alloc_ctx_pg_tbls(bp, ctx_pg, mem_size, 1, false);
68616865
if (rc)
68626866
return rc;

0 commit comments

Comments
 (0)