From: Jay Ding <[email protected]> The size of the lkup table pool should include the static bucket. The miscalculation casues crash with big number of offloaded flows.
Signed-off-by: Jay Ding <[email protected]> Reviewed-by: Manish Kurup <[email protected]> Reviewed-by: Peter Spreadborough <[email protected]> --- drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c b/drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c index 10149a3963..88863ed6ad 100644 --- a/drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c +++ b/drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c @@ -941,8 +941,7 @@ int tfc_tbl_scope_size_query(struct tfc *tfcp, break; rc = calc_pool_sz_exp(&parms->lkup_pool_sz_exp[dir], - parms->lkup_rec_cnt[dir] - - (1 << parms->static_bucket_cnt_exp[dir]), + parms->lkup_rec_cnt[dir], parms->max_pools); if (rc) break; @@ -1290,6 +1289,7 @@ int tfc_tbl_scope_mem_alloc(struct tfc *tfcp, uint16_t fid, uint8_t tsid, valid, parms->max_pools); } } + return rc; cleanup: for (dir = 0; dir < CFA_DIR_MAX; dir++) { @@ -1632,7 +1632,7 @@ int tfc_tbl_scope_cpm_alloc(struct tfc *tfcp, uint8_t tsid, goto cleanup; } /* Create lkup pool CMM instance */ - qparms.max_records = mem_cfg.rec_cnt; + qparms.max_records = mem_cfg.rec_cnt - mem_cfg.lkup_rec_start_offset; qparms.max_contig_records = pi.lkup_max_contig_rec; rc = cfa_mm_query(&qparms); if (rc != 0) { @@ -1653,7 +1653,8 @@ int tfc_tbl_scope_cpm_alloc(struct tfc *tfcp, uint8_t tsid, /* override the record size since a single pool because * pool_sz_exp is 0 in this case */ - tfc_cpm_set_pool_size(pi.lkup_cpm, mem_cfg.rec_cnt); + tfc_cpm_set_pool_size(pi.lkup_cpm, + mem_cfg.rec_cnt - mem_cfg.lkup_rec_start_offset); /* Store CMM instance in the CPM for pool_id 0 */ rc = tfc_cpm_set_cmm_inst(pi.lkup_cpm, pool_id, cmm_lkup); -- 2.39.5 (Apple Git-154)

